stripity_stripe v1.6.0 Stripe.Customers

Main API for working with Customers at Stripe. Through this API you can: -change subscriptions -create invoices -create customers -delete single customer -delete all customer -count customers

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/curl#customer_object

Summary

Functions

List all customers. Using a given stripe key to apply against the account associated

Count total number of customers

Count total number of customers. Using a given stripe key to apply against the account associated

Creates a Customer with the given parameters - all of which are optional

Creates a Customer with the given parameters - all of which are optional. Using a given stripe key to apply against the account associated

Deletes a Customer with the specified ID

Deletes a Customer with the specified ID Using a given stripe key to apply against the account associated

Deletes all Customers

Deletes all Customers Using a given stripe key to apply against the account associated

Retrieves a given Customer with the specified ID. Returns 404 if not found.

Example

Retrieves a given Customer with the specified ID. Returns 404 if not found. Using a given stripe key to apply against the account associated.

Example

Returns a list of Customers with a default limit of 10 which you can override with list/1

Returns a list of Customers with a default limit of 10 which you can override with list/1 Using a given stripe key to apply against the account associated

Updates a Customer with the given parameters - all of which are optional

Updates a Customer with the given parameters - all of which are optional. Using a given stripe key to apply against the account associated

Functions

all(accum \\ [], starting_after \\ "")

List all customers.

##Example

{:ok, customers} = Stripe.Customers.all
all(key, accum, starting_after)

List all customers. Using a given stripe key to apply against the account associated.

##Example

{:ok, customers} = Stripe.Customers.all key, accum, starting_after
count()

Count total number of customers.

Example

{:ok, count} = Stripe.Customers.count
count(key)

Count total number of customers. Using a given stripe key to apply against the account associated.

Example

{:ok, count} = Stripe.Customers.count key
create(params)

Creates a Customer with the given parameters - all of which are optional.

Example

  new_customer = [
    email: "test@test.com",
    description: "An Test Account",
    metadata:[
      app_order_id: "ABC123"
      app_state_x: "xyz"
    ],
    card: [
      number: "4111111111111111",
      exp_month: 01,
      exp_year: 2018,
      cvc: 123,
      name: "Joe Test User"
    ]
  ]
  {:ok, res} = Stripe.Customers.create new_customer
create(params, key)

Creates a Customer with the given parameters - all of which are optional. Using a given stripe key to apply against the account associated.

Example

{:ok, res} = Stripe.Customers.create new_customer, key
delete(id)

Deletes a Customer with the specified ID

Example

{:ok, resp} =  Stripe.Customers.delete "customer_id"
delete(id, key)

Deletes a Customer with the specified ID Using a given stripe key to apply against the account associated.

Example

{:ok, resp} = Stripe.Customers.delete "customer_id", key
delete_all()

Deletes all Customers

Example

Stripe.Customers.delete_all
delete_all(key)

Deletes all Customers Using a given stripe key to apply against the account associated.

Example

Stripe.Customers.delete_all key
get(id)

Retrieves a given Customer with the specified ID. Returns 404 if not found.

Example

  {:ok, cust} = Stripe.Customers.get "customer_id"
get(id, key)

Retrieves a given Customer with the specified ID. Returns 404 if not found. Using a given stripe key to apply against the account associated.

Example

{:ok, cust} = Stripe.Customers.get "customer_id", key
list(starting_after \\ "", limit \\ 10)

Returns a list of Customers with a default limit of 10 which you can override with list/1

Example

  {:ok, customers} = Stripe.Customers.list(starting_after, 20)
list(key, starting_after, limit)

Returns a list of Customers with a default limit of 10 which you can override with list/1 Using a given stripe key to apply against the account associated.

Example

{:ok, customers} = Stripe.Customers.list(key,starting_after,20)
update(customer_id, params)

Updates a Customer with the given parameters - all of which are optional.

Example

  new_fields = [
    email: "new_email@test.com",
    description: "New description",
  ]
  {:ok, res} = Stripe.Customers.update(customer_id, new_fields)
update(customer_id, params, key)

Updates a Customer with the given parameters - all of which are optional. Using a given stripe key to apply against the account associated.

Example

{:ok, res} = Stripe.Customers.update(customer_id, new_fields, key)