Create a checkout session from your server by calling the Create a checkout session endpoint. The call returns the created checkout session and order along with their IDs and the url you need to redirect the shopper to.
Save the returned
order.id in your system as it will be required to manage the order (eg. refund) later.
Creating the checkout session needs to happen from your server. It requires your secret API key. This prevents malicious users from choosing or setting their own prices.
url returned by the create checkout session call to redirect the shopper to the Smartpay Checkout.
Once the shopper completes Smartpay Checkout, they are returned to your website.
- If the shopper clicks confirm, Smartpay will underwrite the transaction and depending on the result (SUCCEEDED or REJECTED) the shopper is redirected to success or cancel URL provided by you.
- If the shopper cancels, the shopper is redirected to the cancel URL provided by you.
If the order was approved by Smartpay, the shopper is redirected to the success URL configured in the checkout session. Present the shopper with an order confirmation/receipt page. You can move ahead with fulfilling the order.
For every approved order a payment is automatically created. You can get all payments that belong to an order and refund any payment using the Order Management API.
If the order was declined by Smartpay, the shopper is redirected to the cancel URL configured in the checkout session. Present an appropriate message to the shopper and ask them to select an alternative payment method.
While you can use Smartpay only relying on redirects, we highly recommend to use webhooks as well. In the rare event that the redirect URL does not get called when an order is authorized, webhooks adds resilience. Both the sucess redirect URL and webhooks are an important part of the payment process and we strongly recommend that you implement both methods. For further details see the webhooks overview.
Updated 12 days ago