Omise.Transfer (omise v0.9.0)
Provides Transfers API interfaces.
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
Specs
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()
}
Link to this section Functions
create(params, opts \\ [])
Specs
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 \\ [])
Specs
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 \\ [])
Specs
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)
list_schedules(params \\ [], opts \\ [])
Specs
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
retrieve(id, opts \\ [])
Specs
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 \\ [])
Specs
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)