omise v0.3.0 Omise.Customer
Provides Customer API interfaces.
Summary
Functions
Create a customer
Destroy a customer
List all customers
Retrieve a customer
Update a customer
Types
Functions
Specs
create(Keyword.t) ::
{:ok, Omise.Customer.t} |
{:error, Omise.Error.t}
Create a customer.
Returns {:ok, customer} if the request is successful, {:error, error} otherwise.
Request Parameters:
email- (optional) Customer’s email.description- (optional) A custom description for the customer.card- (optional) A card token in case you want to add a card to the customer.
Examples
# Create a customer without attaching a card
Omise.Customer.create(
email: "lucius@omise.co",
description: "You know, it almost makes me wish for rain"
)
# Create a customer and attach a card
Omise.Customer.create(
email: "grouplove@omise.co",
description: "Don't take me tongue tied",
card: "tokn_test_51yer81s9aqqyktdoeh"
)
Specs
destroy(String.t) ::
{:ok, Omise.Customer.t} |
{:error, Omise.Error.t}
Destroy a customer.
Returns {:ok, customer} if the request is successful, {:error, error} otherwise.
Examples
Omise.Customers.destroy("cust_test_4xtrb759599jsxlhkrb")
Specs
list(Keyword.t) ::
{:ok, Omise.List.t} |
{:error, Omise.Error.t}
List all customers.
Returns {:ok, customers} if the request is successful, {:error, error} otherwise.
Query Parameters:
offset- (optional, default: 0) The offset of the first record returned.limit- (optional, default: 20, maximum: 100) The maximum amount of records returned.from- (optional, default: 1970-01-01T00:00:00Z, format: ISO 8601) The UTC date and time limiting the beginning of returned records.to- (optional, default: current UTC Datetime, format: ISO 8601) The UTC date and time limiting the end of returned records.
Examples
Omise.Customer.list
Omise.Customer.list(limit: 5)
Specs
retrieve(String.t) ::
{:ok, Omise.Customer.t} |
{:error, Omise.Error.t}
Retrieve a customer.
Returns {:ok, customer} if the request is successful, {:error, error} otherwise.
Examples
Omise.Customer.retrieve("cust_test_4xtrb759599jsxlhkrb")
Specs
update(String.t, Keyword.t) ::
{:ok, Omise.Customer.t} |
{:error, Omise.Error.t}
Update a customer.
Returns {:ok, customer} if the request is successful, {:error, error} otherwise.
Request Parameters:
email- (optional) Customer’s email.description- (optional) A custom description for the customer.card- (optional) A card token in case you want to add a card to the customer.
Examples
# Update email and description.
Omise.Customer.update("cust_test_51yerhn3ghztgv31n4p",
email: "edward@omise.co",
description: "Home is when I’m alone with you"
)
# Attach a card to a customer.
Omise.Customer.update("cust_test_4xtrb759599jsxlhkrb",
card: "tokn_test_4xs9408a642a1htto8z"
)