stripity_stripe v1.6.0 Stripe.Cards
Functions for working with cards at Stripe. Through this API you can:
- create a card,
- update a card,
- get a card,
- delete a card,
- delete all cards,
- list cards,
- list all cards,
- count cards.
All requests require owner_type
and owner_id
parameters to be specified.
owner_type
must be one of the following:
customer
,account
,recipient
.
owner_id
must be the ID of the owning object.
Stripe API reference: https://stripe.com/docs/api/curl#card_object
Summary
Functions
List all cards
List all cards. Accepts Stripe API key
Get total number of cards
Get total number of cards. Accepts Stripe API key
Create a card
Create a card. Accepts Stripe API key
Delete a card
Delete a card. Accepts Stripe API key
Delete all cards
Delete all cards. Accepts Stripe API key
Get a card
Get a card. Accepts Stripe API key
Get a list of cards
Get a list of cards. Accepts Stripe API key
Update a card
Update a card. Accepts Stripe API key
Functions
List all cards.
Lists all cards for a given owner.
Accepts the following parameters:
accum
- a list to start accumulating cards to (optional; defaults to[]
).,starting_after
- an offset (optional; defaults to""
).
Returns {:ok, cards}
tuple.
Examples
{:ok, cards} = Stripe.Cards.all(:customer, customer_id, accum, starting_after)
List all cards. Accepts Stripe API key.
Lists all cards for a given owner.
Accepts the following parameters:
accum
- a list to start accumulating cards to (optional; defaults to[]
).,starting_after
- an offset (optional; defaults to""
).
Returns {:ok, cards}
tuple.
Examples
{:ok, cards} = Stripe.Cards.all(:customer, customer_id, accum, starting_after, key)
Get total number of cards.
Gets total number of cards for a given owner.
Returns {:ok, count}
tuple.
Examples
{:ok, count} = Stripe.Cards.count(:customer, customer_id)
Get total number of cards. Accepts Stripe API key.
Gets total number of cards for a given owner.
Returns {:ok, count}
tuple.
Examples
{:ok, count} = Stripe.Cards.count(:customer, customer_id, key)
Create a card.
Creates a card for given owner type, owner ID using params.
params
must contain a “source” object. Inside the “source” object, the following parameters are required:
- object,
- number,
- cvs,
- exp_month,
- exp_year.
Returns a {:ok, card}
tuple.
Examples
params = [
source: [
object: "card",
number: "4111111111111111",
cvc: 123,
exp_month: 12,
exp_year: 2020,
metadata: [
test_field: "test val"
]
]
]
{:ok, card} = Stripe.Cards.create(:customer, customer_id, params)
Create a card. Accepts Stripe API key.
Creates a card for given owner using params.
params
must contain a “source” object. Inside the “source” object, the following parameters are required:
- object,
- number,
- cvs,
- exp_month,
- exp_year.
Returns a {:ok, card}
tuple.
Examples
{:ok, card} = Stripe.Cards.create(:customer, customer_id, params, key)
Delete a card.
Deletes a card for given owner using card ID.
Returns a {:ok, card}
tuple.
Examples
{:ok, deleted_card} = Stripe.Cards.delete("card_id")
Delete a card. Accepts Stripe API key.
Deletes a card for given owner using card ID.
Returns a {:ok, card}
tuple.
Examples
{:ok, deleted_card} = Stripe.Cards.delete("card_id", key)
Delete all cards.
Deletes all cards from given owner.
Returns :ok
atom.
Examples
:ok = Stripe.Cards.delete_all(:customer, customer_id)
Delete all cards. Accepts Stripe API key.
Deletes all cards from given owner.
Returns :ok
atom.
Examples
:ok = Stripe.Cards.delete_all(:customer, customer_id, key)
Get a card.
Gets a card for given owner using card ID.
Returns a {:ok, card}
tuple.
Examples
{:ok, card} = Stripe.Cards.get(:customer, customer_id, card_id)
Get a card. Accepts Stripe API key.
Gets a card for given owner using card ID.
Returns a {:ok, card}
tuple.
Examples
{:ok, card} = Stripe.Cards.get(:customer, customer_id, card_id, key)
Get a list of cards.
Gets a list of cards for given owner.
Accepts the following parameters:
starting_after
- an offset (optional),limit
- a limit of items to be returned (optional; defaults to 10).
Returns a {:ok, cards}
tuple, where cards
is a list of cards.
Examples
{:ok, cards} = Stripe.Cards.list(:customer, customer_id, 5) # Get a list of up to 10 cards, skipping first 5 cards
{:ok, cards} = Stripe.Cards.list(:customer, customer_id, 5, 20) # Get a list of up to 20 cards, skipping first 5 cards
Get a list of cards. Accepts Stripe API key.
Gets a list of cards for a given owner.
Accepts the following parameters:
starting_after
- an offset (optional),limit
- a limit of items to be returned (optional; defaults to 10).
Returns a {:ok, cards}
tuple, where cards
is a list of cards.
Examples
{:ok, cards} = Stripe.Cards.list(:customer, customer_id, key, 5) # Get a list of up to 10 cards, skipping first 5 cards
{:ok, cards} = Stripe.Cards.list(:customer, customer_id, key, 5, 20) # Get a list of up to 20 cards, skipping first 5 cards
Update a card.
Updates a card for given owner using card ID and params.
owner_type
must be one of the following:customer
,account
,recipient
.
owner_id
must be the ID of the owning object.
Returns a {:ok, card}
tuple.
Examples
{:ok, card} = Stripe.Cards.update(:customer, customer_id, card_id, params)