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

$returnURL sometimes called twice by SumUp #44

Open
purplespider opened this issue Aug 25, 2023 · 2 comments
Open

$returnURL sometimes called twice by SumUp #44

purplespider opened this issue Aug 25, 2023 · 2 comments

Comments

@purplespider
Copy link

I use the following to perform a checkout on my site:

        try {
            $sumup = $this->sumUpInstance();
            $checkoutService = $sumup->getCheckoutService();
            $checkoutResponse = $checkoutService->create($amount, $currency, $checkoutRef, $payToEmail, $description, $payFromEmail, $returnURL);
            $checkoutId = $checkoutResponse->getBody()->id;
            //  pass the $chekoutId to the front-end to be processed
        } catch (\SumUp\Exceptions\SumUpAuthenticationException $e) {
            echo 'Authentication error: ' . $e->getMessage();
        } catch (\SumUp\Exceptions\SumUpResponseException $e) {
            echo 'Response error: ' . $e->getMessage();
        } catch (\SumUp\Exceptions\SumUpSDKException $e) {
            echo 'SumUp SDK error: ' . $e->getMessage();
        }

When the provided $returnURL is accessed, the booking is marked as "Paid" and a confirmation email is sent.

However, it seems that sometimes SumUp will access this URL twice, at basically the same time, resulting in the customer receiving two confirmation emails (despite a check on if it's already been marked as paid).

Is this an issue on SumUp's side that is causing this duplicate callback to the $returnURL?

@entinio
Copy link

entinio commented Oct 10, 2024

Did you find a way to avoid that double call? I exactly have the same problem right now. That return_url webhook is called twice instantly, making it complicated to handle with asynchronous functions.

@purplespider
Copy link
Author

I may be wrong, but I think I did implement a workaround by calling the SumUp API when the confirmation page loaded, to instantly get the payment status meaning the payment got logged as paid at my end, before SumUp even made the double webhook call. I've since switched to Stripe.

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