Omise.Transfer (omise v0.10.0)

Provides Transfers API interfaces.

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

Summary

Functions

Create a transfer.

Destroy a transfer.

List all transfers.

List all transfer schedules.

Retrieve a transfer.

Update a transfer.

Types

@type 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(),
  fee_vat: integer(),
  id: String.t(),
  livemode: boolean(),
  location: String.t(),
  metadata: map(),
  net: integer(),
  object: String.t(),
  paid: boolean(),
  recipient: String.t(),
  schedule: String.t(),
  sendable: boolean(),
  sent: boolean(),
  total_fee: integer(),
  transaction: String.t(),
  transactions: list()
}

Functions

Link to this function

create(params, opts \\ [])

@spec 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 \\ [])

@spec 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 \\ [])

@spec 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 \\ [])

@spec 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 \\ [])

@spec 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 \\ [])

@spec 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)