Create a test Confirmation Token Test helper
Creates a test mode Confirmation Token server side for your integration tests.
Parameters
- payment_
methodstring ID of an existing PaymentMethod.
- payment_
method_ dataobject If provided, this hash will be used to create a PaymentMethod.
- payment_method_data.
typeenumRequired The type of the PaymentMethod. An additional hash is included on the PaymentMethod with a name matching this value. It contains additional information specific to the PaymentMethod type.
- payment_method_data.
acss_ debitobject If this is an
acss_
PaymentMethod, this hash contains details about the ACSS Debit payment method.debit - payment_method_data.
acss_debit. account_ numberstringRequired Customer’s bank account number.
- payment_method_data.
acss_debit. institution_ numberstringRequired Institution number of the customer’s bank.
- payment_method_data.
acss_debit. transit_ numberstringRequired Transit number of the customer’s bank.
- payment_method_data.
affirmobject If this is an
affirm
PaymentMethod, this hash contains details about the Affirm payment method. - payment_method_data.
afterpay_ clearpayobject If this is an
AfterpayClearpay
PaymentMethod, this hash contains details about the AfterpayClearpay payment method. - payment_method_data.
alipayobject If this is an
Alipay
PaymentMethod, this hash contains details about the Alipay payment method. - payment_method_data.
allow_ redisplayenum This field indicates whether this payment method can be shown again to its customer in a checkout flow. Stripe products such as Checkout and Elements use this field to determine whether a payment method can be shown as a saved payment method in a checkout flow. The field defaults to
unspecified
.Possible enum valuesalways
Use
always
to indicate that this payment method can always be shown to a customer in a checkout flow.limited
Use
limited
to indicate that this payment method can’t always be shown to a customer in a checkout flow. For example, it can only be shown in the context of a specific subscription.unspecified
This is the default value for payment methods where
allow_
wasn’t set.redisplay - payment_method_data.
almaobject If this is a Alma PaymentMethod, this hash contains details about the Alma payment method.
- payment_method_data.
amazon_ payobject If this is a AmazonPay PaymentMethod, this hash contains details about the AmazonPay payment method.
- payment_method_data.
au_ becs_ debitobject If this is an
au_
PaymentMethod, this hash contains details about the bank account.becs_ debit - payment_method_data.
au_becs_debit. account_ numberstringRequired The account number for the bank account.
- payment_method_data.
au_becs_debit. bsb_ numberstringRequired Bank-State-Branch number of the bank account.
- payment_method_data.
bacs_ debitobject If this is a
bacs_
PaymentMethod, this hash contains details about the Bacs Direct Debit bank account.debit - payment_method_data.
bacs_debit. account_ numberstring Account number of the bank account that the funds will be debited from.
- payment_method_data.
bacs_debit. sort_ codestring Sort code of the bank account. (e.g.,
10-20-30
)
- payment_method_data.
bancontactobject If this is a
bancontact
PaymentMethod, this hash contains details about the Bancontact payment method. - payment_method_data.
billieobject If this is a
billie
PaymentMethod, this hash contains details about the Billie payment method. - payment_method_data.
billing_ detailsobject Billing information associated with the PaymentMethod that may be used or required by particular types of payment methods.
- payment_method_data.
billing_details. addressobject Billing address.
- payment_method_data.
billing_details. address. citystring City, district, suburb, town, or village.
- payment_method_data.
billing_details. address. countrystring Two-letter country code (ISO 3166-1 alpha-2).
- payment_method_data.
billing_details. address. line1string Address line 1 (e.g., street, PO Box, or company name).
- payment_method_data.
billing_details. address. line2string Address line 2 (e.g., apartment, suite, unit, or building).
- payment_method_data.
billing_details. address. postal_ codestring ZIP or postal code.
- payment_method_data.
billing_details. address. statestring State, county, province, or region.
- payment_method_data.
billing_details. emailstring Email address.
- payment_method_data.
billing_details. namestring Full name.
- payment_method_data.
billing_details. phonestring Billing phone number (including extension).
- payment_method_data.
billing_details. tax_ idstring Taxpayer identification number. Used only for transactions between LATAM buyers and non-LATAM sellers.
- payment_method_data.
blikobject If this is a
blik
PaymentMethod, this hash contains details about the BLIK payment method. - payment_method_data.
boletoobject If this is a
boleto
PaymentMethod, this hash contains details about the Boleto payment method.- payment_method_data.
boleto. tax_ idstringRequired The tax ID of the customer (CPF for individual consumers or CNPJ for businesses consumers)
- payment_method_data.
cashappobject If this is a
cashapp
PaymentMethod, this hash contains details about the Cash App Pay payment method. - payment_method_data.
cryptoobject If this is a Crypto PaymentMethod, this hash contains details about the Crypto payment method.
- payment_method_data.
customer_ balanceobject If this is a
customer_
PaymentMethod, this hash contains details about the CustomerBalance payment method.balance - payment_method_data.
epsobject If this is an
eps
PaymentMethod, this hash contains details about the EPS payment method.- payment_method_data.
eps. bankstring The customer’s bank.
- payment_method_data.
fpxobject If this is an
fpx
PaymentMethod, this hash contains details about the FPX payment method.- payment_method_data.
fpx. bankstringRequired The customer’s bank.
- payment_method_data.
giropayobject If this is a
giropay
PaymentMethod, this hash contains details about the Giropay payment method. - payment_method_data.
grabpayobject If this is a
grabpay
PaymentMethod, this hash contains details about the GrabPay payment method. - payment_method_data.
idealobject If this is an
ideal
PaymentMethod, this hash contains details about the iDEAL payment method.- payment_method_data.
ideal. bankstring The customer’s bank. Only use this parameter for existing customers. Don’t use it for new customers.
- payment_method_data.
interac_ presentobjectPreview feature If this is an
interac_
PaymentMethod, this hash contains details about the Interac Present payment method.present - payment_method_data.
kakao_ payobject If this is a
kakao_
PaymentMethod, this hash contains details about the Kakao Pay payment method.pay - payment_method_data.
klarnaobject If this is a
klarna
PaymentMethod, this hash contains details about the Klarna payment method.- payment_method_data.
klarna. dobobject Customer’s date of birth
- payment_method_data.
klarna. dob. dayintegerRequired The day of birth, between 1 and 31.
- payment_method_data.
klarna. dob. monthintegerRequired The month of birth, between 1 and 12.
- payment_method_data.
klarna. dob. yearintegerRequired The four-digit year of birth.
- payment_method_data.
konbiniobject If this is a
konbini
PaymentMethod, this hash contains details about the Konbini payment method. - payment_method_data.
kr_ cardobject If this is a
kr_
PaymentMethod, this hash contains details about the Korean Card payment method.card - payment_method_data.
linkobject If this is an
Link
PaymentMethod, this hash contains details about the Link payment method. - payment_method_data.
metadataobject Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to
metadata
. - payment_method_data.
mobilepayobject If this is a
mobilepay
PaymentMethod, this hash contains details about the MobilePay payment method. - payment_method_data.
multibancoobject If this is a
multibanco
PaymentMethod, this hash contains details about the Multibanco payment method. - payment_method_data.
object If this is a
naver_
PaymentMethod, this hash contains details about the Naver Pay payment method.pay - payment_method_data.
naver_pay. enum Whether to use Naver Pay points or a card to fund this transaction. If not provided, this defaults to
card
.Possible enum valuescard
Use a card to fund this transaction.
points
Use Naver Pay points to fund this transaction.
- payment_method_data.
nz_ bank_ accountobject If this is an nz_bank_account PaymentMethod, this hash contains details about the nz_bank_account payment method.
- payment_method_data.
nz_bank_account. account_ numberstringRequired The account number for the bank account.
- payment_method_data.
nz_bank_account. bank_ codestringRequired The numeric code for the bank account’s bank.
- payment_method_data.
nz_bank_account. branch_ codestringRequired The numeric code for the bank account’s bank branch.
- payment_method_data.
nz_bank_account. suffixstringRequired The suffix of the bank account number.
- payment_method_data.
nz_bank_account. account_ holder_ namestring The name on the bank account. Only required if the account holder name is different from the name of the authorized signatory collected in the PaymentMethod’s billing details.
- payment_method_data.
oxxoobject If this is an
oxxo
PaymentMethod, this hash contains details about the OXXO payment method. - payment_method_data.
p24object If this is a
p24
PaymentMethod, this hash contains details about the P24 payment method.- payment_method_data.
p24. bankenum The customer’s bank.
- payment_method_data.
pay_ by_ bankobject If this is a
pay_
PaymentMethod, this hash contains details about the PayByBank payment method.by_ bank - payment_method_data.
paycoobject If this is a
payco
PaymentMethod, this hash contains details about the PAYCO payment method. - payment_method_data.
paynowobject If this is a
paynow
PaymentMethod, this hash contains details about the PayNow payment method. - payment_method_data.
paypalobject If this is a
paypal
PaymentMethod, this hash contains details about the PayPal payment method. - payment_method_data.
pixobject If this is a
pix
PaymentMethod, this hash contains details about the Pix payment method. - payment_method_data.
promptpayobject If this is a
promptpay
PaymentMethod, this hash contains details about the PromptPay payment method. - payment_method_data.
radar_ optionsobject Options to configure Radar. See Radar Session for more information.
- payment_method_data.
radar_options. sessionstringsecret key only A Radar Session is a snapshot of the browser metadata and device details that help Radar make more accurate predictions on your payments.
- payment_method_data.
revolut_ payobject If this is a
revolut_
PaymentMethod, this hash contains details about the Revolut Pay payment method.pay - payment_method_data.
samsung_ payobject If this is a
samsung_
PaymentMethod, this hash contains details about the SamsungPay payment method.pay - payment_method_data.
satispayobject If this is a
satispay
PaymentMethod, this hash contains details about the Satispay payment method. - payment_method_data.
sepa_ debitobject If this is a
sepa_
PaymentMethod, this hash contains details about the SEPA debit bank account.debit - payment_method_data.
sepa_debit. ibanstringRequired IBAN of the bank account.
- payment_method_data.
sofortobject If this is a
sofort
PaymentMethod, this hash contains details about the SOFORT payment method.- payment_method_data.
sofort. countryenumRequired Two-letter ISO code representing the country the bank account is located in.
Possible enum valuesAT
Austria
BE
Belgium
DE
Germany
ES
Spain
IT
Italy
NL
Netherlands
- payment_method_data.
swishobject If this is a
swish
PaymentMethod, this hash contains details about the Swish payment method. - payment_method_data.
twintobject If this is a TWINT PaymentMethod, this hash contains details about the TWINT payment method.
- payment_method_data.
us_ bank_ accountobject If this is an
us_
PaymentMethod, this hash contains details about the US bank account payment method.bank_ account - payment_method_data.
us_bank_account. account_ holder_ typeenum Account holder type: individual or company.
Possible enum valuescompany
Account belongs to a company
individual
Account belongs to an individual
- payment_method_data.
us_bank_account. account_ numberstring Account number of the bank account.
- payment_method_data.
us_bank_account. account_ typeenum Account type: checkings or savings. Defaults to checking if omitted.
Possible enum valueschecking
Bank account type is checking
savings
Bank account type is savings
- payment_method_data.
us_bank_account. financial_ connections_ accountstring The ID of a Financial Connections Account to use as a payment method.
- payment_method_data.
us_bank_account. routing_ numberstring Routing number of the bank account.
- payment_method_data.
wechat_ payobject If this is an
wechat_
PaymentMethod, this hash contains details about the wechat_pay payment method.pay - payment_method_data.
zipobject If this is a
zip
PaymentMethod, this hash contains details about the Zip payment method.
- payment_
method_ optionsobject Payment-method-specific configuration for this ConfirmationToken.
- payment_method_options.
cardobject Configuration for any card payments confirmed using this ConfirmationToken.
- payment_method_options.
card. installmentsobject Installment configuration for payments confirmed using this ConfirmationToken.
- payment_method_options.
card. installments. planobjectRequired The selected installment plan to use for this payment attempt. This parameter can only be provided during confirmation.
- payment_method_options.
card. installments. plan. typeenumRequired Type of installment plan, one of
fixed_
,count bonus
, orrevolving
.Possible enum valuesbonus
An installment plan used in Japan, where the customer defers payment to a later date that aligns with their salary bonus.
fixed_
count An installment plan where the number of installment payments is fixed and known at the time of purchase.
revolving
An installment plan used in Japan, where the customer pays a certain amount each month, and the remaining balance rolls over to the next month.
- payment_method_options.
card. installments. plan. countinteger For
fixed_
installment plans, this is required. It represents the number of installment payments your customer will make to their credit card.count - payment_method_options.
card. installments. plan. intervalenum For
fixed_
installment plans, this is required. It represents the interval between installment payments your customer will make to their credit card. One ofcount month
.Possible enum valuesmonth
- return_
urlstring Return URL used to confirm the Intent.
- setup_
future_ usageenum Indicates that you intend to make future payments with this ConfirmationToken’s payment method.
The presence of this property will attach the payment method to the PaymentIntent’s Customer, if present, after the PaymentIntent is confirmed and any required actions from the user are complete.
Possible enum valuesoff_
session Use
off_
if your customer may or may not be present in your checkout flow.session on_
session Use
on_
if you intend to only reuse the payment method when your customer is present in your checkout flow.session - shippingobject
Shipping information for this ConfirmationToken.
- shipping.
addressobjectRequired Shipping address
- shipping.
address. citystring City, district, suburb, town, or village.
- shipping.
address. countrystringRequired for calculating taxes Two-letter country code (ISO 3166-1 alpha-2).
- shipping.
address. line1string Address line 1 (e.g., street, PO Box, or company name).
- shipping.
address. line2string Address line 2 (e.g., apartment, suite, unit, or building).
- shipping.
address. postal_ codestringRequired for calculating taxes ZIP or postal code.
- shipping.
address. statestring State, county, province, or region.
- shipping.
namestringRequired Recipient name.
- shipping.
phonestring Recipient phone (including extension)
Returns
Returns a testmode Confirmation Token
{ "id": "ctoken_1Ow71CL4FhS6zgoxWjxc7sfr", "object": "confirmation_token", "created": 1710871450, "expires_at": 1710914650, "livemode": false, "payment_intent": null, "payment_method_preview": { "billing_details": { "address": { "city": null, "country": null, "line1": null, "line2": null, "postal_code": null, "state": null }, "email": null, "name": null, "phone": null }, "card": { "brand": "visa", "checks": { "address_line1_check": null, "address_postal_code_check": null, "cvc_check": "unchecked" }, "country": "US", "display_brand": "visa", "exp_month": 3, "exp_year": 2025, "fingerprint": "jbGyCKrSRsFpOBWP", "funding": "credit", "generated_from": null, "last4": "4242", "networks": { "available": [ "visa" ], "preferred": null }, "three_d_secure_usage": { "supported": true }, "wallet": null }, "type": "card" }, "return_url": null, "setup_future_usage": null, "setup_intent": null, "shipping": null, "use_stripe_sdk": true}