Checkout session

A checkout session represents your customer's session to pay. Each time your customer attempts to pay via the Speed platform, a new session is created. To include the checkout session API, you have to call the method createCheckoutSession with some required parameters for the speed object.

speed.createCheckoutSession({
                currency: "USD",
                amount: "20",
                successUrl: "http://google.com",
                cancelUrl: "http://google.com"
            });

Upon successful creation of the session, it will make an internal call to the payment API to generate information such as the payment QR code and branding details. Your customers can pay by scanning the QR code on a simple payment page that opens in a web browser. Customers do not need a Speed account to pay. Each checkout session will be marked as paid once its respective payment is received.

Method Parameters

currency string required
In this parameter, you must specify your preferred base currency (fiat or cryptocurrency) to create a checkout session. A three-lettered ISO-compliant currency name must be used.


amount BigDecimal required
This is the total amount you intend to collect from the customer via the checkout session. Please add a positive value. Values up to 32 digits can be handled by the amount parameter, which can have a decimal precision of up to 16 digits.


successUrl string required
When the payment is successful, you can use this parameter to redirect the customer to your hosted page.


cancelUrl string required
This parameter is used to redirect your user to any site you want when they do not proceed with the payment and click the return button.


Benefits

  • Start accepting payments within minutes by integrating a few lines of code.
  • The checkout session solution gives you the option to completely customise the checkout flow and accept payment.
  • It also increases customer satisfaction and trust because the customer is redirected to your website after making a successful payment.

Before you begin

Before you begin, make sure to complete the following steps: