# PostPaymentMethods

From **Stripe API**.

`POST /v1/payment_methods`

<p>Creates a PaymentMethod object. Read the <a href="/docs/stripe-js/reference#stripe-create-payment-method">Stripe.js reference</a> to learn how to create PaymentMethods via Stripe.js.</p>

<p>Instead of creating a PaymentMethod directly, we recommend using the <a href="/docs/payments/accept-a-payment">PaymentIntents</a> API to accept a payment immediately or the <a href="/docs/payments/save-and-reuse">SetupIntent</a> API to collect payment method details ahead of a future payment.</p>

## Request body

- Required: false
### `application/x-www-form-urlencoded`

- Type: `object`

```json
{"additionalProperties":false,"properties":{"acss_debit":{"description":"If this is an `acss_debit` PaymentMethod, this hash contains details about the ACSS Debit payment method.","properties":{"account_number":{"maxLength":5000,"type":"string"},"institution_number":{"maxLength":5000,"type":"string"},"transit_number":{"maxLength":5000,"type":"string"}},"required":["account_number","institution_number","transit_number"],"title":"payment_method_param","type":"object"},"afterpay_clearpay":{"description":"If this is an `AfterpayClearpay` PaymentMethod, this hash contains details about the AfterpayClearpay payment method.","title":"param","type":"object"},"alipay":{"description":"If this is an `Alipay` PaymentMethod, this hash contains details about the Alipay payment method.","title":"param","type":"object"},"au_becs_debit":{"description":"If this is an `au_becs_debit` PaymentMethod, this hash contains details about the bank account.","properties":{"account_number":{"maxLength":5000,"type":"string"},"bsb_number":{"maxLength":5000,"type":"string"}},"required":["account_number","bsb_number"],"title":"param","type":"object"},"bacs_debit":{"description":"If this is a `bacs_debit` PaymentMethod, this hash contains details about the Bacs Direct Debit bank account.","properties":{"account_number":{"maxLength":5000,"type":"string"},"sort_code":{"maxLength":5000,"type":"string"}},"title":"param","type":"object"},"bancontact":{"description":"If this is a `bancontact` PaymentMethod, this hash contains details about the Bancontact payment method.","title":"param","type":"object"},"billing_details":{"description":"Billing information associated with the PaymentMethod that may be used or required by particular types of payment methods.","properties":{"address":{"anyOf":[{"properties":{"city":{"maxLength":5000,"type":"string"},"country":{"maxLength":5000,"type":"string"},"line1":{"maxLength":5000,"type":"string"},"line2":{"maxLength":5000,"type":"string"},"postal_code":{"maxLength":5000,"type":"string"},"state":{"maxLength":5000,"type":"string"}},"title":"billing_details_address","type":"object"},{"enum":[""],"type":"string"}]},"email":{"anyOf":[{"type":"string"},{"enum":[""],"type":"string"}]},"name":{"maxLength":5000,"type":"string"},"phone":{"maxLength":5000,"type":"string"}},"title":"billing_details_inner_params","type":"object"},"boleto":{"description":"If this is a `boleto` PaymentMethod, this hash contains details about the Boleto payment method.","properties":{"tax_id":{"maxLength":5000,"type":"string"}},"required":["tax_id"],"title":"param","type":"object"},"card":{"anyOf":[{"properties":{"cvc":{"maxLength":5000,"type":"string"},"exp_month":{"type":"integer"},"exp_year":{"type":"integer"},"number":{"maxLength":5000,"type":"string"}},"required":["exp_month","exp_year","number"],"title":"card_details_params","type":"object"},{"properties":{"token":{"maxLength":5000,"type":"string"}},"required":["token"],"title":"token_params","type":"object"}],"description":"If 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.","x-stripeBypassValidation":true},"customer":{"description":"The `Customer` to whom the original PaymentMethod is attached.","maxLength":5000,"type":"string"},"eps":{"description":"If this is an `eps` PaymentMethod, this hash contains details about the EPS payment method.","properties":{"bank":{"enum":["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","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"],"maxLength":5000,"type":"string"}},"title":"param","type":"object"},"expand":{"description":"Specifies which fields in the response should be expanded.","items":{"maxLength":5000,"type":"string"},"type":"array"},"fpx":{"description":"If this is an `fpx` PaymentMethod, this hash contains details about the FPX payment method.","properties":{"bank":{"enum":["affin_bank","agrobank","alliance_bank","ambank","bank_islam","bank_muamalat","bank_rakyat","bsn","cimb","deutsche_bank","hong_leong_bank","hsbc","kfh","maybank2e","maybank2u","ocbc","pb_enterprise","public_bank","rhb","standard_chartered","uob"],"maxLength":5000,"type":"string","x-stripeBypassValidation":true}},"required":["bank"],"title":"param","type":"object"},"giropay":{"description":"If this is a `giropay` PaymentMethod, this hash contains details about the Giropay payment method.","title":"param","type":"object"},"grabpay":{"description":"If this is a `grabpay` PaymentMethod, this hash contains details about the GrabPay payment method.","title":"param","type":"object"},"ideal":{"description":"If this is an `ideal` PaymentMethod, this hash contains details about the iDEAL payment method.","properties":{"bank":{"enum":["abn_amro","asn_bank","bunq","handelsbanken","ing","knab","moneyou","rabobank","regiobank","revolut","sns_bank","triodos_bank","van_lanschot"],"maxLength":5000,"type":"string"}},"title":"param","type":"object"},"interac_present":{"description":"If this is an `interac_present` PaymentMethod, this hash contains details about the Interac Present payment method.","title":"param","type":"object"},"klarna":{"description":"If this is a `klarna` PaymentMethod, this hash contains details about the Klarna payment method.","properties":{"dob":{"properties":{"day":{"type":"integer"},"month":{"type":"integer"},"year":{"type":"integer"}},"required":["day","month","year"],"title":"date_of_birth","type":"object"}},"title":"param","type":"object"},"metadata":{"additionalProperties":{"type":"string"},"description":"Set of [key-value pairs](https://stripe.com/docs/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`.","type":"object"},"oxxo":{"description":"If this is an `oxxo` PaymentMethod, this hash contains details about the OXXO payment method.","title":"param","type":"object"},"p24":{"description":"If this is a `p24` PaymentMethod, this hash contains details about the P24 payment method.","properties":{"bank":{"enum":["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","volkswagen_bank"],"type":"string","x-stripeBypassValidation":true}},"title":"param","type":"object"},"payment_method":{"description":"The PaymentMethod to share.","maxLength":5000,"type":"string"},"sepa_debit":{"description":"If this is a `sepa_debit` PaymentMethod, this hash contains details about the SEPA debit bank account.","properties":{"iban":{"maxLength":5000,"type":"string"}},"required":["iban"],"title":"param","type":"object"},"sofort":{"description":"If this is a `sofort` PaymentMethod, this hash contains details about the SOFORT payment method.","properties":{"country":{"enum":["AT","BE","DE","ES","IT","NL"],"type":"string"}},"required":["country"],"title":"param","type":"object"},"type":{"description":"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.","enum":["acss_debit","afterpay_clearpay","alipay","au_becs_debit","bacs_debit","bancontact","boleto","card","eps","fpx","giropay","grabpay","ideal","klarna","oxxo","p24","sepa_debit","sofort","wechat_pay"],"type":"string","x-stripeBypassValidation":true},"wechat_pay":{"description":"If this is an `wechat_pay` PaymentMethod, this hash contains details about the wechat_pay payment method.","title":"param","type":"object"}},"type":"object"}
```

## Security

### `basicAuth`

- Type: `http`
- Request header: `Authorization`
- Scheme: `basic`
Send credentials in the `Authorization` request header using the `Basic` scheme.

Basic HTTP authentication. Allowed headers-- Authorization: Basic <api_key> | Authorization: Basic <base64 hash of `api_key:`>

### `bearerAuth`

- Type: `http`
- Request header: `Authorization`
- Scheme: `bearer`
- Bearer format: `auth-scheme`
Send the token in the `Authorization` request header using the `Bearer` scheme.

Bearer HTTP authentication. Allowed headers-- Authorization: Bearer <api_key>

## Responses

### `200`

Successful response.

### `application/json`

- Type: `object`

PaymentMethod objects represent your customer's payment instruments.
They can be used with [PaymentIntents](https://stripe.com/docs/payments/payment-intents) to collect payments or saved to
Customer objects to store instrument details for future payments.

Related guides: [Payment Methods](https://stripe.com/docs/payments/payment-methods) and [More Payment Scenarios](https://stripe.com/docs/payments/more-payment-scenarios).

```json
{"description":"PaymentMethod objects represent your customer's payment instruments.\nThey can be used with [PaymentIntents](https://stripe.com/docs/payments/payment-intents) to collect payments or saved to\nCustomer objects to store instrument details for future payments.\n\nRelated guides: [Payment Methods](https://stripe.com/docs/payments/payment-methods) and [More Payment Scenarios](https://stripe.com/docs/payments/more-payment-scenarios).","properties":{"acss_debit":{"$ref":"#/components/schemas/payment_method_acss_debit"},"afterpay_clearpay":{"$ref":"#/components/schemas/payment_method_afterpay_clearpay"},"alipay":{"$ref":"#/components/schemas/payment_flows_private_payment_methods_alipay"},"au_becs_debit":{"$ref":"#/components/schemas/payment_method_au_becs_debit"},"bacs_debit":{"$ref":"#/components/schemas/payment_method_bacs_debit"},"bancontact":{"$ref":"#/components/schemas/payment_method_bancontact"},"billing_details":{"$ref":"#/components/schemas/billing_details"},"boleto":{"$ref":"#/components/schemas/payment_method_boleto"},"card":{"$ref":"#/components/schemas/payment_method_card"},"card_present":{"$ref":"#/components/schemas/payment_method_card_present"},"created":{"description":"Time at which the object was created. Measured in seconds since the Unix epoch.","format":"unix-time","type":"integer"},"customer":{"anyOf":[{"maxLength":5000,"type":"string"},{"$ref":"#/components/schemas/customer"}],"description":"The ID of the Customer to which this PaymentMethod is saved. This will not be set when the PaymentMethod has not been saved to a Customer.","nullable":true,"x-expansionResources":{"oneOf":[{"$ref":"#/components/schemas/customer"}]}},"eps":{"$ref":"#/components/schemas/payment_method_eps"},"fpx":{"$ref":"#/components/schemas/payment_method_fpx"},"giropay":{"$ref":"#/components/schemas/payment_method_giropay"},"grabpay":{"$ref":"#/components/schemas/payment_method_grabpay"},"id":{"description":"Unique identifier for the object.","maxLength":5000,"type":"string"},"ideal":{"$ref":"#/components/schemas/payment_method_ideal"},"interac_present":{"$ref":"#/components/schemas/payment_method_interac_present"},"klarna":{"$ref":"#/components/schemas/payment_method_klarna"},"livemode":{"description":"Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode.","type":"boolean"},"metadata":{"additionalProperties":{"maxLength":500,"type":"string"},"description":"Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format.","nullable":true,"type":"object"},"object":{"description":"String representing the object's type. Objects of the same type share the same value.","enum":["payment_method"],"type":"string"},"oxxo":{"$ref":"#/components/schemas/payment_method_oxxo"},"p24":{"$ref":"#/components/schemas/payment_method_p24"},"sepa_debit":{"$ref":"#/components/schemas/payment_method_sepa_debit"},"sofort":{"$ref":"#/components/schemas/payment_method_sofort"},"type":{"description":"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.","enum":["acss_debit","afterpay_clearpay","alipay","au_becs_debit","bacs_debit","bancontact","boleto","card","card_present","eps","fpx","giropay","grabpay","ideal","interac_present","klarna","oxxo","p24","sepa_debit","sofort","wechat_pay"],"type":"string","x-stripeBypassValidation":true},"wechat_pay":{"$ref":"#/components/schemas/payment_method_wechat_pay"}},"required":["billing_details","created","id","livemode","object","type"],"title":"PaymentMethod","type":"object","x-expandableFields":["acss_debit","afterpay_clearpay","alipay","au_becs_debit","bacs_debit","bancontact","billing_details","boleto","card","card_present","customer","eps","fpx","giropay","grabpay","ideal","interac_present","klarna","oxxo","p24","sepa_debit","sofort","wechat_pay"],"x-resourceId":"payment_method"}
```

### `default`

Error response.

### `application/json`

- Type: `object`

An error response from the Stripe API

```json
{"description":"An error response from the Stripe API","properties":{"error":{"$ref":"#/components/schemas/api_errors"}},"required":["error"],"type":"object"}
```

## Request examples

### cURL

```shell
curl --request POST \
  --url https://api.stripe.com/v1/payment_methods \
  --header 'content-type: application/x-www-form-urlencoded' \
  --data '{
  "acss_debit": {
    "account_number": "string",
    "institution_number": "string",
    "transit_number": "string"
  },
  "afterpay_clearpay": {},
  "alipay": {},
  "au_becs_debit": {
    "account_number": "string",
    "bsb_number": "string"
  },
  "bacs_debit": {
    "account_number": "string",
    "sort_code": "string"
  },
  "bancontact": {},
  "billing_details": {
    "address": "string",
    "email": "string",
    "name": "string",
    "phone": "string"
  },
  "boleto": {
    "tax_id": "string"
  },
  "card": "string",
  "customer": "string",
  "eps": {
    "bank": "string"
  },
  "expand": [
    "string"
  ],
  "fpx": {
    "bank": "string"
  },
  "giropay": {},
  "grabpay": {},
  "ideal": {
    "bank": "string"
  },
  "interac_present": {},
  "klarna": {
    "dob": {
      "day": 1,
      "month": 1,
      "year": 1
    }
  },
  "metadata": {},
  "oxxo": {},
  "p24": {
    "bank": "string"
  },
  "payment_method": "string",
  "sepa_debit": {
    "iban": "string"
  },
  "sofort": {
    "country": "string"
  },
  "type": "string",
  "wechat_pay": {}
}'
```
