Comments (3)
After calling create function, you should call pay function. You can implement this by 2 ways.
First is to create a checkout page using sumup-card widget (https://gateway.sumup.com/gateway/ecom/card/v2/sdk.js)
var sumupcard = SumUpCard.mount({
checkoutId: checkoutId,
showAmount: true,
showFooter: true,
onResponse: function(type, body) {
console.log("Type", type);
console.log("Body", body);
if (type == "success") {
...
} else {
...
}
},
});
You can check the status of payment (e.g. "PAID" or "FAILED") in the body of response.
Second is to call process checkout API using customService of sumup-ecom-php-sdk like the following.
$customService = $sumup->getCustomService();
$response = $customService->request("PUT", "/v0.1/checkouts/:id", [
"payment_type": "card",
"card": {
"name": "John Doe",
"number": "4242424242424242",
"expiry_month": "12",
"expiry_year": "34",
"cvv": "123"
}
]);
I hope this will help you.
from sumup-ecom-php-sdk.
how can I test with a fake card? because when I do a put to validate the checkout it returns me a "client error"
this is my code
` try {
$data = json_encode([
'payment_type' => 'card',
'card' => [
'name' => 'John Doe',
'number' => '4242424242424242',
'expiry_month' => '12',
'expiry_year' => '34',
'cvv' => '123',
],
]);
$sumup = new SumUp([
'app_id' => $this->clientId,
'app_secret' => $this->clientSecert,
'grant_type' => 'client_credentials',
'scopes' => ['payments', 'transactions.history', 'user.app-settings', 'user.profile_readonly'],
]);
$customService = $sumup->getCustomService();
$checkoutId = 'id';
$response = $customService->request('PUT', "/v0.1/checkouts/{$checkoutId}", $data);
dump($response);
} catch (SumUpSDKException $exception) {
dd($exception);
}`
[SumUp\Exceptions\SumUpResponseException](http://127.0.0.1:8000/_profiler/open?file=vendor/sumup/sumup-ecom-php-sdk/src/SumUp/Exceptions/SumUpResponseException.php&line=10#line10) {#885 ▼ #message: "Client error" #code: 400 #file: "[/home/belhassen/Documents/dev/ams/ams-mantes-association/vendor/sumup/sumup-ecom-php-sdk/src/SumUp/HttpClients/Response.php](http://127.0.0.1:8000/_profiler/open?file=vendor/sumup/sumup-ecom-php-sdk/src/SumUp/HttpClients/Response.php&line=103#line103)" #line: 103 trace: {▶} }
from sumup-ecom-php-sdk.
Do you have any idea why I get a 400 error every time?
from sumup-ecom-php-sdk.
Related Issues (20)
- getting 403 error in checkout api HOT 4
- error compsoser HOT 3
- How to create YOUR-AUTHORIZATION-CODE HOT 1
- Missing support of create checkout with merchant_code HOT 1
- SumUp integration in Php using Api's HOT 1
- Documentation Typo
- Response error: request_not_allowed. Error 403 on Payment HOT 1
- Fatal error: Class 'SumUp\SumUp' not found in
- Make a webhook
- How to get payment gateway methods list of merchant account using sumUp apis HOT 1
- SumUp SDK error: Internal Server Error (3imsx1wj4pebs) HOT 1
- Most transactions fails when using sdk or REST API v0.2 HOT 2
- Error if wrong grant_type HOT 1
- JS console deprecation warning
- SSL Certificate problem HOT 1
- $returnURL sometimes called twice by SumUp
- Wy i have response 400 ? HOT 2
- Update Checkout creation to use merchant_code instead of pay_to_email
- Change amount dynamically problem
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sumup-ecom-php-sdk.