/merchant/payment-links
Idempotentowner · managerสิทธิ์ (scope) ของ API key: payment_links:writeสร้างลิงก์ชำระเงิน
สร้างลิงก์ชำระเงินของร้านหนึ่งของคุณ และคืนลิงก์พร้อม URL หน้า checkout (pay_url) เลือกช่องทางชำระ จำกัดจำนวนครั้งและวันหมดอายุได้ และใส่รายการสินค้าได้สูงสุด 100 รายการ
API key ที่ผูกกับร้านเดียวเรียกได้เฉพาะข้อมูลของร้านนั้น
พารามิเตอร์
| ชื่อ | ตำแหน่ง | ชนิด | จำเป็น | คำอธิบาย |
|---|---|---|---|---|
store_id | body | string | จำเป็น | Your store the link belongs to (ULID). |
title | body | string | จำเป็น | Shown to the payer. 2–255 chars. |
amount | body | number | จำเป็น | Baht, up to 2 decimals. 1 – 99,999,999. With items, must equal their sum. |
channels_enabled | body | string[] | จำเป็น | At least one of: promptpay, visa, mastercard, jcb, amex, truemoney, linepay, installment, crypto, transfer. |
currency | body | string | ไม่บังคับ | ISO 4217, max 3 chars. Default THB. |
description | body | string | ไม่บังคับ | Longer text on the checkout page. |
items | body | object[] | ไม่บังคับ | Up to 100 lines of { name, quantity, unit_price, product_id?, sku?, image_url? }. |
max_uses | body | integer | ไม่บังคับ | Successful payments allowed before the link closes. Omit for unlimited. |
expires_in_hours | body | integer | ไม่บังคับ | 1–8760. Or send expires_at (ISO 8601). |
return_url | body | string | ไม่บังคับ | Where the payer goes after paying. |
reference | body | string | ไม่บังคับ | Your own order id, max 255 chars. |
ตัวอย่างโค้ด
curl -X POST https://api-sandbox.paydy.ai/v1/merchant/payment-links \
-H "Authorization: Bearer $PAYDY_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: idem_createpaymentlink_001" \
-d '{
"store_id": "01JQ8V0STORE00000000000001",
"title": "WINMAX Order #10428",
"amount": 1290,
"channels_enabled": [
"promptpay",
"visa",
"mastercard"
],
"expires_in_hours": 24,
"reference": "ORD-2026-10428"
}'ตัวอย่างผลลัพธ์201
{
"success": true,
"data": {
"id": "01JQ8VXKP3R2M4N5Q6S7T8U9V0",
"store_id": "01JQ8V0STORE00000000000001",
"title": "WINMAX Order #10428",
"amount": 1290,
"currency": "THB",
"slug": "wm10428",
"status": "active",
"channels_enabled": [
"promptpay",
"visa",
"mastercard"
],
"max_uses": null,
"used_count": 0,
"reference": "ORD-2026-10428",
"expires_at": "2026-10-15T09:12:44.000Z",
"items": [],
"item_summary": null,
"pay_url": "https://paydy.ai/pay/wm10428",
"created_at": "2026-10-14T09:12:44.000Z"
}
}