Skip to main content

Payment Links & QR Codes

Payment links let you create reusable or one-time payment pages without writing any checkout UI. QR codes are generated from payment links and can be printed, embedded in emails, or shown on POS screens.


POST /api/v1/links
curl -X POST https://4pay.online/api/v1/links \
-H "Content-Type: application/json" \
-H "x-api-key: YOUR_API_KEY" \
-H "x-organization-id: 00000000-1111-2222-3333-444444444444" \
-d '{
"amount": {
"default": 1000,
"currency": "RUB"
},
"amount_type": "fixed",
"pay_config": {
"methods": ["card"]
}
}'

Parameters​

FieldTypeRequiredDescription
amountobject✓Amount object
amount.defaultinteger✓Amount in the smallest currency unit (e.g. kopecks for RUB)
amount.currencystring✓ISO 4217 currency code (e.g. "RUB", "USD")
amount_typestring✓"fixed" — payer sees fixed amount; "dynamic" — payer enters amount
pay_configobject✓Payment configuration
pay_config.methodsarray—Enabled payment methods, e.g. ["card", "sbp"]
productsarray—Array of product UUIDs to attach to the link. Products must belong to the same partner. On update, replaces the current list entirely
imagestring—Image URL obtained via POST /api/v1/images

Response​

{
"data": {
"id": "abc12345-0000-0000-0000-000000000000",
"created": "2026-03-01T10:00:00+00:00",
"partner_id": 42,
"amount": {
"default": 1000,
"currency": "RUB"
},
"amount_type": "fixed",
"pay_config": {
"methods": ["card"]
},
"image": null,
"products": []
}
}

Products and payment links have a many-to-many relationship. One link can contain multiple products, and one product can be attached to multiple links.

Step-by-step​

  1. Create products via POST /api/v1/products and save their id values
  2. Create a link with the products field containing an array of product UUIDs:
curl -X POST https://4pay.online/api/v1/links \
-H "Content-Type: application/json" \
-H "x-api-key: YOUR_API_KEY" \
-H "x-organization-id: 00000000-1111-2222-3333-444444444444" \
-d '{
"amount": { "default": 198000, "currency": "RUB" },
"amount_type": "fixed",
"pay_config": { "methods": ["card"] },
"products": [
"550e8400-e29b-41d4-a716-446655440000",
"660f9500-f39c-52e5-b827-557766551111"
]
}'
  1. The response returns products as an array of full product objects (with price, header, image, etc.)

Update product binding​

To change the attached products, pass a new UUID array in PATCH /api/v1/links/:id:

curl -X PATCH https://4pay.online/api/v1/links/abc12345-... \
-H "Content-Type: application/json" \
-H "x-api-key: YOUR_API_KEY" \
-H "x-organization-id: 00000000-1111-2222-3333-444444444444" \
-d '{ "products": ["550e8400-e29b-41d4-a716-446655440000"] }'

The products array fully replaces the current binding. To detach all products, send "products": [].

ScenarioResult
UUID not foundProduct is silently ignored
Empty array []Link with no products
products field omittedBinding unchanged (on update)

GET /api/v1/links/:id
curl https://4pay.online/api/v1/links/abc12345-... \
-H "x-api-key: YOUR_API_KEY" \
-H "x-organization-id: 00000000-1111-2222-3333-444444444444"

GET /api/v1/links
curl https://4pay.online/api/v1/links \
-H "x-api-key: YOUR_API_KEY" \
-H "x-organization-id: 00000000-1111-2222-3333-444444444444"

PATCH /api/v1/links/:id
curl -X PATCH https://4pay.online/api/v1/links/abc12345-... \
-H "Content-Type: application/json" \
-H "x-api-key: YOUR_API_KEY" \
-H "x-organization-id: 00000000-1111-2222-3333-444444444444" \
-d '{
"amount": {
"default": 2000,
"currency": "RUB"
}
}'

DELETE /api/v1/links/:id
curl -X DELETE https://4pay.online/api/v1/links/abc12345-... \
-H "x-api-key: YOUR_API_KEY" \
-H "x-organization-id: 00000000-1111-2222-3333-444444444444"

A link payment produces the same webhook as any other payment — there is no separate link event type:

{
"event_id": "4d9d0e6c-1d0a-4a2e-9a2f-0c9a1b0e8f21",
"timestamp": 1772668800,
"type": "transaction.charged",
"data": {
"type": "payment",
"txid": "generated-txid",
"id": "550e8400-...",
"status": "charged",
"amount": "1000",
"amount_dest": "950",
"amount_with_fee": "1050",
"error_description": ""
}
}

To find out which link was paid, read the transaction back with GET /api/v1/transactions/{id} — it carries link_id.


QR Code Products​

For retail or POS use cases, you can create products with QR codes that trigger a fixed-price payment flow:

POST /api/v1/products
curl -X POST https://4pay.online/api/v1/products \
-H "Content-Type: application/json" \
-H "x-api-key: YOUR_API_KEY" \
-H "x-organization-id: 00000000-1111-2222-3333-444444444444" \
-d '{
"header": "Coffee",
"text": "Espresso 200ml",
"price": 350,
"currency": "RUB",
"qty": "1"
}'

Product parameters​

FieldTypeRequiredDescription
headerstring✓Product name shown on the payment page
textstring✓Short product description
priceinteger—Price in the smallest currency unit
currencystring—ISO 4217 currency code (default: "RUB")
qtystring—Quantity (default: "1")
imagestring—Image URL obtained via POST /api/v1/images

Each product generates a dedicated QR code that can be printed and used indefinitely.


Upload an image​

Images for products and payment links are uploaded separately and then referenced by URL.

POST /api/v1/images
Content-Type: multipart/form-data
curl -X POST https://4pay.online/api/v1/images \
-H "x-api-key: YOUR_API_KEY" \
-H "x-organization-id: 00000000-1111-2222-3333-444444444444" \
-F "image=@photo.jpg"

Response​

{
"data": {
"url": "https://s3.example.com/images/uploads/42/1709472000000photo.jpg"
}
}

Use the returned url in the image field when creating or updating products and links.