Checkout flow

201201

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.