omise v0.8.0 Omise.Source

Provides Source API interfaces.

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

Link to this section Summary

Link to this section Types

Link to this type t()
t() :: %Omise.Source{
  amount: integer(),
  currency: String.t(),
  flow: String.t(),
  id: String.t(),
  object: String.t(),
  type: 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 source.

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

Request Parameters:

  • type - (required) The source payment type. See attribute section above for the available types.
  • amount - (required) The amount in the smallest subunits of the currency used.
  • currency - (required) The currency in which you want the payment to be done.

Examples

# Create with default secret key.
Omise.Source.create(
  type: "bill_payment_tesco_lotus",
  amount: 1000_00,
  currency: "thb"
)

# Create with custom public/secret key.
Omise.Source.create(
  [
    type: "bill_payment_tesco_lotus",
    amount: 1000_00,
    currency: "thb"
  ],
  key: "pkey_xxx"
)