Skip to content

Payment Sessions

A payment session is an in-progress payment transaction. It is a temporary, time-limited context created when a client initiates a payment flow.

It becomes a secure, stateful environment for completing a payment transaction. Instead of passing sensitive payment data on every request, the payment session persists transaction details. This includes the amount, currency, payment methods, and status. It exposes only the payment session identifier to the client. This reduces the risk of data exposure.

A payment session is used only with Flute Elements or Flute Checkout. The paymentSessionType field records which one:

  • A Flute Checkout session is for Flute's own hosted payment page. Create one with POST /v2/payment-sessions/checkout, then redirect the customer to the returned checkoutUrl.
  • A Flute Elements session is for a merchant-built UI using the Flute Elements SDK. Create one with POST /v2/payment-sessions/elements, then initialize the SDK with the returned paymentSessionId.

Both creation endpoints return the same session object, and so does retrieving one.

The following is a common workflow for using a payment session.

  • Create the payment session, as a Flute Checkout or a Flute Elements session.
  • Connect through Flute Elements or Flute Checkout. This may include selecting a payment method, applying discounts or promotions, authorizing the payment, and capturing the funds. Many of these individual steps will be transparent to the client when using Flute Elements or Flute Checkout.

At each step, the payment session holds the transaction state. This means each step can update the session without resubmitting the full transaction data. If the client navigates away but later returns, the session can be retrieved by its identifier with GET /v2/payment-sessions/{{paymentSessionId}}. The flow resumes from its last state.

The paymentSessionStatus field tracks where the session stands. The session ends in one of these statuses:

  • Completed. The payment, or the vault for a SaveMethod session, succeeded. paymentSessionResult carries what it produced: the saved payment method, the charged transaction, or both.
  • Failed. A payment attempt on the session failed. Create a new session to retry.
  • Cancelled. The merchant canceled the session with POST /v2/payment-sessions/{{paymentSessionId}}/cancel, while it was still Created. A new session must be started to try again.
  • Expired. The session's expiresOn passed while it was still Created. A payment submitted just before expiresOn can still move an Expired session to Completed or Failed.

Creates a Flute Checkout session

Request

POST {{baseURL}}/v2/payment-sessions/checkout

This endpoint creates a new Flute Checkout session.

Flute hosts the payment page. Redirect the customer to the returned checkoutUrl, which is fully formed for the environment being called. The response is the full session object, the same one GET /v2/payment-sessions/{{paymentSessionId}} returns. paymentSessionResult is null until the session is Completed.

A Flute Checkout session accepts every field a Flute Elements session does, plus returnUrl, pageName, and extraFields for the hosted page. None of the hosted-page fields are accepted for a SaveMethod session.

This endpoint is idempotent. See the idempotency-key header entry. For more information, see Idempotency.

This endpoint requires a merchant API token. A partner API token is rejected with a 403 response, even if the partner has the HostedWebComponents permission. This endpoint only runs for merchant-scoped tokens. A merchant API token managed by a partner also requires that partner's account to have the HostedWebComponents permission. Otherwise, the request returns a 403 response.

See Also:
To create a Flute Elements session, see POST /v2/payment-sessions/elements.
To retrieve a payment session by id, see GET /v2/payment-sessions/{{paymentSessionId}}.
To cancel a payment session, see POST /v2/payment-sessions/{{paymentSessionId}}/cancel.

Security
Bearer
Headers
idempotency-keystring, (UUID), <= 255 characters

Specifies the client-generated idempotency-key.

This key is optional. We recommend using the key to prevent multiple invocations of the operation. This key makes this request safely retryable, or idempotent. If the idempotency key is not included, the call will not have idempotency protection.

A retry with the same key, made within the retention window, returns the original response verbatim. The operation is not repeated. The retention window, also called the TTL (time to live) is 1440 minutes (24 hours) by default but this setting may be changed.

A retry with the same key while the original request is still processing returns 409 Conflict (IdempotencyKeyInProgress). Retry again after a short delay.

Reusing the same key with a different request body returns 422 Unprocessable Content (IdempotencyKeyConflict). Generate a new key for each distinct operation.

A 500 series server error is not stored under the key. A retry with the same key after a 500 series response processes the request again.

Example:6a1f7e2c-4b3d-4e5a-8f9c-1d2e3f4a5b6c
Bodyapplication/jsonrequired

baseAmountnumber or null, (double), decimal places <= 2

Specifies the base amount (in USD) to charge.

For Payment and PaymentAndSave sessions, this value must be greater than zero. For SaveMethod sessions, this value must be zero.

A value of null creates a flexible-amount session. The customer enters the amount.

Examples:
100.00
0
null

Example:100
paymentSessionModestring, (enum)

Specifies the intent of the session.

NameDescription
PaymentCharges the customer. Does not save a payment method. This is the default.
PaymentAndSaveCharges the customer and vaults the payment method used.
SaveMethodVaults a payment method with no charge. The baseAmount field must be 0. Payment fields such as paymentMethods, tipAmount, taxRate, taxAmount, taxMode, metadata and expiresOn are not accepted.

For SaveMethod and PaymentAndSave, the saved payment method is reported on paymentSessionResult.paymentMethod once the session is Completed. Its paymentMethodId is the only source of the saved method's id.

Example: Payment

Default:"Payment"
Enum:"Payment""PaymentAndSave""SaveMethod"
Example:"Payment"
paymentMethodsobject

Identifies the payment methods a payment link or payment session accepts. It is keyed by method so each one carries only the configuration that applies to it.

At least one payment method must be enabled, card or ACH. For a payment session, omit this object to offer every payment method available to the merchant. A SaveMethod session does not accept this object. Both may be specified.

taxRatenumber or null, (double)

Specifies the tax rate percentage to apply to the base amount.

Valid values range from 0 to 100, with up to three decimal places.

A taxMode value must be used with exactly one of taxRate or taxAmount, or none of the three. When all three are omitted, the payment session has no tax configured.

Example: 8.25 (for 8.25%)

Example:8.25
taxAmountnumber or null, (double), decimal places <= 2, >= 0

Specifies a fixed tax amount (in USD) to apply to the base amount.

This value has up to two decimal places and cannot be negative. This value requires a fixed baseAmount.

A taxMode value must be used with exactly one of taxRate or taxAmount, or none of the three. When all three are omitted, the payment session has no tax configured.

A response carries this value only when the tax was configured as an amount. Otherwise, it is null.

Examples:
3.75 (for $3.75)
null

Example:3.75
taxModestring

Specifies how taxRate and taxAmount is applied to amount.

NameDescription
ExclusiveAdds the tax on top of amount. The payer is charged amount plus the tax.
InclusiveTreats amount as already including the tax. No extra amount is added.

A taxMode value must be used with exactly one of taxRate or taxAmount, or none of the three. When all three are omitted, the payment session has no tax configured.

Example: Exclusive

Enum:"Exclusive""Inclusive"
Example:"Exclusive"
referenceIdstring or null, <= 100 characters

Specifies the merchant's own label for the payment session.

This value is stored and returned on every read. A value longer than an ACH (automated clearing house) processor accepts is shortened only when it is sent to that processor.

Example: order_123

Example:"order_123"
tipAmountnumber or null, (double), decimal places <= 2

Specifies a preset tip amount (in USD) added to baseAmount.

This value must be greater than zero. When baseAmount is fixed, this value cannot be greater than baseAmount. This value is not accepted for SaveMethod sessions.

Example: 10.00 (for $10.00)

Example:10
customerIdstring or null, (UUID)

Specifies an existing customer to attach to the payment session.

The customer's saved payment methods can then be offered. This value cannot be used when customerHandling is TokenOnly.

A list of customer identifiers can be retrieved with GET /v2/customers.

Example: 2d3f4a6b-1c2d-4e5f-8a9b-0c1d2e3f4a5b

Example:"2d3f4a6b-1c2d-4e5f-8a9b-0c1d2e3f4a5b"
customerHandlingstring or null

Specifies how a vaulted payment method is attached.

This value applies only to SaveMethod and PaymentAndSave sessions.

Valid values are:

ValueDescription
CreateCustomerAttaches the saved payment method to a customer record. This is the default.
TokenOnlyStores the saved payment method as a token with no customer record. This value cannot be used with customerId.

Example: CreateCustomer

Default:"CreateCustomer"
Enum:"CreateCustomer""TokenOnly"
Example:"CreateCustomer"
skipAddressVerificationboolean or null

Specifies whether to bypass AVS (address verification service) at the gateway.

This value applies only to Payment and PaymentAndSave sessions.

Valid values are:

ValueDescription
falseDoes not bypass AVS at the gateway.
trueBypasses AVS at the gateway.

Example: false

Default:false
Example:false
expiresOnstring or null, (ISO 8601 date-time)

Specifies when the payment session stops accepting payment (in an ISO 8601 date-time format).

This value must be a future date-time with a time zone (a Z suffix or a UTC offset). A zoneless value is rejected rather than guessed. A null or omitted value means the session never expires.

If this value is null or omitted, the session never expires. This value is not accepted for SaveMethod sessions.

Example: 2030-01-01T12:00:00.000Z

Example:"2030-01-01T12:00:00.000Z"
metadataobject or null

Specifies key-value pairs to store with the payment session.

These values are returned on every read. They are not used to process the payment.

The following limits apply:

  • At most 50 keys.
  • Keys of at most 100 characters.
  • Values of at most 500 characters.
  • At most 8 KB in total.

This value is not accepted for SaveMethod sessions.

Example: {"orderId": "ORD-9876", "source": "web"}

Example:
{ "orderId": "ORD-9876", "source": "web" }
returnUrlstring or null, <= 2000 characters

Specifies the HTTPS URL the hosted page sends the customer to after a successful payment.

This value must be an absolute HTTPS URL, at most 2000 characters. A {{paymentSessionId}} placeholder is replaced with the session id.

Example: https://myapp.com/payment/complete

Example:"https://myapp.com/payment/complete"
pageNamestring or null, <= 200 characters

Specifies the customer-facing name shown on the hosted page.

This value is the page subtitle and the browser tab title. If this value is omitted, the page shows only the merchant name.

Example: Order #1234

Example:"Order #1234"
extraFieldsArray of objects or null, <= 10 items

Specifies questions the customer answers on the hosted page before paying.

The questions are shown in the order given. At most 10 questions are allowed. This value is not accepted for SaveMethod sessions.

Charges $100.00, offering card only, with an 8.25% exclusive tax and a $10.00 tip.

// Language is not supported.

Responses

Payment session created

Bodyapplication/json
paymentSessionIdstring, (UUID)

Identifies the payment session.

Example: ebece8ac-a375-4bd1-bce7-dd352a00650c

Example:"ebece8ac-a375-4bd1-bce7-dd352a00650c"
paymentSessionTypestring

Indicates which surface the session was created for.

Valid values are:

ValueDescription
CheckoutFlute hosts the payment page. The session carries a checkoutUrl.
ElementsThe merchant's own UI, built with the Flute Elements SDK.

Example: Checkout

Enum:"Checkout""Elements"
Example:"Checkout"
paymentSessionStatusstring

Indicates the current status of the payment session.

Valid values are:

ValueDescription
CancelledThe session was canceled with POST /v2/payment-sessions/{{paymentSessionId}}/cancel.
CompletedThe payment or vault succeeded.
CreatedThe session is ready for use.
ExpiredexpiresOn passed while the session was still Created. A payment submitted just before expiresOn can still move an Expired session to Completed or Failed.
FailedA payment attempt on the session failed. Create a new session to retry.

Example: Created

Enum:"Cancelled""Completed""Created""Expired""Failed"
Example:"Created"
paymentSessionModestring, (enum)

Specifies the intent of the session.

NameDescription
PaymentCharges the customer. Does not save a payment method. This is the default.
PaymentAndSaveCharges the customer and vaults the payment method used.
SaveMethodVaults a payment method with no charge. The baseAmount field must be 0. Payment fields such as paymentMethods, tipAmount, taxRate, taxAmount, taxMode, metadata and expiresOn are not accepted.

For SaveMethod and PaymentAndSave, the saved payment method is reported on paymentSessionResult.paymentMethod once the session is Completed. Its paymentMethodId is the only source of the saved method's id.

Example: Payment

Default:"Payment"
Enum:"Payment""PaymentAndSave""SaveMethod"
Example:"Payment"
baseAmountnumber or null, (double)

Indicates the amount to charge.

This value is null for a flexible-amount session.

Example: 100.00

Example:100
currencyCodestring

Indicates the session's currency, in ISO 4217 uppercase format.

This value is pinned from the merchant's configuration at creation.

Example: USD

Example:"USD"
taxRatenumber or null, (double)

Specifies the tax rate percentage to apply to the base amount.

Valid values range from 0 to 100, with up to three decimal places.

A taxMode value must be used with exactly one of taxRate or taxAmount, or none of the three. When all three are omitted, the payment session has no tax configured.

Example: 8.25 (for 8.25%)

Example:8.25
taxAmountnumber or null, (double), decimal places <= 2, >= 0

Specifies a fixed tax amount (in USD) to apply to the base amount.

This value has up to two decimal places and cannot be negative. This value requires a fixed baseAmount.

A taxMode value must be used with exactly one of taxRate or taxAmount, or none of the three. When all three are omitted, the payment session has no tax configured.

A response carries this value only when the tax was configured as an amount. Otherwise, it is null.

Examples:
3.75 (for $3.75)
null

Example:3.75
taxModestring

Specifies how taxRate and taxAmount is applied to amount.

NameDescription
ExclusiveAdds the tax on top of amount. The payer is charged amount plus the tax.
InclusiveTreats amount as already including the tax. No extra amount is added.

A taxMode value must be used with exactly one of taxRate or taxAmount, or none of the three. When all three are omitted, the payment session has no tax configured.

Example: Exclusive

Enum:"Exclusive""Inclusive"
Example:"Exclusive"
tipAmountnumber or null, (double)

Indicates the pre-set tip added on top of baseAmount, as set at creation.

Example: 10.00

Example:10
referenceIdstring or null

Indicates the merchant's own label for the session, as set at creation.

Example: order_123

Example:"order_123"
customerIdstring or null, (UUID)

Identifies the customer to link this payment method to.

This value may be null when this payment method is an orphan owned by the merchant directly. An orphan payment method is a payment method in the merchant's vault but has no customer record associated with it.

A list of customer identifiers can be retrieved with GET /v2/customers.

Example: 8fa8e727-73c6-436e-b56f-6f55aabf3b1c

Example:"8fa8e727-73c6-436e-b56f-6f55aabf3b1c"
customerHandlingstring

Indicates how a vaulted payment method is attached, as set at creation.

Valid values are:

ValueDescription
CreateCustomerThe vaulted payment method is attached to a Customer record.
TokenOnlyThe vaulted payment method is stored as a bare token, with no Customer record created or referenced.

Example: CreateCustomer

Enum:"CreateCustomer""TokenOnly"
Example:"CreateCustomer"
skipAddressVerificationboolean

Indicates whether AVS (address verification service) is bypassed at the gateway for this session.

Valid values are:

ValueDescription
falseAVS is not bypassed at the gateway.
trueAVS is bypassed at the gateway.

Example: false

Example:false
paymentMethodsobject or null

Identifies the payment methods a payment session offers.

It is keyed by method so each one carries only the configuration that applies to it. Card and ACH are the methods configured on the session. Apple Pay® and Google Pay® are digital wallets that the session derives. A wallet key is omitted when the session does not offer that wallet.

paymentLinkIdstring or null, (UUID)

Indicates the payment link that generated this session, when applicable.

This value is null for a session created directly through POST /v2/payment-sessions/checkout or POST /v2/payment-sessions/elements.

Example: 6f2a8b3c-9d4e-4f1a-8b7c-3e5d6a9f0c1b

Example:"6f2a8b3c-9d4e-4f1a-8b7c-3e5d6a9f0c1b"
returnUrlstring or null

Indicates the hosted page's post-payment redirect URL, as set at creation.

This value is for Flute Checkout sessions only. It is null for Flute Elements.

Example: https://myapp.com/payment/complete

Example:"https://myapp.com/payment/complete"
pageNamestring or null

Indicates the customer-facing name shown on the hosted page, as set at creation.

This value is for Flute Checkout sessions only. It is null for Flute Elements.

Example: Order #1234

Example:"Order #1234"
checkoutUrlstring or null

Indicates the hosted page to send the customer to.

This value is for Flute Checkout sessions only. It is null for Flute Elements.

Example: https://pay.flute.com/checkout/ebece8ac-a375-4bd1-bce7-dd352a00650c

Example:"https://pay.flute.com/checkout/ebece8ac-a375-4bd1-bce7-dd352a00650c"
expiresOnstring or null, (ISO 8601 date-time)

Indicates when the session stops accepting payment, as set at creation.

If null or omitted, the session never expires.

Example: 2030-01-01T12:00:00.000Z

Example:"2030-01-01T12:00:00.000Z"
metadataobject or null

Indicates the free-form string-to-string pairs attached to the session, as set at creation.

Example: { "orderId": "ORD-9876", "source": "web" }

Example:
{ "orderId": "ORD-9876", "source": "web" }
extraFieldsArray of objects

Indicates the questions the customer answers on the hosted page, in the order shown.

A session opened from a payment link carries the link's fields as they were when it opened, with the same identifiers. This value is for Flute Checkout sessions only. It is empty for Flute Elements and when there are none.

createdOnstring, (ISO 8601 date-time)

Indicates when the session was created.

Example: 2026-09-30T00:00:00.000Z

Example:"2026-09-30T00:00:00.000Z"
modifiedOnstring, (ISO 8601 date-time)

Indicates when the session was last modified.

Example: 2026-09-30T00:00:00.000Z

Example:"2026-09-30T00:00:00.000Z"
paymentSessionResultobject or null

Indicates what a Completed session produced: the payment method it saved and the transaction it charged.

This value is null until paymentSessionStatus is Completed.

The paymentMethod field is present after a SaveMethod or PaymentAndSave session, with either customerHandling. It is null when the session saved nothing, or when the saved method could not be read at the time. Its paymentMethodId is the only source of the saved method's id: use it with POST /v2/transactions or when creating a subscription.

The linkedTransaction field is null for SaveMethod sessions, which charge nothing.

Response

A Flute Checkout session ready for the customer. Redirect them to checkoutUrl. paymentSessionResult stays null until the session is Completed.

{ "paymentSessionId": "ebece8ac-a375-4bd1-bce7-dd352a00650c", "paymentSessionType": "Checkout", "paymentSessionStatus": "Created", "paymentSessionMode": "Payment", "baseAmount": 100, "currencyCode": "USD", "taxRate": 8.25, "taxAmount": null, "taxMode": "Exclusive", "tipAmount": 10, "referenceId": "order_123", "customerId": "2d3f4a6b-1c2d-4e5f-8a9b-0c1d2e3f4a5b", "customerHandling": "CreateCustomer", "skipAddressVerification": false, "paymentMethods": { "card": { "enabled": true, "processorId": "36e0e61e-3614-4c68-a919-1bffc8bdb7b6" } }, "paymentLinkId": null, "returnUrl": "https://myapp.com/payment/complete", "pageName": "Order #1234", "checkoutUrl": "https://pay.flute.com/checkout/ebece8ac-a375-4bd1-bce7-dd352a00650c", "expiresOn": "2030-01-01T12:00:00.000Z", "metadata": { "orderId": "ORD-9876", "source": "web" }, "extraFields": [ { "extraFieldId": "8b3e4c74-ac73-4f40-9c70-3d4e5f607182", "name": "Order number", "description": null, "isRequired": true } ], "createdOn": "2026-09-30T00:00:00.000Z", "modifiedOn": "2026-09-30T00:00:00.000Z", "paymentSessionResult": null }