omise v0.4.2 Omise.Transfer

Provides Transfers API interfaces.

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

Summary

Functions

Create a transfer

Destroy a transfer

List all transfers

Retrieve a transfer

Update a transfer

Types

t()
t() :: %Omise.Transfer{amount: integer, bank_account: Omise.BankAccount.t, created: String.t, currency: String.t, deleted: boolean, failure_code: String.t, failure_message: String.t, fee: integer, id: String.t, livemode: boolean, location: String.t, object: String.t, paid: boolean, recipient: String.t, sent: boolean, transaction: String.t}

Functions

create(params, opts \\ [])
create(Keyword.t, Keyword.t) ::
  {:ok, t} |
  {:error, Omise.Error.t}

Create a transfer.

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

Request Parameters:

  • amount - The amount in the smallest subunits of the currency used. So for thb (Thai Baht) you’ll need to pass the amount in satangs.
  • recipient - The recipient id.

Examples

# Create a transfer to a default recipient
Omise.Transfer.create(amount: 1000_00)

# Create a transfer to a third-party recipient
Omise.Transfer.create(
  amount: 1000_00,
  recipient: "recp_test_4z3wur7amjq2nbg8x44"
)
destroy(id, opts \\ [])
destroy(String.t, Keyword.t) ::
  {:ok, t} |
  {:error, Omise.Error.t}

Destroy a transfer.

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

Examples

Omise.Transfer.destroy("trsf_test_5086uxn23hfaxv8nl0f")
list(params \\ [], opts \\ [])
list(Keyword.t, Keyword.t) ::
  {:ok, Omise.List.t} |
  {:error, Omise.Error.t}

List all transfers.

Returns {:ok, transfers} 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.Transfer.list

Omise.Transfer.list(limit: 5)
retrieve(id, opts \\ [])
retrieve(String.t, Keyword.t) ::
  {:ok, t} |
  {:error, Omise.Error.t}

Retrieve a transfer.

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

Examples

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

Update a transfer.

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

Request Parameters:

  • amount - The amount in the smallest subunits of the currency used.

Examples

Omise.Transfer.update("trsf_test_5086uxn23hfaxv8nl0f", amount: 500_00)