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

Create a charge with chain

Create a charge with a destination parameter to enable marketplace payment splitting. This creates a chain linking the charge to an automatic transfer to a recipient.


๐Ÿ”‘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: 1 (smallest unit), Maximum: Varies by payment method and currency
`currency`STRING(required)
ISO 4217 three-letter currency code in lowercase.
Example:"thb"
Values:thb, jpy, sgd, myr, usd
`destination`STRING(required)
Recipient ID to receive automatic transfer after charge succeeds. Required for marketplace payment splitting.
Example:"recp_test_5xuy4w91xqz7d1w9u0t"
Required - 1 of 3 fieldsPayment Method (one required)
โ–ผ
`card`STRING(optional)
Token ID from Omise.js (e.g., tokn_test_...) or card ID from a customer (e.g., card_test_...). Required if customer and source not provided.
Example:"tokn_test_5xuy4w91xqz7d1w9u0t"
`source`STRING(optional)
Source ID for alternative payment methods like PromptPay, mobile banking, or QR codes. Required if card and customer not provided.
Example:"src_test_5xuy4w91xqz7d1w9u0t"
`customer`STRING(optional)
Customer ID. Will charge the customer's default card. Can be combined with card to specify a specific card. Required if card and source not provided.
Example:"cust_test_5xuy4w91xqz7d1w9u0t"
Recommended - 2 fieldsRecommended Parameters
Additional - 1 fieldAdditional Parameters

Responsesโ€‹

200

Successful transaction

Charge with chain created successfully. An automatic transfer will be created to the destination recipient after the charge succeeds.

Response includes:
  • destination - Recipient ID for the automatic transfer
  • chain - Chain ID linking the charge to transfer
  • platform_fee - Platform commission details
  • status - Charge status (successful, pending, failed, etc.)

400

Bad request

Request validation failed. Check the error message for details.

Common causes:
  • Missing required fields (amount, currency, destination)
  • Invalid currency code
  • No payment method provided (card, source, or customer)
  • Invalid destination recipient ID

401

Unauthorized

Authentication failed. Invalid or missing API key.

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

Code samplesโ€‹

curl https://api.omise.co/charges \
-u skey_test_5xuy4w91xqz7d1w9u0t: \
-d "amount=100000" \
-d "currency=thb" \
-d "card=tokn_test_5xuy4w91xqz7d1w9u0t" \
-d "destination=recp_test_5xuy4w91xqz7d1w9u0t"

Error and result codesโ€‹

Common Error Codesโ€‹

CodeDescriptionResolution
bad_requestMissing or invalid parametersCheck all required fields are provided
authentication_failureInvalid API keyVerify your secret key is correct
invalid_recipientInvalid destination recipient IDVerify recipient exists and is active
recipient_not_verifiedRecipient not verifiedRecipient must be verified before receiving transfers

Charge Status Codesโ€‹

StatusDescription
successfulPayment completed successfully
pendingAwaiting customer action (e.g., scan QR code)
failedPayment failed (see failure_code)
reversedCharge cancelled/reversed
expiredCharge expired before payment

Try it outโ€‹

Required - 3 fields
โ–ผ
Required - 1 of 3Payment Method (1 required)
โ–ผ
Recommended - 2 fields
Additional - 1 fields