Payjp.Customers (payjp v0.1.6)
Main API for working with Customers at Payjp. Through this API you can:
- create customers
- get a customer
- update customer
- delete single customer
- delete all customer
- get customers list
- get all customers
- list subscriptions for the customer
- get a subscription for the customer
Supports Connect workflow by allowing to pass in any API key explicitely (vs using the one from env/config).
(API ref: https://pay.jp/docs/api/#customer-顧客
Link to this section Summary
Functions
List all customers.
List all customers. Using a given payjp 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 payjp key to apply against the account associated.
Deletes a Customer with the specified ID
Deletes a Customer with the specified ID Using a given payjp key to apply against the account associated.
Deletes all Customers
Deletes all Customers Using a given payjp key to apply against the account associated.
Retrieves a given Customer with the specified ID. Returns 404 if not found.
Retrieves a given Customer with the specified ID. Returns 404 if not found. Using a given payjp key to apply against the account associated.
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 payjp key to apply against the account associated.
Returns a subscription; customer_id and subscription_id are required.
Returns a subscription using given api key; customer_id and subscription_id are required.
Returns subscription list for the specified customer; customer_id is required.
Returns subscription list for the specified customer with given api key; customer_id is required.
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 payjp key to apply against the account associated.
Link to this section Functions
all(accum \\ [], opts \\ [limit: 100])
List all customers.
##Example
{:ok, customers} = Payjp.Customers.all
all(key, accum, opts)
List all customers. Using a given payjp key to apply against the account associated.
##Example
{:ok, customers} = Payjp.Customers.all key, accum, since
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} = Payjp.Customers.create new_customer
create(params, key)
Creates a Customer with the given parameters - all of which are optional. Using a given payjp key to apply against the account associated.
Example
{:ok, res} = Payjp.Customers.create new_customer, key
delete(id)
Deletes a Customer with the specified ID
Example
{:ok, resp} = Payjp.Customers.delete "customer_id"
delete(id, key)
Deletes a Customer with the specified ID Using a given payjp key to apply against the account associated.
Example
{:ok, resp} = Payjp.Customers.delete "customer_id", key
delete_all()
Deletes all Customers
Example
Payjp.Customers.delete_all
delete_all(key)
Deletes all Customers Using a given payjp key to apply against the account associated.
Example
Payjp.Customers.delete_all key
get(id)
Retrieves a given Customer with the specified ID. Returns 404 if not found.
Example
{:ok, cust} = Payjp.Customers.get "customer_id"
get(id, key)
Retrieves a given Customer with the specified ID. Returns 404 if not found. Using a given payjp key to apply against the account associated.
Example
{:ok, cust} = Payjp.Customers.get "customer_id", key
list(opts \\ [])
Returns a list of Customers with a default limit of 10 which you can override with list/1
Example
{:ok, customers} = Payjp.Customers.list
{:ok, customers} = Payjp.Customers.list(since: 1487473464, limit: 20)
list(key, opts)
Returns a list of Customers with a default limit of 10 which you can override with list/1
Using a given payjp key to apply against the account associated.
Example
{:ok, customers} = Payjp.Customers.list(key, since: 1487473464, limit: 20)
subscription(customer_id, sub_id)
Returns a subscription; customer_id and subscription_id are required.
Example
{:ok, sub} = Payjp.Subscriptions.subscription "customer_id", "subscription_id"
subscription(customer_id, sub_id, key)
Returns a subscription using given api key; customer_id and subscription_id are required.
Example
{:ok, sub} = Payjp.Subscriptions.subscription "customer_id", "subscription_id", key
subscriptions(customer_id, accum \\ [], opts \\ [])
Returns subscription list for the specified customer; customer_id is required.
Example
{:ok, sub} = Payjp.Subscriptions.subscriptions "customer_id"
subscriptions(customer_id, accum, key, opts)
Returns subscription list for the specified customer with given api key; customer_id is required.
Example
{:ok, sub} = Payjp.Subscriptions.subscriptions "customer_id" key, []
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} = Payjp.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 payjp key to apply against the account associated.
Example
{:ok, res} = Payjp.Customers.update(customer_id, new_fields, key)