# Accept a payment using the Payment Setup API The Payment Setup API enables you to simplify the management of complex payment flows that cover multiple payment methods. A payment setup dynamically updates the payment session based on the customer's interactions and the information they provide during checkout. This can help to: - Maximize conversion and reduce friction for the customer by ensuring you only present payment methods that they can use. - Provide enhanced visibility and control over the customer's checkout journey by dynamically updating the payment setup status. - Reduce the number of payment failures. For example, due to missing information that the selected payment method requires or a currency does not support. The Payment Setup API supports the following payment methods: - [Card payments](https://www.checkout.com/docs/payments/add-payment-methods/card-payments/payment-setup-api.md) - [Apple Pay](https://www.checkout.com/docs/payments/add-payment-methods/apple-pay/payment-setup-api.md) - [Google Pay](https://www.checkout.com/docs/payments/add-payment-methods/google-pay/payment-setup-api.md) - [Alipay CN](https://www.checkout.com/docs/payments/add-payment-methods/alipaycn/payment-setup-api.md) - [AlipayHK](https://www.checkout.com/docs/payments/add-payment-methods/alipayhk/payment-setup-api.md) - [Alma](https://www.checkout.com/docs/payments/add-payment-methods/alma/payment-setup-api.md) - [Bacs Direct Debit](https://www.checkout.com/docs/payments/add-payment-methods/bacs/payment-setup-api.md) - [Benefit Payment Gateway](https://www.checkout.com/docs/payments/add-payment-methods/benefit-payment-gateway/payment-setup-api.md) - [Bizum](https://www.checkout.com/docs/payments/add-payment-methods/bizum/payment-setup-api.md) - [BLIK](https://www.checkout.com/docs/payments/add-payment-methods/blik/payment-setup-api.md) - [Dana](https://www.checkout.com/docs/payments/add-payment-methods/dana/payment-setup-api.md) - [EPS](https://www.checkout.com/docs/payments/add-payment-methods/electronic-payment-standard-eps/payment-setup-api.md) - [GCash](https://www.checkout.com/docs/payments/add-payment-methods/gcash/payment-setup-api.md) - [iDEAL](https://www.checkout.com/docs/payments/add-payment-methods/ideal/payment-setup-api.md) - [KakaoPay](https://www.checkout.com/docs/payments/add-payment-methods/kakaopay/payment-setup-api.md) - [Klarna](https://www.checkout.com/docs/payments/add-payment-methods/klarna-payments/payment-setup-api.md) - [KNET](https://www.checkout.com/docs/payments/add-payment-methods/knet/payment-setup-api.md) - [MobilePay](https://www.checkout.com/docs/payments/add-payment-methods/mobilepay/payment-setup-api.md) - [Multibanco](https://www.checkout.com/docs/payments/add-payment-methods/multibanco/payment-setup-api.md) - [Octopus](https://www.checkout.com/docs/payments/add-payment-methods/octopus/payment-setup-api.md) - [PayNow](https://www.checkout.com/docs/payments/add-payment-methods/paynow/payment-setup-api.md) - [PayPal](https://www.checkout.com/docs/payments/add-payment-methods/paypal/payment-setup-api.md) - [Przelewy24](https://www.checkout.com/docs/payments/add-payment-methods/przelewy24/payment-setup-api.md) - [QPay](https://www.checkout.com/docs/payments/add-payment-methods/qpay/payment-setup-api.md) - [SEPA Direct Debit](https://www.checkout.com/docs/payments/add-payment-methods/sepa-direct-debit/payment-setup-api.md) - [seQura](https://www.checkout.com/docs/payments/add-payment-methods/sequra/payment-setup-api.md) - [stc pay](https://www.checkout.com/docs/payments/add-payment-methods/stc-pay/payment-setup-api.md) - [Stored payment instrument](https://www.checkout.com/docs/payments/add-payment-methods/stored-payment-instrument/payment-setup-api.md) - [Swish](https://www.checkout.com/docs/payments/add-payment-methods/swish/payment-setup-api.md) - [Tabby](https://www.checkout.com/docs/payments/add-payment-methods/tabby/payment-setup-api.md) - [Touch 'n Go](https://www.checkout.com/docs/payments/add-payment-methods/touch-'n-go/payment-setup-api.md) - [TrueMoney](https://www.checkout.com/docs/payments/add-payment-methods/truemoney/payment-setup-api.md) - [TWINT](https://www.checkout.com/docs/payments/add-payment-methods/twint/payment-setup-api.md) - [Venmo](https://www.checkout.com/docs/payments/add-payment-methods/venmo/payment-setup-api.md) - [Vipps](https://www.checkout.com/docs/payments/add-payment-methods/vipps/payment-setup-api.md) - [WeChat Pay](https://www.checkout.com/docs/payments/add-payment-methods/wechat-pay/payment-setup-api.md) --- ## How it works The Payment Setup API simplifies your payment methods integration by consolidating the following key functionalities. It enables you to: - Simultaneously initiate all payment methods enabled on your account that the customer can use. - Bundle initialization processes for payment methods that require multi-step initialization. - Perform real-time validation of which payment methods are available and are most likely to result in a successful payment. - Dynamically update the payment state based on customer input. For example, if the customer has not provided a field required by their selected payment method, you can prompt them for input to prevent a payment failure. --- ## Create a payment setup Create a payment setup to receive the list of available payment methods. We recommended creating a payment setup as soon as you know the transaction amount. For example, when the customer begins the checkout process. If the amount changes, you can update it later. When creating the payment setup, provide any known customer and order information. For example, amount, currency, and country. The response returns the list of payment methods that are available for the customer. Call the [Create a payment setup](https://api-reference.checkout.com/tag/Payment-Setups/#operation/createAPaymentSetup) endpoint. In the request body, provide the following: - `processing_channel_id` – The [processing channel's](https://www.checkout.com/docs/business-operations/use-the-dashboard/manage-processing-channels.md) unique identifier - `amount` – The payment amount - `currency` – The payment currency > **Information** > > Your base URL's `{prefix}` value is unique to your account and environment. To learn how to retrieve your base URLs for the sandbox and production environments, see [API endpoints](https://www.checkout.com/docs/developer-resources/api/api-endpoints.md). **Production** `POST` `https://{prefix}.api.checkout.com/payments/setups` **Sandbox** `POST` `https://{prefix}.api.sandbox.checkout.com/payments/setups` ### Request example ```json { "processing_channel_id": "pc_wzjki6hw5puepb5fnvqlizj2e4", "amount": 10000, "currency": "EUR", "customer": { "billing_address": { "country": "NL", "address_line1": "Nieuwstraat 123", "city": "Amsterdam", "zip": "1234 AB" } }, "settings": { "success_url": "https://example.com/success", "failure_url": "https://example.com/failure" } } ``` ### Response example ```json { "id": "set_890xyz", "currency": "GBP", "amount": 2000, "payment_methods": { "klarna": { "initialization": "disabled", "status": "initialization_required", "flags": ["initialization_not_enabled"] }, "stcpay": { "initialization": "disabled", "status": "initialization_required", "flags": ["initialization_not_enabled"] }, "bizum": { "status": "ready", "flags": [] } }, "available_payment_methods": ["bizum", "tabby","stcpay"] } ``` The response returns a `payment_methods` object, which contains the payment methods enabled on your account. For each payment method, `payment_methods` contains the following fields: - `flags` – An array of error codes or indicators that highlight missing or invalid information which you can prompt the customer to provide - `status` – The [status of the payment method](#Payment_method_status) --- ## Update the payment setup Update the payment setup whenever there are significant changes in the data relevant to the customer's transaction. For example, when the customer: - Provides additional information – For example, their email, phone number, or shipping address - Provides information or completes an action required by a payment method – For example, if they successfully authenticate using an OTP - Makes a change that impacts the total payment amount – For example, they change the basket contents, select a faster delivery method, or apply a discount code Call the [Update a payment setup](https://api-reference.checkout.com/tag/Payment-Setups/#operation/updateAPaymentSetup) endpoint, and provide the updated customer or payment data in the respective fields. For example, the `amount` or `customer.email` fields. See each [payment method's documentation](https://www.checkout.com/docs/payments/add-payment-methods.md) for the specific fields they require. --- ## Initialize the payment methods Some payment methods require initialization before they can be used to confirm a payment. Initialize a payment method in the payment setup to begin collecting data, or if the customer selects the payment method as the payment option during checkout. For each initialized payment method, the payment setup dynamically: - Triggers required actions – For example, generating a redirect URL, preparing an SDK session, or requesting one-time password (OTP) verification from the customer - Updates the [payment method's status](#Payment_method_status) Call the [Update a payment setup](https://api-reference.checkout.com/tag/Payment-Setups/#operation/updateAPaymentSetup) endpoint, and set `initialization` to `enabled` for each payment method you want to initialize. --- ## Confirm the payment To process the payment request with the customer's selected payment method option, you must first confirm the payment setup. Call the [Confirm a payment setup](https://api-reference.checkout.com/tag/Payment-Setups/#operation/confirmAPaymentSetup) endpoint, and provide the payment method name as the `{payment_method_name}` path parameter. > **Note** > > Only confirm payment methods that have `ready` status. --- ## Payment method status The payment method option status indicates whether a specific payment option provided by a payment method is available for the customer to use in the current transaction. | Payment method status | Description | | --- | --- | | `action_required` | The payment method option requires additional information or customer action before it's available to use. For example, the customer may need to provide a shipping address, or authenticate using an OTP.

You may receive details of the additional requirements in the response's `action` object. | | `initialization_required` | The payment method requires initialization, but initialization is disabled. To proceed, update the payment setup and set `initialization` to `enabled`. | | `invalid` | The payment method cannot be used due to a validation error. For example, a required field is missing or incorrectly formatted, a card or wallet token has expired, or the customer's country does not match the allowed countries for the payment method. | | `ready` | The payment method option can be used to confirm the payment.

All required information was provided and additional actions completed. | | `unavailable` | The payment method is not available for the current transaction. For example, there's an issue with the configuration for that payment method, or an internal error is preventing the payment method from being offered as an option to the customer. |