Introduction to Payment Sessions
Create a Payment Session
Redirect if Required
session_url
to complete the payment.Track Payment Status
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.one_time | first_in_series | next_in_series | |
---|---|---|---|
Primary Purpose | One-time payment by the customer. | First payment to set up future automatic payments. | Next payment in a series. |
Customer Interaction | Required (customer is present). | Required (customer is present). | Not required (customer is absent). |
Saving Payment Method | Optional (for customer present use). | Mandatory (for customer absent use). | Not applicable (uses saved method). |
Mandate Creation | No mandate created. | Mandate created for future payments. | Relies on an existing mandate. |
Payment Flow | Customer completes via Checkout page. | Customer completes via Checkout page. | Payment processed programmatically. |
Examples | One-off purchase with the option to save for future purchases. | Subscription setup or installment plan. | Monthly subscription charge or utility bill. |
One-Off Payment Without Saving the Payment Method
one_time
save_payment_method
option is set to never
.One-Off Payment With Saving the Payment Method
one_time
save_payment_method
option is set to always
or prompt
.Setup for Future Payments
first_in_series
Recurring Payments
first_in_series
session.next_in_series
Scenario | Session Type | Customer Interaction | Saving Payment Method | Examples |
---|---|---|---|---|
One-off payment without saving | one_time | Required (customer-present) | No | Buying a product one time. |
One-off payment with saving | one_time | Required (customer-present) | Yes (for future customer-present use) | Purchasing and saving card for later. |
Setup for future payments | first_in_series | Required (customer-present) | Yes (for future customer-not-present use) | Signing up for a subscription. |
Recurring payment | next_in_series | Not required (customer-not-present) | Uses previously saved payment method | Monthly subscription charge. |
status
field of a payment session represents the current stage in the payment session lifecycle:
active
one_time
and first_in_series
: The session remains in an active state while the customer is interacting with the Checkout page via the session_url
. In the event of a failed payment, the session remains in an active state to allow a customer to make another payment attempt. In the event of a successful payment, the session transitions into a completed state.next_in_series
: The session is briefly in an active state while the payment is being processed without customer interaction using a saved payment method. In the event of both successful and failed payments, the session transitions into a completed state.(payment_status)
will reflect the outcome of the payment, either paid or unpaid. If the payment status is paid the payment_id
field represents the associated payment.completed
one_time
and first_in_series
: The session has completed with the customer having completed the payment flow. This typically implies the payment was successful, but should be verified by interrogating the payment status (payment_status)
as described below.next_in_series
: The session has completed without customer interaction using a saved payment method, but the payment may have either suceeded or failed. The status should verified by interrogating the payment status field (payment_status)
as described below.(payment_status)
will reflect the outcome of the payment, either paid or unpaid. If the payment status is paid the payment_id
field represents the associated payment.expired
one_time
and first_in_series
: The customer did not complete the checkout process in time.next_in_series
: Not applicable.cancelled
one_time
and first_in_series
: The customer or merchant chose to cancel the payment.next_in_series
: Not applicableOne Time and First In Series Payment Sessions
From State | To State | Condition | Description |
---|---|---|---|
active | completed | Payment was successful. | The session completed successfully, and the payment was successful. The payment status (payment_status) will reflect the outcome of the payment as paid. |
active | active | Payment failed. | The session remains in an active state after a failed payment to allow the customer to make another payment attempt. |
active | expired | The session timed out due to inactivity. | The session expired because the customer didn’t complete the payment or the authorization timed out. |
active | cancelled | The session was explicitly cancelled by the customer or merchant. | The session was cancelled during checkout or before the programmatic payment was processed. |
Next In Series Payment Sessions
From State | To State | Condition | Description |
---|---|---|---|
active | completed | Payment was successful. | The session completed successfully, and the payment was successful. The payment status (payment_status) will reflect the outcome of the payment as paid. |
active | completed | Payment failed. | The session completed successfully, however the payment failed. The payment status (payment_status) will reflect the outcome of the payment as unpaid. |
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.