ex_openpay v0.1.2 ExOpenpay.Customers

Functions for working with customers at Openpay. Through this API you can:

  • create a customer,
  • update a customer,
  • get a customer,
  • list customers,
  • count customers,
  • refund a customer,
  • partially refund a customer.

Openpay API reference: https://www.openpay.mx/docs/api/?shell#clientes

Link to this section Summary

Functions

List all customers. ##Example

{:ok, customers} = ExOpenpay.Customers.all

List all customers. Using a given openpay key to apply against the account associated. ##Example

{:ok, customers} = ExOpenpay.Customers.all key, accum, starting_after

Count total number of customers.

Example

{:ok, count} = ExOpenpay.Customers.count

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

Example

{:ok, count} = ExOpenpay.Customers.count key

Create a customer

Create a customer. Accepts ExOpenpay API key

Delete a customer. Deletes a customer for given owner using customer ID. Returns a {:ok, customer} tuple.

Examples

{:ok, deleted_customer} = ExOpenpay.Customers.delete("customer_id")

Delete a customer. Accepts ExOpenpay API key. Deletes a customer for given owner using customer ID. Returns a {:ok, customer} tuple.

Examples

{:ok, deleted_customer} = ExOpenpay.Customers.delete("customer_id", key)

Deletes all Customers

Example

ExOpenpay.Customers.delete_all

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

Example

ExOpenpay.Customers.delete_all key

Get a customer. Gets a customer for given owner using customer ID. Returns a {:ok, customer} tuple.

Examples

{:ok, customer} = ExOpenpay.Customers.get(customer_id)

Get a customer. Accepts ExOpenpay API key. Gets a customer for given owner using customer ID. Returns a {:ok, customer} tuple.

Examples

{:ok, customer} = ExOpenpay.Customers.get(customer_id, key)

Link to this section Functions

Link to this function all(accum \\ [], starting_after \\ "")

List all customers. ##Example

{:ok, customers} = ExOpenpay.Customers.all
Link to this function all(key, accum, starting_after)

List all customers. Using a given openpay key to apply against the account associated. ##Example

{:ok, customers} = ExOpenpay.Customers.all key, accum, starting_after

Count total number of customers.

Example

{:ok, count} = ExOpenpay.Customers.count

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

Example

{:ok, count} = ExOpenpay.Customers.count key

Create a customer.

Creates a customer for a customer or customer using amount and params. params must include a source.

Returns {:ok, customer} tuple.

Examples

params = [
  name: "customer name",
  last_name: "",
  email: "customer_email@me.com",
  phone_number: "",
  # address: "",
  # external_id: ""
]

{:ok, customer} = ExOpenpay.Customers.create(params)
Link to this function create(params, key)

Create a customer. Accepts ExOpenpay API key.

Creates a customer for a customer or customer using amount and params. params must include a source.

Returns {:ok, customer} tuple.

Examples

{:ok, customer} = ExOpenpay.Customers.create(params, key)

Delete a customer. Deletes a customer for given owner using customer ID. Returns a {:ok, customer} tuple.

Examples

{:ok, deleted_customer} = ExOpenpay.Customers.delete("customer_id")
Link to this function delete(id, key)

Delete a customer. Accepts ExOpenpay API key. Deletes a customer for given owner using customer ID. Returns a {:ok, customer} tuple.

Examples

{:ok, deleted_customer} = ExOpenpay.Customers.delete("customer_id", key)

Deletes all Customers

Example

ExOpenpay.Customers.delete_all
Link to this function delete_all(key)

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

Example

ExOpenpay.Customers.delete_all key

Get a customer. Gets a customer for given owner using customer ID. Returns a {:ok, customer} tuple.

Examples

{:ok, customer} = ExOpenpay.Customers.get(customer_id)

Get a customer. Accepts ExOpenpay API key. Gets a customer for given owner using customer ID. Returns a {:ok, customer} tuple.

Examples

{:ok, customer} = ExOpenpay.Customers.get(customer_id, key)