Tokenise cards for use in payments and 3DS sessions.
Cards are served from the PCI-scoped host api.duffel.cards, not the
main API host. The host is configurable via :cards_base_url on the
client.
A card token is single-use and short-lived: create it immediately before the payment that consumes it.
See the Duffel documentation.
Summary
Functions
@spec create(Duffel.Client.t(), map(), keyword()) :: {:ok, map()} | {:error, Duffel.Error.t()}
Tokenises a card, returning a card ID.
Options
:idempotency_key- value for theIdempotency-Keyheader. A key is generated when you do not pass one (seeDuffel.Client.post/4).
Examples
Duffel.Cards.create(client, %{
number: "4242424242424242",
expiry_month: "03",
expiry_year: "30",
cvc: "737",
name: "Amelia Earhart",
address_postal_code: "EC2A 4RQ",
address_country_code: "GB"
})
@spec delete(Duffel.Client.t(), String.t()) :: :ok | {:error, Duffel.Error.t()}
Deletes a card token.