Omise.Source (omise v0.9.0)
Provides Source API interfaces.
Link to this section Summary
Link to this section Types
Specs
t() :: %Omise.Source{
amount: integer(),
barcode: String.t(),
charge_status: String.t(),
created: String.t(),
currency: String.t(),
flow: String.t(),
id: String.t(),
installment_term: integer(),
livemode: boolean(),
location: String.t(),
mobile_number: String.t(),
name: String.t(),
object: String.t(),
phone_number: String.t(),
references: Omise.Reference.t(),
scannable_code: Omise.Barcode.t(),
store_id: String.t(),
store_name: String.t(),
terminal_id: String.t(),
type: String.t(),
zero_interest_installments: boolean()
}
Link to this section Functions
Link to this function
create(params, opts \\ [])
Specs
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"
)
Link to this function
retrieve(id, opts \\ [])
Specs
retrieve(String.t(), Keyword.t()) :: {:ok, t()} | {:error, Omise.Error.t()}
Retrieve a source.
Examples
Omise.Source.retrieve("src_test_5mkp04d53l2k1vtzmdi")