Using Cake's checkout page

Overview

Accepting payments in various currencies across the globe can pose a challenge due to the intricacies involved in managing diverse currencies and payment methods under a single application. However, with Cake, this hurdle can be effortlessly surmounted by enabling payments from your customers through an easy-to-setup checkout page. The checkout page is customisable to meet your requirements, offering the flexibility to alter its colour scheme and layout.

In this guide, we'll delve deeper into how Cake facilitates seamless acceptance of payments worldwide in multiple currencies, and how it can smoothly integrate with your platform, making the process as easy as a piece of Cake 🍰.

Prerequisites

Before getting started with accepting payments using your customised checkout page, there are some preliminary steps that need to be completed. Let's explore these essential steps in more detail.

A registered account with Cake

It's imperative to have an account created with Cake.
Registration as a company and completion of the onboarding process are required.
If you encounter any hurdles, feel free to reach out to a Cake admin for assistance.

Complete onboarding

Ask the Cake Admin's for a pre filled onboarding form which would allow us to enable Payment Acceptance for your account.

Merchant profile

Setting up a merchant profile is crucial for payment acceptance.
The profile primarily comprises of details which are essential for customising your checkout page.
Currently, a Cake admin will assist in setting up the merchant profile.
It's advisable to have the following details at your disposal:

  1. Legal company name
  2. Background colour hex code (for your checkout page)
  3. Company logo
  4. List of currencies you want to receive payment in

Client tokens

As of now you can get your client key pairs (client_id and client_secret) for both the sandbox and live environment through a Cake Admin. You can use these keys to get your own access token

Learn how to get your token using the client keys here.

This access token enables access to Cake's payment API's for various operations.

Capturing payment from the customer

By this point, it's presumed that all necessary prerequisites for integrating the checkout flow have been met. Now, let’s understand how to utilize this checkout page for capturing a payment from a customer.

Create a payment session

The process begins with the creation of a payment session.

Each session has a lifespan of 5 minutes within which the payment capture must be completed.
A session is dedicated to capturing a single payment.

An API call is needed to create a session, and this can be done using the programming language of your choice. Detailed information regarding the API call can be found here.

The 'Create session' API will provide a session ID and a link to redirect your customer to. Here is a description of the fields that we use for creating a session

FieldDescription
amountPayment amount to capture.
currencyCurrency for payment.
first_nameFirst name of the customer.
last_nameLast name of the customer.
emailEmail address of the customer.
order_idOrder Id for the entity for which payment is being captured.
descriptorDescription that would be visible in the bank account transaction. (max length: 20 chars)
cancel_urlThe url to which the customer would be redirected in the case of payment failure.
success_urlThe url to which the customer would be redirected post successful payment capture.
form_typeThe type of payment form that would load on the checkout page. Possible values are card, bank and bank-and-card(default).

You would get a session_id as part of a successful response from the create session API. Keep this handy, we would use them in the next step.

Accessing your checkout page

Using the session_id and the token (without Bearer) which we get after authentication with the keys, you can now redirect your customer to the following link of your own customised checkout page.

<https://sandbox.securelinks.co?session_id={SESSION_ID}&token={AUTH_TOKEN}>

Once redirected successfully the customer can enter their name, card number, card expiry month, card expiry year and cvc as part of their payment method and can proceed with the payment.

You can use the following card details to test out the flow.

Card NumberCard Expiry MonthCard Expiry YearCard CVC
4012000300001003012025123
4035501000000008062026321

If the payment is successful your customer would be redirected to the success_url which you provided when creating the session with a transaction_id in the url param else they would be redirected to the cancel_url with a url param message which would contain the reason for the error.

Conclusion

By the time you reach here you have successfully captured a payment from your customer. Please feel free to reach out to us if you feel stuck somewhere or have some suggestions or improvements for us.

We really hope that setting up your own customised checkout page was a piece of cake 🍰 for you.