sumup / sumup-ecom-php-sdk

SumUp eCom PHP SDK
Other
41 stars 18 forks source link

$returnURL sometimes called twice by SumUp #44

Open purplespider opened 10 months ago

purplespider commented 10 months ago

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?