Handle Session Modes
The exact request/response payload for each config.modes value. For creating a session in
general (headers, base fields), see Create a Session.
For which mode to pick and why, see Widget Modes
on the widget integration docs.
config.modes takes exactly one value β PAYMENT_WITH_WALLET, PAYMENT_METHOD_ENTRY, PAYMENT,
PAYMENT_METHOD_SELECT, or PAYMENT_METHOD_DISPLAY β even though the field is typed as an array.
Each mode shapes both what you send in the session request and what the session response
contains; the sections below show the exact payload for each.
Modes at a Glanceβ
| Mode | Purpose | Key response field |
|---|---|---|
PAYMENT_WITH_WALLET | Charge a customer's saved wallet payment method | data.payment.status |
PAYMENT_METHOD_ENTRY | Add a new payment method to the wallet | data.paymentMethodResponse |
PAYMENT | One-time payment β guest or wallet user | data.payment.status |
PAYMENT_METHOD_SELECT | Let the customer choose a saved payment method | checkoutRequest.paymentMethod |
PAYMENT_METHOD_DISPLAY | Display one specific saved payment method | data.paymentMethod |
PAYMENT_WITH_WALLETβ
Charges a payment method already saved to the customer's wallet.
/POST session (request)
{
"customer": {},
"payment": {},
"config": {
"modes": ["PAYMENT_WITH_WALLET"]
}
}
/GET session/:id (response)
{
"data": {
"sessionId": "<CHECKOUT_SESSION_ID>",
"status": "COMPLETED",
"payment": {
"id": "",
"amount": 100,
"description": "",
"merchantTransactionId": "",
"merchantId": "",
"paymentType": "",
"currencyCode": "",
"status": "COMPLETED",
"paymentMethodId": "",
"metadata": {},
"error": null,
"statementDescriptorSuffix": null,
"paymentDetails": null
}
}
}
data.payment.status tells you the outcome β poll until it reaches a terminal status (see
Session Lifecycle).
data.payment.error is populated only on failure.
PAYMENT_METHOD_ENTRYβ
Adds a new card or bank account to the customer's wallet, without making a payment.
/POST session (request)
{
"customer": {},
"config": {
"modes": ["PAYMENT_METHOD_ENTRY"],
"paymentMethodChannel": {
"card": ["WEBFORM", "TEXT", "EMAIL"] // "TEXT", "EMAIL" applies only for agent and not user flow
}
}
}
/GET session/:id (response)
{
"data": {
"sessionId": "<CHECKOUT_SESSION_ID>",
"paymentMethodResponse": {
"id": "",
"paymentMethodType": "CARD",
"status": "COMPLETED",
"card": {
"nameOnCard": "",
"cardBrand": "",
"expiryMonth": 1,
"expiryYear": 2020,
"last4": "",
"zipCode": "",
"hsaTagged": false
},
"paymentMethodDetails": {
"type": "CARD",
"nameOnCard": "",
"cardBrand": "",
"expiryMonth": 1,
"expiryYear": 2020,
"last4": "",
"zipCode": "",
"hsaTagged": false
},
"nickname": "",
"default": true
},
"status": "COMPLETED"
}
}
data.paymentMethodResponse.id is the saved payment method's ID β store it if you plan to charge
it later with PAYMENT_WITH_WALLET or PAYMENT_METHOD_SELECT.
PAYMENTβ
A one-time payment β works for both guest and wallet users.
/POST session (request)
{
"customer": {}, // NA for `guest` user
"payment": {},
"config": {
"modes": ["PAYMENT"]
}
}
/GET session/:id (response)
{
"data": {
"sessionId": "<CHECKOUT_SESSION_ID>",
"status": "COMPLETED",
"payment": {
"id": "",
"amount": 100,
"description": "",
"merchantTransactionId": "",
"merchantId": "",
"paymentType": "",
"currencyCode": "",
"status": "COMPLETED",
"paymentMethodId": null,
"metadata": {},
"error": null,
"statementDescriptorSuffix": null
}
}
}
Same shape as PAYMENT_WITH_WALLET above β data.payment.status is the outcome to poll for.
paymentMethodId is null here since no wallet method was referenced.
PAYMENT_METHOD_SELECTβ
Lets the customer choose from their saved payment methods before you charge one.
Most of this response is session bookkeeping you won't need to read directly. What matters: once
the customer picks a method, checkoutRequest.paymentMethod.id holds the selected payment method's
ID β use it the same way you'd use a PAYMENT_METHOD_ENTRY response's ID.
/POST session (request)
{
"customer": {},
"paymentMethod": {
"id": ""
},
"config": {
"modes": ["PAYMENT_METHOD_SELECT"]
}
}
/GET session/:id (response)
{
"data": {
"id": "",
"checkoutRequest": {
"paymentType": null,
"authorizeCard": null,
"merchantTransactionId": null,
"amount": null,
"statementDescriptorSuffix": null,
"paymentDescription": null,
"phoneNumber": null,
"email": "",
"firstName": "",
"config": {
"paymentMethodChannel": {
"cardChannels": [
{ "type": "WEBFORM", "order": 0, "enabled": true }
],
"card": ["WEBFORM"]
},
"modes": ["PAYMENT_METHOD_SELECT"],
"paymentMethod": [
{
"type": "CARD",
"channels": [{ "type": "WEBFORM", "order": 0, "enabled": true }]
},
{
"type": "BANK_ACCOUNT",
"channels": [{ "type": "WEBFORM", "order": 0, "enabled": true }]
}
],
"privacyPolicyUrl": "",
"senderEmailAddress": "",
"options": null
},
"agent": null,
"assistedByAgent": null,
"metadata": null,
"paymentDetails": null,
"paymentMethod": { "id": "", "default": false },
"consent": null
},
"merchantId": "",
"checkoutSessionStatus": "CREATED",
"customerId": "",
"vendorMerchantId": "",
"paymentId": null,
"paymentMethodId": null,
"childSessionId": null,
"childSession": null,
"appearance": null,
"error": null,
"paymentMethod": null,
"payment": null,
"warning": null,
"features": null,
"expiresAtUtc": "",
"createdAtUtc": "",
"hcpToken": ""
}
}
PAYMENT_METHOD_DISPLAYβ
Displays one specific saved payment method β the customer confirms it rather than choosing among several.
data.paymentMethod is the full saved payment method (type, card/bank details, status). Most of
the surrounding fields (vendorMerchantId, hcpToken, etc.) are session bookkeeping, not
something you'll typically read directly.
/POST session (request)
{
"customer": {}, // Customer identification details are required.
"paymentMethod": {
"id": "" // This is a required field.
},
"config": {
"modes": ["PAYMENT_METHOD_DISPLAY"]
}
}
/GET session/:id (response)
{
"data": {
"id": "",
"checkoutRequest": {
"paymentType": null,
"authorizeCard": null,
"merchantTransactionId": null,
"amount": null,
"statementDescriptorSuffix": null,
"paymentDescription": null,
"phoneNumber": null,
"email": "",
"firstName": "",
"config": {
"paymentMethodChannel": {
"cardChannels": [
{ "type": "WEBFORM", "order": 0, "enabled": true }
],
"card": ["WEBFORM"]
},
"modes": ["PAYMENT_METHOD_DISPLAY"],
"paymentMethod": [
{
"type": "CARD",
"channels": [{ "type": "WEBFORM", "order": 0, "enabled": true }]
}
],
"privacyPolicyUrl": "",
"senderEmailAddress": "",
"options": null
},
"agent": null,
"assistedByAgent": null,
"metadata": null,
"paymentDetails": null,
"paymentMethod": { "id": "", "default": false },
"consent": null
},
"merchantId": "",
"checkoutSessionStatus": "CREATED",
"customerId": "",
"vendorMerchantId": "",
"paymentId": null,
"paymentMethod": {
"id": "<REQUESTED_PAYMENT_METHOD_ID>",
"paymentMethodType": "CARD",
"card": {
"type": "CARD",
"nameOnCard": "",
"cardBrand": "",
"expiryMonth": 3,
"expiryYear": 2043,
"last4": "",
"zipCode": "",
"status": "ACTIVE",
"manufacturerCard": false,
"hsaTagged": false
},
"nickname": "",
"paymentMethodDetails": {
"type": "CARD",
"nameOnCard": "",
"cardBrand": "",
"expiryMonth": 3,
"expiryYear": 2043,
"last4": "",
"zipCode": "",
"status": "ACTIVE",
"manufacturerCard": false,
"hsaTagged": false
},
"default": true
},
"childSessionId": null,
"childSession": null,
"appearance": null,
"error": null,
"payment": null,
"warning": null,
"features": null,
"expiresAtUtc": "",
"createdAtUtc": "",
"hcpToken": ""
}
}
Related Documentationβ
- Create a Session
- Sessions β Modes, Config & Status Reference
- Widget Modes β why/when to use each mode