Skip to content

Stripe: Create a Payment Method

Stripe paymentMethods.postPaymentMethods: arguments, response, policy and SDK examples.

← Payment methods operations · Get started

Operation stripe.postpaymentmethods

Provider route: POST /v1/payment_methods. Alter supplies the connection’s credentials and routing.

Install @alter-ai/sdk @alter-ai/stripe with npm, or alter-sdk-stripe with pip. Supply your connected customer’s grant ID and the arguments described below.

import { App } from "@alter-ai/sdk";
import { StripeIntegration } from "@alter-ai/stripe";
async function execute(input: Parameters<StripeIntegration["paymentMethods"]["postPaymentMethods"]>[0]) {
const app = new App({ apiKey: process.env.ALTER_API_KEY! });
try {
const provider = new StripeIntegration(app, { grantId: process.env.PROVIDER_GRANT_ID! });
const call = await provider.paymentMethods.postPaymentMethods(input);
const result = await call.wait();
return result.bodyJson();
} finally {
await app.close();
}
}
import os
from alter_sdk import App
from alter_sdk_stripe import StripeIntegration
async def execute(arguments):
async with App(api_key=os.environ["ALTER_API_KEY"]) as app:
provider = StripeIntegration(app, {"grant_id": os.environ["PROVIDER_GRANT_ID"]})
call = await provider.payment_methods.post_payment_methods(arguments)
result = await call.wait()
return result.body_json()
FieldTypePresenceDescription and constraints
$objectRootAdditional keys: not allowed
headersobjectOptionalAdditional keys: not allowed
headers.Idempotency-KeystringOptionalMinimum length: 1
Maximum length: 255
bodyobjectOptionalAdditional keys: not allowed
body.acss_debitobjectOptionalIf this is an `acss_debit` PaymentMethod, this hash contains details about the ACSS Debit payment method.
body.acss_debit.account_numberstringRequired within parentMaximum length: 5000
body.acss_debit.institution_numberstringRequired within parentMaximum length: 5000
body.acss_debit.transit_numberstringRequired within parentMaximum length: 5000
body.affirmobjectOptionalIf this is an `affirm` PaymentMethod, this hash contains details about the Affirm payment method.
body.afterpay_clearpayobjectOptionalIf this is an `AfterpayClearpay` PaymentMethod, this hash contains details about the AfterpayClearpay payment method.
body.alipayobjectOptionalIf this is an `Alipay` PaymentMethod, this hash contains details about the Alipay payment method.
body.allow_redisplaystringOptionalThis 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`.
One of: always, limited, unspecified
body.almaobjectOptionalIf this is an Alma PaymentMethod, this hash contains details about the Alma payment method.
body.amazon_payobjectOptionalIf this is an AmazonPay PaymentMethod, this hash contains details about the AmazonPay payment method.
body.au_becs_debitobjectOptionalIf this is an `au_becs_debit` PaymentMethod, this hash contains details about the bank account.
body.au_becs_debit.account_numberstringRequired within parentMaximum length: 5000
body.au_becs_debit.bsb_numberstringRequired within parentMaximum length: 5000
body.bacs_debitobjectOptionalIf this is a `bacs_debit` PaymentMethod, this hash contains details about the Bacs Direct Debit bank account.
body.bacs_debit.account_numberstringOptionalMaximum length: 5000
body.bacs_debit.sort_codestringOptionalMaximum length: 5000
body.bancontactobjectOptionalIf this is a `bancontact` PaymentMethod, this hash contains details about the Bancontact payment method.
body.billieobjectOptionalIf this is a `billie` PaymentMethod, this hash contains details about the Billie payment method.
body.billing_detailsModelOptionalExpand Create a Payment Method — request body — body billing details
body.bizumobjectOptionalIf this is a `bizum` PaymentMethod, this hash contains details about the Bizum payment method.
body.blikobjectOptionalIf this is a `blik` PaymentMethod, this hash contains details about the BLIK payment method.
body.boletoobjectOptionalIf this is a `boleto` PaymentMethod, this hash contains details about the Boleto payment method.
body.boleto.tax_idstringRequired within parentMaximum length: 5000
body.cardJSONOptionalIf this is a `card` PaymentMethod, this hash contains the user’s card details. For backwards compatibility, you can alternatively provide a Stripe token (e.g., for Apple Pay, Amex Express Checkout, or legacy Checkout) into the card hash with format `card: {token: “tok_visa”}`. When providing a card number, you must meet the requirements for [PCI compliance](https://stripe.com/docs/security#validating-pci-compliance). We strongly recommend using Stripe.js instead of interacting with this API directly.
body.card (anyOf 1)objectAlternative
body.card (anyOf 1).cvcstringOptionalMaximum length: 5000
body.card (anyOf 1).exp_monthintegerRequired within parent
body.card (anyOf 1).exp_yearintegerRequired within parent
body.card (anyOf 1).networksobjectOptional
body.card (anyOf 1).networks.preferredstringOptionalOne of: cartes_bancaires, mastercard, visa
body.card (anyOf 1).numberstringRequired within parentMaximum length: 5000
body.card (anyOf 2)objectAlternative
body.card (anyOf 2).tokenstringRequired within parentMaximum length: 5000
body.cashappobjectOptionalIf this is a `cashapp` PaymentMethod, this hash contains details about the Cash App Pay payment method.
body.cryptoobjectOptionalIf this is a Crypto PaymentMethod, this hash contains details about the Crypto payment method.
body.customobjectOptionalIf this is a `custom` PaymentMethod, this hash contains details about the Custom payment method.
body.custom.typestringRequired within parentMaximum length: 5000
body.customerstringOptionalThe `Customer` to whom the original PaymentMethod is attached.
Maximum length: 5000
body.customer_balanceobjectOptionalIf this is a `customer_balance` PaymentMethod, this hash contains details about the CustomerBalance payment method.
body.epsobjectOptionalIf this is an `eps` PaymentMethod, this hash contains details about the EPS payment method.
body.eps.bankstringOptionalOne of: arzte_und_apotheker_bank, austrian_anadi_bank_ag, bank_austria, bankhaus_carl_spangler, bankhaus_schelhammer_und_schattera_ag, bawag_psk_ag, bks_bank_ag, brull_kallmus_bank_ag, btv_vier_lander_bank, capital_bank_grawe_gruppe_ag, deutsche_bank_ag, dolomitenbank, easybank_ag, erste_bank_und_sparkassen, hypo_alpeadriabank_international_ag, hypo_bank_burgenland_aktiengesellschaft, hypo_noe_lb_fur_niederosterreich_u_wien, hypo_oberosterreich_salzburg_steiermark, hypo_tirol_bank_ag, hypo_vorarlberg_bank_ag, marchfelder_bank, oberbank_ag, raiffeisen_bankengruppe_osterreich, schoellerbank_ag, sparda_bank_wien, volksbank_gruppe, volkskreditbank_ag, vr_bank_braunau
Maximum length: 5000
body.expandarrayOptionalSpecifies which fields in the response should be expanded.
body.expand[]stringEach itemMaximum length: 5000
body.fpxobjectOptionalIf this is an `fpx` PaymentMethod, this hash contains details about the FPX payment method.
body.fpx.bankstringRequired within parentOne of: affin_bank, agrobank, alliance_bank, ambank, bank_islam, bank_muamalat, bank_of_china, bank_rakyat, bnp_paribas, bsn, cimb, citibank, deutsche_bank, hong_leong_bank, hsbc, kfh, maybank2e, maybank2u, mbsb_bank, ocbc, pb_enterprise, public_bank, rhb, standard_chartered, uob
Maximum length: 5000
body.giropayobjectOptionalIf this is a `giropay` PaymentMethod, this hash contains details about the Giropay payment method.
body.grabpayobjectOptionalIf this is a `grabpay` PaymentMethod, this hash contains details about the GrabPay payment method.
body.idealobjectOptionalIf this is an `ideal` PaymentMethod, this hash contains details about the iDEAL payment method.
body.ideal.bankstringOptionalOne of: abn_amro, adyen, asn_bank, bunq, buut, finom, handelsbanken, ing, knab, mollie, moneyou, n26, nn, rabobank, regiobank, revolut, sns_bank, triodos_bank, van_lanschot, yoursafe
Maximum length: 5000
body.interac_presentobjectOptionalIf this is an `interac_present` PaymentMethod, this hash contains details about the Interac Present payment method.
body.kakao_payobjectOptionalIf this is a `kakao_pay` PaymentMethod, this hash contains details about the Kakao Pay payment method.
body.klarnaobjectOptionalIf this is a `klarna` PaymentMethod, this hash contains details about the Klarna payment method.
body.klarna.dobobjectOptional
body.klarna.dob.dayintegerRequired within parent
body.klarna.dob.monthintegerRequired within parent
body.klarna.dob.yearintegerRequired within parent
body.konbiniobjectOptionalIf this is a `konbini` PaymentMethod, this hash contains details about the Konbini payment method.
body.kr_cardobjectOptionalIf this is a `kr_card` PaymentMethod, this hash contains details about the Korean Card payment method.
body.linkobjectOptionalIf this is an `Link` PaymentMethod, this hash contains details about the Link payment method (Link is also known as Onelink in the UK).
body.mb_wayobjectOptionalIf this is a MB WAY PaymentMethod, this hash contains details about the MB WAY payment method.
body.metadataobjectOptionalSet of [key-value pairs](https://docs.stripe.com/api/metadata) 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`.
Additional keys: see wildcard field
body.metadata.*stringAdditional keys
body.mobilepayobjectOptionalIf this is a `mobilepay` PaymentMethod, this hash contains details about the MobilePay payment method.
body.multibancoobjectOptionalIf this is a `multibanco` PaymentMethod, this hash contains details about the Multibanco payment method.
body.naver_payobjectOptionalIf this is a `naver_pay` PaymentMethod, this hash contains details about the Naver Pay payment method.
body.naver_pay.fundingstringOptionalOne of: card, points
body.nz_bank_accountobjectOptionalIf this is an nz_bank_account PaymentMethod, this hash contains details about the nz_bank_account payment method.
body.nz_bank_account.account_holder_namestringOptionalMaximum length: 5000
body.nz_bank_account.account_numberstringRequired within parentMaximum length: 5000
body.nz_bank_account.bank_codestringRequired within parentMaximum length: 5000
body.nz_bank_account.branch_codestringRequired within parentMaximum length: 5000
body.nz_bank_account.referencestringOptionalMaximum length: 128
body.nz_bank_account.suffixstringRequired within parentMaximum length: 5000
body.oxxoobjectOptionalIf this is an `oxxo` PaymentMethod, this hash contains details about the OXXO payment method.
body.p24objectOptionalIf this is a `p24` PaymentMethod, this hash contains details about the P24 payment method.
body.p24.bankstringOptionalOne of: alior_bank, bank_millennium, bank_nowy_bfg_sa, bank_pekao_sa, banki_spbdzielcze, blik, bnp_paribas, boz, citi_handlowy, credit_agricole, envelobank, etransfer_pocztowy24, getin_bank, ideabank, ing, inteligo, mbank_mtransfer, nest_przelew, noble_pay, pbac_z_ipko, plus_bank, santander_przelew24, tmobile_usbugi_bankowe, toyota_bank, velobank, volkswagen_bank
body.pay_by_bankobjectOptionalIf this is a `pay_by_bank` PaymentMethod, this hash contains details about the PayByBank payment method.
body.paycoobjectOptionalIf this is a `payco` PaymentMethod, this hash contains details about the PAYCO payment method.
body.payment_methodstringOptionalThe PaymentMethod to share.
Maximum length: 5000
body.paynowobjectOptionalIf this is a `paynow` PaymentMethod, this hash contains details about the PayNow payment method.
body.paypalobjectOptionalIf this is a `paypal` PaymentMethod, this hash contains details about the PayPal payment method.
body.paypayobjectOptionalIf this is a `paypay` PaymentMethod, this hash contains details about the PayPay payment method.
body.paytoobjectOptionalIf this is a `payto` PaymentMethod, this hash contains details about the PayTo payment method.
body.payto.account_numberstringOptionalMaximum length: 5000
body.payto.bsb_numberstringOptionalMaximum length: 5000
body.payto.pay_idstringOptionalMaximum length: 5000
body.pixobjectOptionalIf this is a `pix` PaymentMethod, this hash contains details about the Pix payment method.
body.promptpayobjectOptionalIf this is a `promptpay` PaymentMethod, this hash contains details about the PromptPay payment method.
body.radar_optionsobjectOptionalOptions to configure Radar. See [Radar Session](https://docs.stripe.com/radar/radar-session) for more information.
body.radar_options.sessionstringOptionalMaximum length: 5000
body.revolut_payobjectOptionalIf this is a `revolut_pay` PaymentMethod, this hash contains details about the Revolut Pay payment method.
body.samsung_payobjectOptionalIf this is a `samsung_pay` PaymentMethod, this hash contains details about the SamsungPay payment method.
body.satispayobjectOptionalIf this is a `satispay` PaymentMethod, this hash contains details about the Satispay payment method.
body.scalapayobjectOptionalIf this is a Scalapay PaymentMethod, this hash contains details about the Scalapay payment method.
body.sepa_debitobjectOptionalIf this is a `sepa_debit` PaymentMethod, this hash contains details about the SEPA debit bank account.
body.sepa_debit.ibanstringRequired within parentMaximum length: 5000
body.sequraobjectOptionalIf this is a SeQura PaymentMethod, this hash contains details about the SeQura payment method.
body.sofortobjectOptionalIf this is a `sofort` PaymentMethod, this hash contains details about the SOFORT payment method.
body.sofort.countrystringRequired within parentOne of: AT, BE, DE, ES, IT, NL
body.sunbitobjectOptionalIf this is a `sunbit` PaymentMethod, this hash contains details about the Sunbit payment method.
body.swishobjectOptionalIf this is a `swish` PaymentMethod, this hash contains details about the Swish payment method.
body.twintobjectOptionalIf this is a TWINT PaymentMethod, this hash contains details about the TWINT payment method.
body.typestringOptionalThe 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.
One of: acss_debit, affirm, afterpay_clearpay, alipay, alma, amazon_pay, au_becs_debit, bacs_debit, bancontact, billie, bizum, blik, boleto, card, cashapp, crypto, custom, customer_balance, eps, fpx, giropay, grabpay, ideal, kakao_pay, klarna, konbini, kr_card, link, mb_way, mobilepay, multibanco, naver_pay, nz_bank_account, oxxo, p24, pay_by_bank, payco, paynow, paypal, paypay, payto, pix, promptpay, revolut_pay, samsung_pay, satispay, scalapay, sepa_debit, sequra, sofort, sunbit, swish, twint, upi, us_bank_account, wechat_pay, zip
body.upiobjectOptionalIf this is a `upi` PaymentMethod, this hash contains details about the UPI payment method.
body.upi.mandate_optionsobjectOptional
body.upi.mandate_options.amountintegerOptional
body.upi.mandate_options.amount_typestringOptionalOne of: fixed, maximum
body.upi.mandate_options.descriptionstringOptionalMaximum length: 20
body.upi.mandate_options.end_dateintegerOptionalFormat: unix-time
body.us_bank_accountobjectOptionalIf this is an `us_bank_account` PaymentMethod, this hash contains details about the US bank account payment method.
body.us_bank_account.account_holder_typestringOptionalOne of: company, individual
body.us_bank_account.account_numberstringOptionalMaximum length: 5000
body.us_bank_account.account_typestringOptionalOne of: checking, savings
body.us_bank_account.financial_connections_accountstringOptionalMaximum length: 5000
body.us_bank_account.routing_numberstringOptionalMaximum length: 5000
body.wechat_payobjectOptionalIf this is an `wechat_pay` PaymentMethod, this hash contains details about the wechat_pay payment method.
body.zipobjectOptionalIf this is a `zip` PaymentMethod, this hash contains details about the Zip payment method.

Referenced models: Create a Payment Method — request body — body billing details

Response media type: application/json. The table describes the pinned successful response. Referenced models link to their complete fields.

FieldTypePresenceDescription and constraints
$ModelRootExpand Create a Payment Method — response body

Referenced models: Create a Payment Method — response body

698 more schemas are linked from the tables above, on the schema pages.

Create a Payment Method — request body — body billing details
FieldTypePresenceDescription and constraints
$objectRootBilling information associated with the PaymentMethod that may be used or required by particular types of payment methods.
addressJSONOptional
address (anyOf 1)objectAlternative
address (anyOf 1).citystringOptionalMaximum length: 5000
address (anyOf 1).countrystringOptionalMaximum length: 5000
address (anyOf 1).line1stringOptionalMaximum length: 5000
address (anyOf 1).line2stringOptionalMaximum length: 5000
address (anyOf 1).postal_codestringOptionalMaximum length: 5000
address (anyOf 1).statestringOptionalMaximum length: 5000
address (anyOf 2)stringAlternativeOne of:
emailJSONOptional
email (anyOf 1)stringAlternative
email (anyOf 2)stringAlternativeOne of:
nameJSONOptional
name (anyOf 1)stringAlternativeMaximum length: 5000
name (anyOf 2)stringAlternativeOne of:
phoneJSONOptional
phone (anyOf 1)stringAlternativeMaximum length: 5000
phone (anyOf 2)stringAlternativeOne of:
tax_idstringOptionalMaximum length: 5000
Create a Payment Method — response body — zip
FieldTypePresenceDescription and constraints
$objectRoot
Create a charge — response body — billing details
FieldTypePresenceDescription and constraints
$objectRoot
addressJSONOptional
address (anyOf 1)JSONAlternativeBilling address.
address (anyOf 1) (anyOf 1)ModelAlternativeExpand Create a Location — response body — address
address (anyOf 2)nullAlternative
emailJSONOptional
email (anyOf 1)stringAlternativeEmail address.
Maximum length: 5000
email (anyOf 2)nullAlternative
nameJSONOptional
name (anyOf 1)stringAlternativeFull name.
Maximum length: 5000
name (anyOf 2)nullAlternative
phoneJSONOptional
phone (anyOf 1)stringAlternativeBilling phone number (including extension).
Maximum length: 5000
phone (anyOf 2)nullAlternative
tax_idJSONOptional
tax_id (anyOf 1)stringAlternativeTaxpayer identification number. Used only for transactions between LATAM buyers and non-LATAM sellers.
Maximum length: 5000
tax_id (anyOf 2)nullAlternative

Referenced models: Create a Location — response body — address

Create a Payment Method — response body — acss debit
FieldTypePresenceDescription and constraints
$objectRoot
bank_nameJSONOptional
bank_name (anyOf 1)stringAlternativeName of the bank associated with the bank account.
Maximum length: 5000
bank_name (anyOf 2)nullAlternative
fingerprintJSONOptional
fingerprint (anyOf 1)stringAlternativeUniquely identifies this particular bank account. You can use this attribute to check whether two bank accounts are the same.
Maximum length: 5000
fingerprint (anyOf 2)nullAlternative
institution_numberJSONOptional
institution_number (anyOf 1)stringAlternativeInstitution number of the bank account.
Maximum length: 5000
institution_number (anyOf 2)nullAlternative
last4JSONOptional
last4 (anyOf 1)stringAlternativeLast four digits of the bank account number.
Maximum length: 5000
last4 (anyOf 2)nullAlternative
transit_numberJSONOptional
transit_number (anyOf 1)stringAlternativeTransit number of the bank account.
Maximum length: 5000
transit_number (anyOf 2)nullAlternative
Create a Payment Method — response body — au becs debit
FieldTypePresenceDescription and constraints
$objectRoot
bsb_numberJSONOptional
bsb_number (anyOf 1)stringAlternativeSix-digit number identifying bank and branch associated with this bank account.
Maximum length: 5000
bsb_number (anyOf 2)nullAlternative
fingerprintJSONOptional
fingerprint (anyOf 1)stringAlternativeUniquely identifies this particular bank account. You can use this attribute to check whether two bank accounts are the same.
Maximum length: 5000
fingerprint (anyOf 2)nullAlternative
last4JSONOptional
last4 (anyOf 1)stringAlternativeLast four digits of the bank account number.
Maximum length: 5000
last4 (anyOf 2)nullAlternative
Create a Payment Method — response body — bacs debit
FieldTypePresenceDescription and constraints
$objectRoot
fingerprintJSONOptional
fingerprint (anyOf 1)stringAlternativeUniquely identifies this particular bank account. You can use this attribute to check whether two bank accounts are the same.
Maximum length: 5000
fingerprint (anyOf 2)nullAlternative
last4JSONOptional
last4 (anyOf 1)stringAlternativeLast four digits of the bank account number.
Maximum length: 5000
last4 (anyOf 2)nullAlternative
sort_codeJSONOptional
sort_code (anyOf 1)stringAlternativeSort code of the bank account. (e.g., `10-20-30`)
Maximum length: 5000
sort_code (anyOf 2)nullAlternative
Create a Payment Method — response body — bizum
FieldTypePresenceDescription and constraints
$objectRoot
buyer_idJSONOptional
buyer_id (anyOf 1)stringAlternativeA unique identifier for the buyer as determined by the local payment processor.
Maximum length: 5000
buyer_id (anyOf 2)nullAlternative
Create a Payment Method — response body — blik
FieldTypePresenceDescription and constraints
$objectRoot
buyer_idJSONOptional
buyer_id (anyOf 1)stringAlternativeA unique and immutable identifier assigned by BLIK to every buyer.
Maximum length: 5000
buyer_id (anyOf 2)nullAlternative
Create a Payment Method — response body — boleto
FieldTypePresenceDescription and constraints
$objectRoot
tax_idstringRequired within parentUniquely identifies the customer tax id (CNPJ or CPF)
Maximum length: 5000
Create a Payment Method — response body — cashapp
FieldTypePresenceDescription and constraints
$objectRoot
buyer_idJSONOptional
buyer_id (anyOf 1)stringAlternativeA unique and immutable identifier assigned by Cash App to every buyer.
Maximum length: 5000
buyer_id (anyOf 2)nullAlternative
cashtagJSONOptional
cashtag (anyOf 1)stringAlternativeA public identifier for buyers using Cash App.
Maximum length: 5000
cashtag (anyOf 2)nullAlternative
Create a Payment Method — response body — custom
FieldTypePresenceDescription and constraints
$objectRoot
display_nameJSONOptional
display_name (anyOf 1)stringAlternativeDisplay name of the Dashboard-only CustomPaymentMethodType.
Maximum length: 5000
display_name (anyOf 2)nullAlternative
logoJSONOptional
logo (anyOf 1)JSONAlternativeContains information about the Dashboard-only CustomPaymentMethodType logo.
logo (anyOf 1) (anyOf 1)ModelAlternativeExpand Create a Payment Method — response body — custom logo value content type, url
logo (anyOf 2)nullAlternative
typestringRequired within parentID of the Dashboard-only CustomPaymentMethodType. Not expandable.
Maximum length: 5000

Referenced models: Create a Payment Method — response body — custom logo value content type, url

Create a Payment Method — response body — link
FieldTypePresenceDescription and constraints
$objectRoot
emailJSONOptional
email (anyOf 1)stringAlternativeAccount owner's email address.
Maximum length: 5000
email (anyOf 2)nullAlternative

SDK function policy ID: stripe.postpaymentmethods. Catalog operation: PostPaymentMethods. Rules can name either ID; function rules distinguish managed calls and conservatively cover raw calls sharing the route. Existing grant permissions and policy rules apply. wait() returns an immediate result or waits for a required approval; it never approves the request itself. Persist the approval ID to resume after a restart.

Provider errors retain their response; JSON decoding raises ProviderAPIError for provider failures. ManagedOperationError identifies contract/input/retention errors. See error handling and provider-specific behavior. Sensitive input may be refused before approval storage. A decoding error never resubmits a write.

Pinned headers: {"Stripe-Version": "2026-09-30.endive"}

Official provider source

Report an issue with this page

Necessary

Required for sign-in, security, authorization, and remembering your choices.

Always active

Analytics

Helps us understand which product and documentation features are useful.

Performance diagnostics

Uses performance tracing and privacy-masked session replay to diagnose problems.

You can change these choices at any time from Cookie settings.