Create a payment
POST /v1/paymentsCredential: secret key.
| Parameter | Type | Required | Description |
|---|---|---|---|
amount | string | Yes | Price in USD with up to 2 decimals, from "0.50" to "1000000" |
payment_id | string | Yes | Your reference (1–128 characters), unique per mode. Makes the request idempotent. |
currency | string | No | Only "USD" (default) |
expires_in | integer | No | Seconds the payer can start paying, from 300 to 604800 (7 days). Default: your payment defaults (60 minutes unless changed). |
description | string | No | Shown to the payer, up to 500 characters |
success_url | string | No | Where the hosted page sends the payer after paying |
cancel_url | string | No | Where the hosted page sends a payer who leaves |
metadata | object | No | Up to 20 string keys, values up to 500 characters. Never shown to the payer. |
fee_payer | string | No | merchant (fees come out of what you receive) or payer (a processing fee is added to what the payer sends). Default: your payment defaults. |
max_conversion_bps | integer | No | Maximum conversion cost in basis points, 10–500 (0.1%–5%). Default: your payment defaults. |
underpay_tolerance | string | No | Shortfall in USD that still counts as paid, up to "1000". Default: your payment defaults. |
token | string | No | With network: also issue a deposit address for this method (headless) |
network | string | No | With token |
Example
Section titled “Example”curl https://api.unizpay.com/v1/payments \ -H "Authorization: Bearer $UNIZPAY_SECRET_KEY" \ -H "Content-Type: application/json" \ -d '{ "amount": "25.00", "payment_id": "order_1001", "description": "Order #1001", "success_url": "https://shop.example.com/orders/1001", "metadata": { "customer_id": "c_123" } }'const res = await fetch("https://api.unizpay.com/v1/payments", { method: "POST", headers: { Authorization: `Bearer ${process.env.UNIZPAY_SECRET_KEY}`, "Content-Type": "application/json", }, body: JSON.stringify({ amount: "25.00", payment_id: "order_1001", description: "Order #1001", success_url: "https://shop.example.com/orders/1001", metadata: { customer_id: "c_123" }, }),});if (!res.ok) throw new Error((await res.json()).error.message);const payment = await res.json();res = requests.post( "https://api.unizpay.com/v1/payments", headers={"Authorization": f"Bearer {os.environ['UNIZPAY_SECRET_KEY']}"}, json={ "amount": "25.00", "payment_id": "order_1001", "description": "Order #1001", "success_url": "https://shop.example.com/orders/1001", "metadata": {"customer_id": "c_123"}, },)res.raise_for_status()payment = res.json()Response
Section titled “Response”201 with the payment object (200 when it already existed), plus:
| Field | Description |
|---|---|
methods | Every token and network the payment can be paid with: [{ "token", "network", "network_name" }] |
deposit_address | Only when token and network were sent: the issued deposit address |
Errors
Section titled “Errors”| Status | Code | When |
|---|---|---|
400 | invalid_request | A parameter is missing or invalid (param names it) |
409 | conflict | Payouts are not set for this mode, or payment_id was used with different details |
422 | method_unavailable | token/network can’t be paid to your payouts right now |