Skip to main content
Version: 2019-05-29 (Current)

Create a Source

Create a payment source for alternative payment methods. Sources enable customers to pay via PromptPay QR codes, mobile banking, internet banking, installments, and more.


๐Ÿ”‘API Credentials

Request Parametersโ€‹

Required - 3 fieldsRequired Parameters
โ–ผ
`amount`INTEGER(required)
Amount in smallest currency unit (satangs for THB, cents for USD, yen for JPY). For example, 100000 satangs = 1,000 THB.
Example:100000
Constraints:Minimum: Varies by payment method, PromptPay minimum: 20 THB (2000 satangs)
`currency`STRING(required)
ISO 4217 three-letter currency code in lowercase. Must match the payment method type.
Example:"thb"
Values:thb, jpy, sgd, myr
`type`STRING(required)
Payment method type. Different types support different currencies.
Example:"promptpay"
Values:promptpay, paynow, alipay, alipay_cn, alipay_hk, dana, gcash, kakaopay, touch_n_go, boost, shopeepay, shopeepay_jumpapp, maybankqrpay, duitnow_qr, promptpay_credit, wechat_pay, rabbit_linepay, truemoney, fpx, mobile_banking_scb, mobile_banking_kbank, mobile_banking_bbl, mobile_banking_bay, mobile_banking_ktb, internet_banking_scb, internet_banking_bbl, internet_banking_bay, installment_bay, installment_first_choice, installment_bbl, installment_kbank, installment_ktc, installment_scb, installment_ttb, installment_uob, installment_mbb, installment_krungsri, econtext, payeasy, netbanking, paypay, atome
Recommended - 2 fieldsRecommended Parameters
Additional - 10 fieldsAdditional Parameters

Responsesโ€‹

200

Successful transaction

Source created successfully. The response includes payment-specific data like QR codes or redirect URLs.

Common response fields:
  • id - Source ID (src_*) to use when creating a charge
  • type - Payment method type
  • flow - Payment flow: offline (QR code), redirect (web), or app_redirect (mobile app)
  • amount - Source amount in smallest currency unit
  • currency - Currency code
  • scannable_code - QR code data for QR-based payments
  • charge_status - Status of any charge created with this source

400

Bad request

Request validation failed. Check the error message for details.

Common causes:
  • Missing required fields (amount, currency, type)
  • Invalid currency for payment type (e.g., SGD for PromptPay)
  • Missing type-specific required fields (e.g., installment_term for installments)
  • Invalid payment type

401

Unauthorized

Authentication failed. Invalid or missing API key.

Common causes:
  • Missing Authorization header
  • Invalid public key
  • Using secret key instead of public key
  • Incorrect HTTP Basic Auth format

422

Unprocessable entity

Request validation failed due to business logic constraints.

Common causes:
  • Amount below minimum for payment type
  • Amount above maximum for payment type
  • Payment type not enabled for your account
  • Invalid installment term for selected bank

Code samplesโ€‹

curl https://api.omise.co/sources \
-u pkey_test_5xuy4w91xqz7d1w9u0t: \
-d "amount=100000" \
-d "currency=thb" \
-d "type=promptpay"

Error and result codesโ€‹

Common Error Codesโ€‹

CodeDescriptionResolution
bad_requestMissing or invalid parametersCheck all required fields are provided
authentication_failureInvalid API keyVerify your public key is correct
currency_not_supportedCurrency not supported for payment typeCheck payment type supports your currency
amount_too_lowAmount below minimumCheck minimum amount for payment type
amount_too_highAmount exceeds maximumCheck maximum amount for payment type
payment_method_not_allowedPayment type not enabledContact Omise to enable payment method

Source Flow Typesโ€‹

FlowDescription
offlineCustomer scans QR code (PromptPay, Alipay)
redirectCustomer redirected to web page (Internet Banking)
app_redirectCustomer redirected to mobile app (Mobile Banking)

Try it outโ€‹

Required - 3 fields
โ–ผ
Recommended - 2 fields
Additional - 10 fields