stripity_stripe v1.6.0 Stripe.Tokens

API for working with Tokens at Stripe. Through this API you can: -create -retrieve tokens for both credit card and bank account allowing you to use them instead of a credit card number in various operations.

Supports Connect workflow by allowing to pass in any API key explicitely (vs using the one from env/config).

(API ref https://stripe.com/docs/api#tokens)

Summary

Functions

Creates a token. ##Example

   # payload for credit card token
    params = [
          card: [
              number: "4242424242424242",
              exp_month: 8,
              exp_year: 2016,
              cvc: "314"
          ]
    ]
    # payload for a bank account token
    params: [
      bank_account: [
          country: "US",
          currency: "usd",
          routing_number: "110000000",
          account_number: "000123456789"
      ]
    ]
   {:ok, token} = Stripe.Tokens.create params
   IO.puts token.id

Creates a token using given api key. ##Example

...
{:ok, token} = Stripe.Tokens.create params, key
...

Retrieve a token by its id. Returns 404 if not found.

Example

Retrieve a token by its id using given api key.

Example

Functions

create(params)

Creates a token. ##Example

   # payload for credit card token
    params = [
          card: [
              number: "4242424242424242",
              exp_month: 8,
              exp_year: 2016,
              cvc: "314"
          ]
    ]
    # payload for a bank account token
    params: [
      bank_account: [
          country: "US",
          currency: "usd",
          routing_number: "110000000",
          account_number: "000123456789"
      ]
    ]
   {:ok, token} = Stripe.Tokens.create params
   IO.puts token.id
create(params, key)

Creates a token using given api key. ##Example

...
{:ok, token} = Stripe.Tokens.create params, key
...
get(id)

Retrieve a token by its id. Returns 404 if not found.

Example

{:ok, token} = Stripe.Tokens.get "token_id"
get(id, key)

Retrieve a token by its id using given api key.

Example

{:ok, token} = Stripe.Tokens.get "token_id", key