Payments

Track payments from external payment providers. When a payment is confirmed via webhook, the system automatically generates a receipt.

Providers

ProviderCode
Kasikorn BankKBANK
SCB BankSCB
Bangkok BankBBL
Krungthai BankKTB

Payment Statuses

StatusMeaning
NOT_SENTPayment created, not yet sent to provider
SUBMITTINGBeing sent to provider
PENDINGAwaiting provider confirmation
SUCCEEDEDPayment confirmed by provider
FAILED_TECHNICALTechnical failure
FAILED_BUSINESSBusiness-rule failure (e.g. insufficient funds)
EXPIREDPayment window expired

POST /api/v1/payments

Register a new payment.

POST /api/v1/payments

Headers

HeaderRequiredDescription
X-API-KeyYour API key
X-Idempotency-KeyUnique key per request
Content-Typeapplication/json

Request Body

FieldTypeRequiredNotes
sourceIdstringYour source code
sourcePaymentIdstringYour unique payment ID (max 128 chars)
amountnumberPositive number
currencystring3 uppercase letters (e.g. THB)
providerenumPayment provider code. Uses source default if omitted
descriptionstringMax 255 chars
metadataobjectFree-form key-value

Example

curl -X POST https://dev-etax.siamprop.app/api/v1/payments \
  -H "X-API-Key: sk_etax_your_key" \
  -H "X-Idempotency-Key: idem-pay-2026-001" \
  -H "Content-Type: application/json" \
  -d '{
    "sourceId": "TESTSRC",
    "sourcePaymentId": "PAY-ORDER-12345",
    "amount": 1070,
    "currency": "THB",
    "description": "Order #12345",
    "metadata": { "orderId": "12345" }
  }'

Response — 202 Accepted

{
  "id": "cmmje4qjf000lou0k06atfrsi",
  "sourcePaymentId": "PAY-ORDER-12345",
  "provider": "KBANK",
  "amount": 1070,
  "currency": "THB",
  "providerStatus": "NOT_SENT"
}

Error Cases

errorCodeHTTPCause
DUPLICATE_PAYMENT409sourcePaymentId already exists
PAYMENT_PROVIDER_NOT_CONFIGURED422No provider configured for source
PAYMENT_PROVIDER_NOT_ALLOWED422Specified provider is not enabled for this source
UNSUPPORTED_PAYMENT_PROVIDER422Specified provider code is not recognized

GET /api/v1/payments/:id

GET /api/v1/payments/{paymentId}?sourceId=TESTSRC

Example

curl "https://dev-etax.siamprop.app/api/v1/payments/cmmje4qjf000lou0k06atfrsi?sourceId=TESTSRC" \
  -H "X-API-Key: sk_etax_your_key"

GET /api/v1/payments

List payments.

GET /api/v1/payments?sourceId=TESTSRC&page=1&limit=20
ParameterRequiredDefaultDescription
sourceIdYour source code
providerallFilter by provider
statusallFilter by providerStatus
sourcePaymentIdFilter by your payment ID
page1
limit20Max 100