Lewati ke konten utama

Create Transaction

Membuat transaksi pembayaran baru. Response bervariasi tergantung channel_code yang dipilih.

POST /transaction/create


Request

Headers

Authorization: Bearer sk_live_xxxxxxx
Content-Type: application/json
Accept: application/json

Body Parameters

ParameterTypeRequiredKeterangan
reference_idstringID referensi unik dari sistem Anda (maks 50 karakter)
amountintegerJumlah pembayaran dalam Rupiah (min: 10000)
customer_namestringNama pelanggan
customer_emailstringEmail pelanggan (format valid)
customer_phonestringNomor telepon pelanggan
channel_codestringKode channel dari Payment Channels
return_urlstringURL redirect setelah pembayaran selesai

Contoh per Channel

E-Wallet (DANA)

Request:

curl -X POST https://paymenku.com/api/v1/transaction/create \
-H "Authorization: Bearer sk_live_xxxxxxx" \
-H "Content-Type: application/json" \
-d '{
"reference_id": "INV-001",
"amount": 100000,
"customer_name": "John Doe",
"customer_email": "john@example.com",
"customer_phone": "08123456789",
"channel_code": "dana",
"return_url": "https://toko-anda.com/success"
}'

Response 200 OK:

{
"status": "success",
"data": {
"trx_id": "IDP202602271040123456",
"amount": "100000.00",
"status": "pending",
"pay_url": "https://paymenku.com/pay/IDP202602271040123456",
"payment_info": {
"transaction_status": "pending",
"checkout_url": "https://ewallet-service.example.com/checkout/...",
"expiration_date": "2026-01-18T03:55:10+00:00"
}
}
}

QRIS

Request:

curl -X POST https://paymenku.com/api/v1/transaction/create \
-H "Authorization: Bearer sk_live_xxxxxxx" \
-H "Content-Type: application/json" \
-d '{
"reference_id": "INV-002",
"amount": 100000,
"customer_name": "John Doe",
"customer_email": "john@example.com",
"customer_phone": "08123456789",
"channel_code": "qris",
"return_url": "https://toko-anda.com/success"
}'

Response 200 OK:

{
"status": "success",
"data": {
"trx_id": "IDP202602271042567890",
"amount": "100700.00",
"status": "pending",
"pay_url": "https://paymenku.com/pay/IDP202602271042567890",
"payment_info": {
"qr_url": "https://paymenku.com/api/qr/IDP202602271042567890",
"qr_string": "00020101021226680016COM.NOBUBANK...",
"expiration_date": "2026-01-19T03:42:39Z"
}
}
}

Virtual Account (BCA)

Request:

curl -X POST https://paymenku.com/api/v1/transaction/create \
-H "Authorization: Bearer sk_live_xxxxxxx" \
-H "Content-Type: application/json" \
-d '{
"reference_id": "INV-003",
"amount": 100000,
"customer_name": "John Doe",
"customer_email": "john@example.com",
"customer_phone": "08123456789",
"channel_code": "bca_va",
"return_url": "https://toko-anda.com/success"
}'

Response 200 OK:

{
"status": "success",
"data": {
"trx_id": "IDP202602271039768990",
"amount": "104000.00",
"status": "pending",
"pay_url": "https://paymenku.com/pay/IDP202602271039768990",
"payment_info": {
"bank": "BCA",
"va_number": "381659999814525",
"expiration_date": "2026-01-19T03:43:30.000Z"
}
}
}

Response Fields

FieldTypeKeterangan
trx_idstringID transaksi unik dari Paymenku
amountstringTotal yang harus dibayar (termasuk fee)
statusstringStatus awal: selalu pending
pay_urlstringURL halaman pembayaran Paymenku
payment_infoobjectDetail pembayaran (bervariasi per channel)

Payment Info — Virtual Account

FieldTypeKeterangan
bankstringNama bank
va_numberstringNomor Virtual Account untuk transfer
expiration_datestringWaktu kadaluarsa (ISO 8601)

Payment Info — E-Wallet

FieldTypeKeterangan
transaction_statusstringStatus di provider e-wallet
checkout_urlstringURL redirect ke aplikasi e-wallet
expiration_datestringWaktu kadaluarsa (ISO 8601)

Payment Info — QRIS

FieldTypeKeterangan
qr_urlstringURL gambar QR code (PNG)
qr_stringstringRaw QRIS string untuk generate QR sendiri
expiration_datestringWaktu kadaluarsa (ISO 8601)

Catatan Penting

:::warning Perhatian

  • amount di response sudah termasuk fee. Ini adalah jumlah yang harus dibayar pelanggan.
  • reference_id harus unik per transaksi. Duplikasi akan menghasilkan error.
  • Transaksi yang tidak dibayar akan otomatis expired setelah waktu yang ditentukan. :::

Error Response

Lihat Error Codes untuk daftar lengkap error yang mungkin terjadi.

{
"status": "error",
"message": "The reference_id has already been taken."
}