پرش به مطلب اصلی

واریزیار — API توسعه‌دهنده (1.0.0)

Download OpenAPI specification:Download

پرداخت کارت‌به‌کارت با تأیید خودکار. جریان: ایجاد پرداخت → هدایت مشتری به checkoutUrl → بازگشت به callbackUrlverify. همه‌ی مبالغ به ریال و به‌صورت رشته هستند. وب‌هوک‌ها امضاشده‌اند.

payments

ایجاد و پیگیری پرداخت (با کلید API)

ایجاد پرداخت

یک کارت از کارت‌های پروژه انتخاب و (در حالت مبلغ یکتا) کدی به مبلغ اضافه می‌شود. مشتری را به checkoutUrl هدایت کنید. اگر کارتی در دسترس نباشد 503 و اگر اعتبار فروشنده تمام شده باشد 402 برمی‌گردد.

Authorizations:
apiKey
Request Body schema: application/json
required
required
integer or string
callbackUrl
required
string <uri> <= 2048 characters
orderId
string [ 1 .. 64 ] characters
description
string <= 300 characters
payerPhone
string [ 10 .. 20 ] characters
object

Responses

Request samples

Content type
application/json
{}

Response samples

Content type
application/json
{
  • "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
  • "status": "pending",
  • "amountRequested": "1014320",
  • "amountFinal": "1014320",
  • "code": 0,
  • "amountMode": "unique_code",
  • "orderId": "string",
  • "description": "string",
  • "callbackUrl": "http://example.com",
  • "checkoutUrl": "http://example.com",
  • "token": "string",
  • "reviewRequired": true,
  • "reviewReason": "string",
  • "confirmationSource": "auto_sms",
  • "confirmedAt": "2019-08-24T14:15:22Z",
  • "verifiedAt": "2019-08-24T14:15:22Z",
  • "verifyCount": 0,
  • "expiresAt": "2019-08-24T14:15:22Z",
  • "payerPhone": "string",
  • "payerCardLast4": "string",
  • "payerTrackingNumber": "string",
  • "payerReportedPaidAt": "2019-08-24T14:15:22Z",
  • "metadata": { },
  • "sandbox": true,
  • "createdAt": "2019-08-24T14:15:22Z",
  • "updatedAt": "2019-08-24T14:15:22Z"
}

فهرست پرداخت‌های پروژه

Authorizations:
apiKey
query Parameters
status
string
Enum: "pending" "confirmed" "expired" "rejected" "canceled"
orderId
string
from
string <date-time>
to
string <date-time>
page
integer
Default: 1
pageSize
integer <= 100
Default: 20

Responses

Response samples

Content type
application/json
{
  • "items": [
    ],
  • "page": 0,
  • "pageSize": 0,
  • "total": 0
}

وضعیت یک پرداخت

Authorizations:
apiKey
path Parameters
paymentId
required
string <uuid>

Responses

Response samples

Content type
application/json
{
  • "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
  • "status": "pending",
  • "amountRequested": "1014320",
  • "amountFinal": "1014320",
  • "code": 0,
  • "amountMode": "unique_code",
  • "orderId": "string",
  • "description": "string",
  • "callbackUrl": "http://example.com",
  • "checkoutUrl": "http://example.com",
  • "token": "string",
  • "reviewRequired": true,
  • "reviewReason": "string",
  • "confirmationSource": "auto_sms",
  • "confirmedAt": "2019-08-24T14:15:22Z",
  • "verifiedAt": "2019-08-24T14:15:22Z",
  • "verifyCount": 0,
  • "expiresAt": "2019-08-24T14:15:22Z",
  • "payerPhone": "string",
  • "payerCardLast4": "string",
  • "payerTrackingNumber": "string",
  • "payerReportedPaidAt": "2019-08-24T14:15:22Z",
  • "metadata": { },
  • "sandbox": true,
  • "createdAt": "2019-08-24T14:15:22Z",
  • "updatedAt": "2019-08-24T14:15:22Z"
}

تأیید نهایی (verify)

بعد از بازگشت مشتری یا دریافت وب‌هوک، حتماً صدا بزنید. idempotent است. فقط وقتی verified: true است سفارش را تحویل دهید.

Authorizations:
apiKey
path Parameters
paymentId
required
string <uuid>

Responses

Response samples

Content type
application/json
{
  • "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
  • "status": "pending",
  • "verified": true,
  • "alreadyVerified": true,
  • "orderId": "string",
  • "amountRequested": "1014320",
  • "amountFinal": "1014320",
  • "confirmedAt": "2019-08-24T14:15:22Z",
  • "confirmationSource": "auto_sms",
  • "payerCardLast4": "string",
  • "sandbox": true
}

sandbox

شبیه‌سازی واریز برای پروژه‌های آزمایشی

شبیه‌سازی واریز (فقط کلید تست)

برای پروژه‌ی آزمایشی، به‌جای پیامک واقعی یک واریزی شبیه‌سازی می‌شود و همان موتور تطبیق اجرا می‌شود. outcome: match (تأیید)، base_amount (مبلغ بدون کد → نامشخص)، wrong_amount، custom (با amount).

Authorizations:
apiKey
Request Body schema: application/json
required
paymentId
string <uuid> ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA...
token
string [ 10 .. 64 ] characters
outcome
string
Default: "match"
Enum: "match" "base_amount" "wrong_amount" "custom"
integer or string
payerCardLast4
string^\d{4}$

Responses

Request samples

Content type
application/json
{
  • "paymentId": "01a0acf1-e835-7ed7-91e8-f25a128276f3",
  • "outcome": "match"
}

Response samples

Content type
application/json
{
  • "simulatedAmount": "1014320",
  • "bankMessage": {
    },
  • "payment": {
    }
}

checkout

endpointهای عمومی صفحه‌ی پرداخت (بدون کلید)

نمای صفحه‌ی پرداخت

path Parameters
token
required
string

Responses

Response samples

Content type
application/json
{
  • "token": "string",
  • "status": "pending",
  • "amountRequested": "1014320",
  • "amountFinal": "1014320",
  • "amountMode": "unique_code",
  • "displayUnit": "toman",
  • "autoConfirm": true,
  • "description": "string",
  • "orderId": "string",
  • "expiresAt": "2019-08-24T14:15:22Z",
  • "remainingSeconds": 0,
  • "callbackUrl": "string",
  • "payerReportedPaidAt": "2019-08-24T14:15:22Z",
  • "confirmedAt": "2019-08-24T14:15:22Z",
  • "receiptCode": "string",
  • "sandbox": true,
  • "card": {
    },
  • "project": {
    },
  • "link": {
    }
}

پرداخت‌کننده اعلام می‌کند واریز کرده

path Parameters
token
required
string
Request Body schema: application/json
payerCardLast4
string^[0-9۰-۹]{4}$
payerTrackingNumber
string <= 40 characters
payerPhone
string [ 10 .. 20 ] characters

Responses

Request samples

Content type
application/json
{
  • "payerCardLast4": "string",
  • "payerTrackingNumber": "string",
  • "payerPhone": "stringstri"
}

Response samples

Content type
application/json
{
  • "token": "string",
  • "status": "pending",
  • "amountRequested": "1014320",
  • "amountFinal": "1014320",
  • "amountMode": "unique_code",
  • "displayUnit": "toman",
  • "autoConfirm": true,
  • "description": "string",
  • "orderId": "string",
  • "expiresAt": "2019-08-24T14:15:22Z",
  • "remainingSeconds": 0,
  • "callbackUrl": "string",
  • "payerReportedPaidAt": "2019-08-24T14:15:22Z",
  • "confirmedAt": "2019-08-24T14:15:22Z",
  • "receiptCode": "string",
  • "sandbox": true,
  • "card": {
    },
  • "project": {
    },
  • "link": {
    }
}

انصراف پرداخت‌کننده

path Parameters
token
required
string

Responses

Response samples

Content type
application/json
{
  • "token": "string",
  • "status": "pending",
  • "amountRequested": "1014320",
  • "amountFinal": "1014320",
  • "amountMode": "unique_code",
  • "displayUnit": "toman",
  • "autoConfirm": true,
  • "description": "string",
  • "orderId": "string",
  • "expiresAt": "2019-08-24T14:15:22Z",
  • "remainingSeconds": 0,
  • "callbackUrl": "string",
  • "payerReportedPaidAt": "2019-08-24T14:15:22Z",
  • "confirmedAt": "2019-08-24T14:15:22Z",
  • "receiptCode": "string",
  • "sandbox": true,
  • "card": {
    },
  • "project": {
    },
  • "link": {
    }
}

اطلاعات لینک پرداخت

path Parameters
slug
required
string

Responses

ایجاد پرداخت از لینک

path Parameters
slug
required
string
Request Body schema: application/json
integer or string
payerPhone
string [ 10 .. 20 ] characters
description
string <= 200 characters

Responses

Request samples

Content type
application/json
{
  • "amount": 0,
  • "payerPhone": "stringstri",
  • "description": "string"
}

Response samples

Content type
application/json
{
  • "token": "string",
  • "checkoutUrl": "string",
  • "amountFinal": "1014320",
  • "expiresAt": "2019-08-24T14:15:22Z"
}

webhooks

رویدادهایی که به سرور شما POST می‌شوند

رویداد وب‌هوک (به سرور شما ارسال می‌شود)

هدرها: X-Varizyar-Event، X-Varizyar-Delivery، X-Varizyar-Signature: t=<unix>,v1=<hmac-sha256(secret, "t.body")>. امضا را با secret وب‌هوک بررسی و به timestamp قدیمی‌تر از ۵ دقیقه اعتماد نکنید. با 2xx پاسخ دهید؛ در غیر این صورت تا ۱۰ بار با فاصله‌ی افزایشی تکرار می‌شود.

Request Body schema: application/json
required
event
required
string
Enum: "payment.confirmed" "payment.expired" "payment.rejected" "payment.canceled"
paymentId
required
string <uuid>
status
required
string
Enum: "pending" "confirmed" "expired" "rejected" "canceled"
string or null
amountRequested
string^\d+$

مبلغ به ریال، به‌صورت رشته (JSON نمی‌تواند عدد بزرگ حمل کند)

amountFinal
string^\d+$

مبلغ به ریال، به‌صورت رشته (JSON نمی‌تواند عدد بزرگ حمل کند)

string or null
string or null
sandbox
boolean
object or null
reason
string

فقط برای payment.rejected

deliveryId
required
string <uuid>
sentAt
required
string <date-time>

Responses

Request samples

Content type
application/json
{
  • "event": "payment.confirmed",
  • "paymentId": "472e651e-5a1e-424d-8098-23858bf03ad7",
  • "status": "pending",
  • "orderId": "string",
  • "amountRequested": "1014320",
  • "amountFinal": "1014320",
  • "confirmedAt": "2019-08-24T14:15:22Z",
  • "confirmationSource": "string",
  • "sandbox": true,
  • "metadata": { },
  • "reason": "string",
  • "deliveryId": "73dc828d-801d-4d29-b7e4-e046662a5901",
  • "sentAt": "2019-08-24T14:15:22Z"
}