omise v0.4.2 Omise.Card

Provides Card API interfaces.

https://www.omise.co/cards-api

Summary

Types

t()
t() :: %Omise.Card{bank: String.t, brand: String.t, city: String.t, country: String.t, created: String.t, deleted: boolean, expiration_month: integer, expiration_year: integer, financing: String.t, fingerprint: String.t, id: String.t, last_digits: String.t, livemode: boolean, location: String.t, name: String.t, object: String.t, postal_code: String.t, security_code_check: boolean}

Functions

destroy(customer_id, id, opts \\ [])
destroy(String.t, String.t, Keyword.t) ::
  {:ok, t} |
  {:error, Omise.Error.t}

Destroy a card.

Returns {:ok, card} if the request is successful, {:error, error} otherwise.

Examples

Omise.Card.destroy("cust_test_520j6g67py52xa7qbu2", "card_test_520j6g4rxrmurw16b2d")
list(customer_id, params \\ [], opts \\ [])
list(String.t, Keyword.t, Keyword.t) ::
  {:ok, Omise.List.t} |
  {:error, Omise.Error.t}

List all cards that belongs to the customer.

Returns {:ok, cards} 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.
  • order - (optional, default: chronological) The order of the list returned.

Examples

Omise.Card.list("cust_test_520j6g67py52xa7qbu2")
retrieve(customer_id, id, opts \\ [])
retrieve(String.t, String.t, Keyword.t) ::
  {:ok, t} |
  {:error, Omise.Error.t}

Retrieve a card.

Returns {:ok, card} if the request is successful, {:error, error} otherwise.

Examples

Omise.Card.retrieve("cust_test_520j6g67py52xa7qbu2", "card_test_520j6g4rxrmurw16b2d")
update(customer_id, id, params, opts \\ [])
update(String.t, String.t, Keyword.t, Keyword.t) ::
  {:ok, t} |
  {:error, Omise.Error.t}

Update a card.

Returns {:ok, card} if the request is successful, {:error, error} otherwise.

Request Parameters:

  • name - (optional) The cardholder name as printed on the card.
  • expiration_month - (optional) The expiration month printed on the card.
  • expiration_year - (optional) The expiration year printed on the card in the format YYYY.
  • postal_code - (optional) The postal code from the city where the card was issued.
  • city - (optional) The city where the card was issued.

Examples

params = [expiration_month: 2018, city: "Bangkok"]
Omise.Card.update("cust_test_520j6g67py52xa7qbu2", "card_test_520j6g4rxrmurw16b2d", params)