createCardToken

suspend fun Stripe.createCardToken(cardParams: CardParams, idempotencyKey: String? = null, stripeAccountId: String? = this.stripeAccountId): Token

Create a Card token from a coroutine.

See Create a card token. POST /v1/tokens

Return

a Token object

Parameters

cardParams

the CardParams used to create this payment token

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

AuthenticationException

failure to properly authenticate yourself (check your key)

InvalidRequestException

your request has invalid parameters

APIConnectionException

failure to connect to Stripe's API

APIException

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

the card cannot be charged for some reason