checkoutUrl is different.
Before you begin
Complete Set up Roqqett. You need the ID of an activeSHOPPING checkout.
How it works
1
Load the library
Your payment page loads the library and creates a Roqqett instance.
2
The payer clicks your Roqqett button
You call
checkout() with a promise of the session’s checkoutUrl. The library opens the pop-up at once, with a holding page.3
Your server creates a checkout session
Your server creates the session and returns its
checkoutUrl. The pop-up then shows the payment.4
The payer pays
The payer approves the payment at their bank, in the pop-up or on their phone.
5
Roqqett tells you the outcome
The library calls your callbacks in the browser. Your server confirms the session’s status before you fulfil the order.
Step 1: Load the library
Add the script to your payment page, and create the Roqqett instance once the page has loaded.Roqqett() takes no arguments. You pass your callbacks to checkout().
Step 2: Add a Roqqett button
Add a button to your payment page for the payer to choose Roqqett, for example:Step 3: Start the checkout
Callcheckout() from your button’s click handler, before any await. Browsers block pop-ups that don’t open straight from a click, so pass checkoutUrl as a promise: the library opens the pop-up at once, and loads the session when the promise resolves.
checkoutUrl when the payer clicks, you can pass it as a string instead.
checkout(callbacks, { checkoutUrl, isApp }) takes:
The returned promise resolves with
{ checkoutSessionId } once the pop-up is connected to the session. It rejects when the checkout can’t start, with an Error whose reason is one of the failure reasons.
If the payer clicks again while the pop-up is open, the library brings the pop-up to the front. For the same checkoutUrl, checkout() returns the same promise. For a different one, it refuses with CHECKOUT_IN_PROGRESS.
Callbacks
Each callback is optional, and gets an event with:checkoutSessionId: the session.status:completed,pending,cancelled,failedorexpired.final:truewhen the session has ended and the pop-up has closed.returnUrl: the session’sreturnUrl.reason: only when the checkout couldn’t start or was ended by the library.
The library only sends the payer to an
https return URL. Roqqett doesn’t add query parameters to it, so put your own order reference in each session’s returnUrl.
A callback doesn’t prove the payer paid. Before you fulfil the order, confirm the session’s status on your server.
Failure reasons
Step 4: Create the checkout session
Your server creates the checkout session exactly as for the hosted checkout, and returns itscheckoutUrl to your page. See Create a checkout session.
Create a new session for each attempt to pay, with its own idempotencyKey. To stop a session from being paid, for example when the payer chooses another payment method, cancel it.
Mobile apps
If your page runs inside your own mobile app’s web view, passisApp: true: