omise v0.6.0 Omise.Transfer

Provides Transfers API interfaces.

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

Link to this section Summary

Functions

Create a transfer

Destroy a transfer

List all transfers

List all transfer schedules

Retrieve a transfer

Update a transfer

Link to this section Types

Link to this type 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()}

Link to this section Functions

Link to this function 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"
)
Link to this function 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")
Link to this function 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)
Link to this function list_schedules(params \\ [], opts \\ [])
list_schedules(Keyword.t(), Keyword.t()) ::
  {:ok, Omise.List.t()} |
  {:error, Omise.Error.t()}

List all transfer schedules.

Returns {:ok, schedules} 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_schedules
Link to this function 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")
Link to this function 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)