## Payment Methods PaymentMethod objects represent your customer's payment instruments. They can be used with PaymentIntents to collect payments or saved to Customer objects to store instrument details for future payments. Related guides: [Payment Methods](/payments/payment-methods.md) and [More Payment Scenarios](/payments/more-payment-scenarios.md). ## Create a PaymentMethod Use `stripe.createPaymentMethod` to convert payment information collected by elements into a [PaymentMethod](/api/payment_methods.md) object that you safely pass to your server to use in an API call. **NOTE:** In most integrations, you will not need to use this method. Instead, use methods like [stripe.confirmCardPayment](/js/payment_intents/confirm_card_payment.md), which will automatically create a PaymentMethod when you confirm a [PaymentIntent](/api/payment_intents.md). `stripe.createPaymentMethod(paymentMethodData)` returns a `Promise` which resolves with a result object. This object has either: * `result.paymentMethod`: a [PaymentMethod](/api/payment_methods) was created successfully. * `result.error`: there was an error. This includes client-side validation errors. Refer to the [API reference](/api/errors) for all possible errors. **Syntax:** `stripe.createPaymentMethod(...)` - `paymentMethodData` (object) **required** Refer to the [PaymentMethod API](/api/payment_methods/create.md) for a full list of parameters. - `type` (string) **required** The type of the [PaymentMethod](/api/payment_methods/create.md) to create. Refer to the [PaymentMethod API](/api/payment_methods/create.md#create_payment_method-type) for all possible values. - `card` (Element) A `card` or `cardNumber` Element. - `au_becs_debit` (Element) An `auBankAccount` Element. - `fpx` (Element) An `fpx` Element. - `fpx[bank]` (string) The customer's [bank](/payments/fpx/accept-a-payment.md#bank-reference). - `netbanking[bank]` (string) The customer's bank. - `ideal` (Element) An `idealBank` Element. - `ideal[bank]` (string) The customer's [bank](/sources/ideal.md#specifying-customer-bank). - `sepa_debit` (Element) An `iban` Element. - `sepa_debit[iban]` (string) An IBAN account number. - `upi[vpa]` (string) The customer's VPA. - `billing_details` (object) [Billing information](/api/payment_methods/create.md#create_payment_method-billing_details) associated with the PaymentMethod that may be used or required by particular types of payment methods. ### Create a PaymentMethod ```js stripe .createPaymentMethod({ type: 'card', card: cardElement, billing_details: { name: 'Jenny Rosen', }, }) .then(function(result) { // Handle result.error or result.paymentMethod }); ``` ```es_next const {paymentMethod, error} = await stripe.createPaymentMethod({ type: 'card', card: cardElement, billing_details: { name: 'Jenny Rosen', }, }); ``` ## Create a PaymentMethod with Elements Use `stripe.createPaymentMethod` to convert payment information collected by elements into a [PaymentMethod](/api/payment_methods.md) object that you safely pass to your server to use in an API call. **NOTE:** In most integrations, you will not need to use this method. Instead, use methods like [stripe.confirmPayment](/js/payment_intents/confirm_payment.md), which will automatically create a PaymentMethod when you confirm a [PaymentIntent](/api/payment_intents.md). `stripe.createPaymentMethod(options)` returns a `Promise` which resolves with a result object. This object has either: * `result.paymentMethod`: a [PaymentMethod](/api/payment_methods) was created successfully. * `result.error`: there was an error. This includes client-side validation errors. Refer to the [API reference](/api/errors) for all possible errors. **Syntax:** `stripe.createPaymentMethod(...)` - `options` (object) **required** - `elements` (object) **required** The [Elements](#payment_element_create) instance that was used to create the Payment Element. It will be used to pull payment method and billing address data from. - `params` (object) Parameters that will be passed on to the Stripe API. Refer to the [PaymentMethod API](/api/payment_methods/create.md) for a full list of parameters. - `billing_details` (object) [Billing information](/api/payment_methods/create.md#create_payment_method-billing_details) associated with the PaymentMethod that may be used or required by particular types of payment methods. ### Create a PaymentMethod ```js stripe .createPaymentMethod({ elements, params: { billing_details: { name: 'Jenny Rosen', }, }, }) .then(function(result) { // Handle result.error or result.paymentMethod }); ``` ```es_next const {paymentMethod, error} = await stripe.createPaymentMethod({ elements, params: { billing_details: { name: 'Jenny Rosen', }, }, }); ```