createPaymentMethod

suspend fun Stripe.createPaymentMethod(paymentMethodCreateParams: PaymentMethodCreateParams, idempotencyKey: String? = null, stripeAccountId: String? = this.stripeAccountId): PaymentMethod

Create a PaymentMethod from a coroutine.

See Create a PaymentMethod. POST /v1/payment_methods

Return

a PaymentMethod object

Parameters

paymentMethodCreateParams
idempotencyKey

optional, see Idempotent Requests

stripeAccountId

Optional, the Connect account to associate with this request. By default, will use the Connect account that was used to instantiate the Stripe object, if specified.

Throws

failure to properly authenticate yourself (check your key)

your request has invalid parameters

failure to connect to Stripe's API

any other type of problem (for instance, a temporary issue with Stripe's servers)