Source API

ในการรับชำระเงินผ่านช่องทางใดๆ ที่นอกเหนือจากบัตรเครดิตและบัตรเดบิต ให้ทำการสร้าง source ของรายการนั้นๆ ก่อนแล้วจึงนำ source ไปสร้างรายการรับชำระเงิน

Attributes

Name Type Description
object string

The string source.

id object_id

The source identifier matching /src(_test)?_[0-9a-z]+/.

livemode boolean

Whether this is a live (true) or test (false) source.

location string

API path to retrieve the current source object.

amount integer

Amount for source in smallest currency unit.

barcode string

Barcode number (type=barcode_alipay).

created_at datetime

UTC datetime of source creation in ISO 8601 format (YYYY-MM-DDThh:mm:ssZ).

currency currency

Currency for source as three-letter ISO 4217 code.

email string

Payer email address (type=econtext).

flow string

The payment flow payers need to go through to complete the payment. Value can be one of the following:

  • redirect: a payer needs to be redirected to the external website with authorize_uri in the charge to complete the payment, e.g. internet banking.
  • offline: a payer will receive payment information in the charge to pay offline, e.g. bill payment at a department store.

installment_term integer

Installment term in months. See installments for allowed values (type=installment_*).

name string

Payer name (type=econtext).

phone_number string

Payer phone number (type=econtext,truemoney).

references references

Reference information about the payment (type=bill_payment_tesco_lotus,econtext,barcode_alipay).

store_id string

Store ID for payment source (type=barcode_alipay).

store_name string

Store name for payment source (type=barcode_alipay).

terminal_id string

Terminal ID for payment source (type=barcode_alipay).

type string

Payment source type. Value can be one of the following (depending on account and country):

  • alipay
  • barcode_alipay
  • bill_payment_tesco_lotus
  • econtext
  • installment_bay
  • installment_bbl
  • installment_first_choice
  • installment_kbank
  • installment_ktc
  • internet_banking_bay
  • internet_banking_bbl
  • internet_banking_ktb
  • internet_banking_scb
  • truemoney

See installments for allowed values.

zero_interest_installments boolean

Whether merchant absorbs the interest for installment payments (type=installment_*).

Example

  • JSON Response

Create a source

- POST https://api.omise.co/sources

Creates and returns a new source. Note: this verb accepts both public and secret key authentication. Sources can also be created and charged directly using the Charge API.

Request Parameters

Name Type Description
amount integer

(required) Amount for source in smallest currency unit.

currency currency

(required) Currency for source as three-letter ISO 4217 code.

type string

(required) Payment source type. Value can be one of the following (depending on account and country):

  • alipay
  • barcode_alipay
  • bill_payment_tesco_lotus
  • econtext
  • installment_bay
  • installment_bbl
  • installment_first_choice
  • installment_kbank
  • installment_ktc
  • internet_banking_bay
  • internet_banking_bbl
  • internet_banking_ktb
  • internet_banking_scb
  • truemoney

See installments for allowed values.

barcode string

(optional, but conditionally required) Barcode number (type=barcode_alipay).

email string

(optional, but conditionally required) Payer email address (type=econtext).

installment_term integer

(optional, but conditionally required) Installment term in months. See installments for allowed values (type=installment_*).

name string

(optional, but conditionally required) Payer name (type=econtext).

phone_number string

(optional, but conditionally required) Payer phone number (type=econtext,truemoney).

store_id string

(optional, but conditionally required) Store ID for payment source (type=barcode_alipay).

store_name string

(optional, but conditionally required) Store name for payment source (type=barcode_alipay).

terminal_id string

(optional, but conditionally required) Terminal ID for payment source (type=barcode_alipay).

Example

  • Create a source with a public key

Retrieve a source

- GET https://api.omise.co/sources/{id}

Returns the source matching :id. Note: this verb accepts only secret key authentication.

Example

  • Retrieve a source with a secret key