Coinland Payمستندات
مرجع API

جلسه‌های پرداخت

POST/api/pay/v1/sessions

این فراخوانی را از سمت سرور انجام دهید، بعد مشتری را به checkout_url بفرستید (یا id را به اسکریپت جای‌گذاری بدهید).

سفارش را به یکی از دو روش قیمت بگذارید — یا amounts بفرستید یا price_usd، نه هر دو و نه هیچ‌کدام (PAY_AMOUNT_INVALID، ۴۲۲):

  • amounts — خودتان مبلغ را در هر ارزی که می‌پذیرید تعیین می‌کنید و مشتری یکی را انتخاب می‌کند. کوین‌لند هیچ تبدیلی انجام نمی‌دهد: شما قیمت می‌گذارید، مشتری دقیقاً همان را می‌پردازد.
  • price_usd — یک عدد دلاری می‌دهید و کوین‌لند آن را در لحظه ساخت، با نرخ زنده، در همه ارزهای پذیرفته‌شده شما قیمت می‌گذارد. همین قیمت‌ها قفلِ نرخ هستند و مهلت خودِ جلسه (expires_at) بازه اعتبارشان است؛ تایمر جداگانه‌ای وجود ندارد. ارزی که نرخ زنده نداشته باشد کنار گذاشته می‌شود و اگر هیچ ارزی قابل قیمت‌گذاری نباشد درخواست با PAY_RATE_UNAVAILABLE (۵۰۳) رد می‌شود.

Authorization

bearerKey
AuthorizationBearer <token>

Authorization: Bearer clpay_live_<64 hex> for the checkout routes, Authorization: Bearer clpay_payout_<64 hex> for the payout routes. The wrong class on a route is PAY_WRONG_KEY_KIND (403).

A key may additionally carry an IP allowlist set in the business console. Empty (the default) places no restriction; with entries, a call from an unlisted address is UNAUTHORIZED (401).

In: header

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

application/json

application/json

curl -X POST "https://example.com/api/pay/v1/sessions" \  -H "Content-Type: application/json" \  -d '{    "reference_id": "string",    "title": "string",    "customer": {      "id": "string",      "name": "string",      "email": "string"    }  }'
{  "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",  "reference_id": "string",  "status": "open",  "title": "string",  "description": "string",  "amounts": [    {      "currency": "string",      "amount": "string",      "usd_value": "string"    }  ],  "pricing_mode": "usd",  "price_usd": "string",  "checkout_url": "http://example.com",  "return_url": "string",  "cancel_url": "string",  "metadata": {},  "payment": {    "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",    "receipt_no": "string",    "session_id": "1ffd059c-17ea-40a8-8aef-70fd0307db82",    "reference_id": "string",    "status": "completed",    "currency": "string",    "amount": "string",    "charged_amount": "string",    "fee_amount": "string",    "fee_bearer": "merchant",    "net_amount": "string",    "usd_value": "string",    "payer_id": "7bded2ff-6743-4a0e-a147-77540fb16606",    "metadata": {},    "receipt": "string",    "paid_at": "2019-08-24T14:15:22Z"  },  "expires_at": "2019-08-24T14:15:22Z",  "created_at": "2019-08-24T14:15:22Z"}
GET/api/pay/v1/sessions/{id}

وضعیت معتبر. وقتی جلسه تکمیل شده باشد، خلاصه پرداخت هم در پاسخ می‌آید.

Authorization

bearerKey
AuthorizationBearer <token>

Authorization: Bearer clpay_live_<64 hex> for the checkout routes, Authorization: Bearer clpay_payout_<64 hex> for the payout routes. The wrong class on a route is PAY_WRONG_KEY_KIND (403).

A key may additionally carry an IP allowlist set in the business console. Empty (the default) places no restriction; with entries, a call from an unlisted address is UNAUTHORIZED (401).

In: header

Path Parameters

id*string

شناسه جلسه (UUID) یا reference_id خودتان.

Response Body

application/json

application/json

curl -X GET "https://example.com/api/pay/v1/sessions/string"
{  "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",  "reference_id": "string",  "status": "open",  "title": "string",  "description": "string",  "amounts": [    {      "currency": "string",      "amount": "string",      "usd_value": "string"    }  ],  "pricing_mode": "usd",  "price_usd": "string",  "checkout_url": "http://example.com",  "return_url": "string",  "cancel_url": "string",  "metadata": {},  "payment": {    "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",    "receipt_no": "string",    "session_id": "1ffd059c-17ea-40a8-8aef-70fd0307db82",    "reference_id": "string",    "status": "completed",    "currency": "string",    "amount": "string",    "charged_amount": "string",    "fee_amount": "string",    "fee_bearer": "merchant",    "net_amount": "string",    "usd_value": "string",    "payer_id": "7bded2ff-6743-4a0e-a147-77540fb16606",    "metadata": {},    "receipt": "string",    "paid_at": "2019-08-24T14:15:22Z"  },  "expires_at": "2019-08-24T14:15:22Z",  "created_at": "2019-08-24T14:15:22Z"}
POST/api/pay/v1/sessions/{id}/cancel

ایدمپوتنت — لغو یک جلسه لغوشده همان جلسه را بدون تغییر برمی‌گرداند. جلسه تکمیل‌شده قابل لغو نیست (PAY_SESSION_STATE، ۴۰۹): پولی که جابه‌جا شده جابه‌جا می‌مانَد.

Authorization

bearerKey
AuthorizationBearer <token>

Authorization: Bearer clpay_live_<64 hex> for the checkout routes, Authorization: Bearer clpay_payout_<64 hex> for the payout routes. The wrong class on a route is PAY_WRONG_KEY_KIND (403).

A key may additionally carry an IP allowlist set in the business console. Empty (the default) places no restriction; with entries, a call from an unlisted address is UNAUTHORIZED (401).

In: header

Path Parameters

id*string

شناسه جلسه (UUID) یا reference_id خودتان.

Response Body

application/json

application/json

curl -X POST "https://example.com/api/pay/v1/sessions/string/cancel"
{  "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",  "reference_id": "string",  "status": "open",  "title": "string",  "description": "string",  "amounts": [    {      "currency": "string",      "amount": "string",      "usd_value": "string"    }  ],  "pricing_mode": "usd",  "price_usd": "string",  "checkout_url": "http://example.com",  "return_url": "string",  "cancel_url": "string",  "metadata": {},  "payment": {    "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",    "receipt_no": "string",    "session_id": "1ffd059c-17ea-40a8-8aef-70fd0307db82",    "reference_id": "string",    "status": "completed",    "currency": "string",    "amount": "string",    "charged_amount": "string",    "fee_amount": "string",    "fee_bearer": "merchant",    "net_amount": "string",    "usd_value": "string",    "payer_id": "7bded2ff-6743-4a0e-a147-77540fb16606",    "metadata": {},    "receipt": "string",    "paid_at": "2019-08-24T14:15:22Z"  },  "expires_at": "2019-08-24T14:15:22Z",  "created_at": "2019-08-24T14:15:22Z"}