Checkout flow

1. Create checkout session

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.

2. Redirect the shopper to the Smartpay Checkout

Use the url returned by the create checkout session call to redirect the shopper to the Smartpay Checkout.

3. Shopper completes the Smartpay Checkout

Once the shopper completes Smartpay Checkout, they are returned to your website.

  1. 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.
  2. If the shopper cancels, the shopper is redirected to the cancel URL provided by you.

Succeeded order

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.

Rejected order

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.

Although payment is possible without implementing Webhooks, we strongly recommend using Webhooks. In rare cases, when an order is approved but the redirect URL is not called or the customer closes their browser during the redirect, the payment may be completed but the merchant may not receive a notification of completion. Using Webhooks can greatly reduce the likelihood of such problems. For further details see the webhooks overview.