Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Most transactions fails when using sdk or REST API v0.2 #39

Open
multikitty opened this issue Apr 8, 2023 · 2 comments
Open

Most transactions fails when using sdk or REST API v0.2 #39

multikitty opened this issue Apr 8, 2023 · 2 comments

Comments

@multikitty
Copy link

I created checkout page using Payment Widget sdk like the following:

<div id="sumup-card">

<script src="https://gateway.sumup.com/gateway/ecom/card/v2/sdk.js"></script>
<script>
var sumupcard = SumUpCard.mount({
    checkoutId: checkoutId,
    showAmount: true,
    showFooter: true,
    locale: "de-DE",
    onResponse: function(type, body) {
        if (type=="success") {
            console.log(body);
        }
    },
});
</script>

When I click the submit button, the request is sent to https://api.sumup.com/v0.2/checkouts/:id
image
Transactions almost always fail. Most transactions fail. I wonder if v0.2 is the reason.
So I tried to process checkouts via REST API v0.2 instead of v0.1.
The result is same as sdk. But the transactions always succeed via v0.1.
Who can let me know the url of sumup-card widget sdk file using v0.1 if it exist?

@multikitty multikitty changed the title Transaction failed when using sdk or REST API v0.2 Most transactions fails when using sdk or REST API v0.2 Apr 8, 2023
@cristianoliveira
Copy link

Hello there, @multikitty thanks for reporting.

The usage of v0.2 API may not be the issue with the failed payments. This version has been used since 2020 :)

Here is a working example of an app for reference:
https://github.com/cristianoliveira/nextjs-sumup-payments-starter

And here is where the SDK is used:
https://github.com/cristianoliveira/nextjs-sumup-payments-starter/blob/main/components/PaymentWidget.tsx#L18

@multikitty
Copy link
Author

Thanks for your response.

        onResponse: function (type: string, body: { status: string }) {
          if (type === 'success' && body.status === 'PAID') {
            onSuccess({ message: 'Thanks! 🎉' });
          }

          if (type === 'success' && body.status === 'FAILED') {
            onError({
              message:
                'Something went wrong with the payment. Check your info and try again.',
            });
          }

          if (type === 'fail') {
            onError({
              message:
                'Something went wrong with our system. See console logs for details.',
            });
          }

          console.log('Type', type);
          console.log('Body', body);
        },

In my case, the response -> (type === 'success' && body.status === 'FAILED') (almost always)
Payload information are always same, but sometimes body.status === 'PAID' and almost body.status === 'FAILED'.
Could you tell me about this reason?
Regards

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants