GET
/v1/payments

Payment Status

Check the status of a payment after a QR code has been scanned. Payments are created automatically when you generate a QR code, and their status updates when the customer completes the payment.

Overview

When you generate a QR code, a payment record is automatically created with status "pending". After the customer scans the QR code and completes payment through their banking app, the payment status updates to "succeeded" or "failed". Use this endpoint to check payment status or list all payments.

Payment Status Flow:

  • pending - QR code generated, waiting for customer to scan and pay
  • succeeded - Customer completed payment via PromptPay
  • failed - Payment failed or QR code expired
  • expired - QR code expired before payment

How Payments Work

Payment Creation
Payments are created automatically when you generate QR codes

When you call POST /v1/qr-codes, a payment record is automatically created with the same amount and reference. The payment starts in "pending" status and updates when the customer completes payment.

You don't need to create payments manually - they're created automatically with each QR code.

Code Examples

Check Payment Status

Get details for a specific payment by ID

curl -X GET "https://api.altafinex.com/v1/payments/pay_1234567890abcdef" \
  -H "Authorization: Bearer YOUR_SECRET_KEY" \
  -H "Content-Type: application/json" \
  

List All Payments

List payments with optional filters (status, limit, offset)

curl -X GET "https://api.altafinex.com/v1/payments?limit=20&status=pending" \
  -H "Authorization: Bearer YOUR_SECRET_KEY" \
  -H "Content-Type: application/json" \
  

Response

Status Codes

200
Payment created successfully
400
Invalid request data
401
Authentication failed
402
Payment declined
409
Duplicate request (idempotency conflict)
Success Response
Example response for a successful request
{
  "payment_id": "pay_1234567890abcdef",
  "qr_code_id": "qr_1234567890abcdef",
  "status": "succeeded",
  "amount": 10000,
  "currency": "THB",
  "reference": "ORDER-12345",
  "created_at": "2024-01-15T10:30:00Z",
  "completed_at": "2024-01-15T10:32:15Z"
}
Error Response
Example response for an error
{
  "error": {
    "code": "insufficient_funds",
    "message": "The payment could not be processed",
    "type": "payment_error"
  }
}

Related Endpoints