sumup / sumup-ecom-php-sdk

SumUp eCom PHP SDK
Other
41 stars 18 forks source link

Callback never called #20

Closed Alkashi closed 2 years ago

Alkashi commented 4 years ago

Hi,

I use this sdk to generate checkout and accept payment on a mobile app via the sumup card widget that can be found here https://developer.sumup.com/docs/widgets-card/

My process is the following :

  1. The user open my app and press the "Pay by card" button : a request to the server is done to generate the checkout thanks to this sdk and I indicate a callback URL like this $checkoutService = $sumup->getCheckoutService(); $checkoutResponse = $checkoutService->create($amount, $currency, $checkoutRef, $payToEmail, $emailClient, null, $callBackUrl);

  2. The checkout id is retreived and the url of the page containing the card widget is generated and displayed on a webview on my app

  3. The user enter his card number, the validation is done and the user is asked to validate the 3DS process

  4. Some users must validate the 3DS process on their bank app => MY mobile app is on background

The pb is if the user never reopen my app, the payment is never validated because the callback is never called.

Is there a way to make the process completed even if the user never re open my app and display the webview to complete the process ?

Many thanks in advance.

ptrovatelli commented 2 years ago

I haven't tried on mobile yet, but on PC I don't need to set a callback url in the checkout. The widget can handle the callback like so:

<script type="text/javascript">
    SumUpCard.mount({
        checkoutId: '<?php echo $checkoutId; ?>',
        onResponse: function(type, body) {
            // ref: https://developer.sumup.com/docs/widgets-card/
            console.log('Type', type);
            console.log('Body', body);
            if(type === 'success'){
                window.location.href = 'https://...';
            }
        }
    });

You can add a case for type error too, although I haven't come across this case yet - but i'm still working with a test account (even when the payment is canceled, the widget gets a success type).

joelrose commented 2 years ago

If you still experience this issue, please open another issue!