The Payment Sessions API is a unified solution designed to streamline payment processing for merchants.

Key Features

  • Flexible Payment Flows: Handle one-time payments, first-time setup payments for subscriptions, and repeat charges with minimal effort.
  • Branded Checkout Experience: Redirect your customers to a secure, customizable checkout page to complete their transactions.
  • Seamless Recurring Payments: Use saved payment methods for a series of transactions initiated and completed without customer interaction.

Benefits

  • Simplicity: Manage various payment scenarios with a single API.
  • Customizability: Tailor the payment experience to fit your brand.
  • Scalability: Support a variety of payment methods and grow your business globally.

How It Works

1

Create a Payment Session

Start by creating a payment session with all necessary details like amount, currency, and payment type.
2

Redirect if Required

  • For payments, where the customer is present, redirect them to the checkout page provided in the session_url to complete the payment.
  • For recurring payments, where the customer is not present, use the customer’s saved payment method for processing the payment without any customer interaction.
3

Track Payment Status

Monitor the status of your payments in real-time using webhooks or API calls.


Session Type

The API supports three distinct types of payment sessions to uniformly handle both customer-present and customer-not-present payments, as follows:
  • one_time: A one-time payment, where the customer is present in the flow and completes the payment in real-time. This session type also offers the flexibility to save the customer’s payment method for future use during other payments where the customer is present in the flow.
  • first_in_series: The first payment in a series, where the customer is present in the flow, allowing the customer to authorise and save their payment method for future payments where the customer is not present in the flow. This authorisation is referred to as a mandate. This session type is typically used to set up recurring payments, such as subscriptions or installment plans.
  • next_in_series: A next payment in a series, where the customer is not present in the flow, using a previously saved payment method and relying on an existing mandate. This session type is fully programmatic, requires no customer interaction, and is ideal for recurring payments like monthly subscriptions or utility bills.

A mandate is an authorisation that allows a merchant to initiate future payments when the customer is not present in the flow.

The following table summarises the differences:
one_timefirst_in_seriesnext_in_series
Primary PurposeOne-time payment by the customer.First payment to set up future automatic payments.Next payment in a series.
Customer InteractionRequired (customer is present).Required (customer is present).Not required (customer is absent).
Saving Payment MethodOptional (for customer present use).Mandatory (for customer absent use).Not applicable (uses saved method).
Mandate CreationNo mandate created.Mandate created for future payments.Relies on an existing mandate.
Payment FlowCustomer completes via Checkout page.Customer completes via Checkout page.Payment processed programmatically.
ExamplesOne-off purchase with the option to save for future purchases.Subscription setup or installment plan.Monthly subscription charge or utility bill.

Use Cases

There are multiple possible scenarios, each tailored to specific customer and merchant interactions. Below are some examples:


A quick overview of the differences between these scenarios are as follows:
ScenarioSession TypeCustomer InteractionSaving Payment MethodExamples
One-off payment without savingone_timeRequired (customer-present)NoBuying a product one time.
One-off payment with savingone_timeRequired (customer-present)Yes (for future customer-present use)Purchasing and saving card for later.
Setup for future paymentsfirst_in_seriesRequired (customer-present)Yes (for future customer-not-present use)Signing up for a subscription.
Recurring paymentnext_in_seriesNot required (customer-not-present)Uses previously saved payment methodMonthly subscription charge.

Status

The status field of a payment session represents the current stage in the payment session lifecycle:
The transitions below ensure that the payment session lifecycle is fully traceable and supports retries where appropriate:

Webhooks

The state of the payment session can be tracked by consuming webhook events. The event will contain a payment_session object that includes, amongst other fields, the created_at, updated_at and payment_id fields. Where applicable the customer_id and payment_method_id fields, that are needed for a subsequent (next_in_series) payment, is also included, and is sometimes referred to as a token. The payment session events are:
  • payment_session.created: Indicates a payment session was created successfully and can be used to initiate the payment process. See the payment_session.created event for more information.
  • payment_session.updated: Indicates a payment session was updated successfully and can be used for tracking the status of the payment session. See the payment_session.updated event for more information.