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" \
-d '{
"amount": {
"default": 1000,
"currency": "RUB"
},
"amount_type": "fixed",
"pay_config": {
"methods": ["card"]
}
}'

Parameters

FieldTypeRequiredDescription
amountobjectAmount object
amount.defaultintegerAmount in the smallest currency unit (e.g. kopecks for RUB)
amount.currencystringISO 4217 currency code (e.g. "RUB", "USD")
amount_typestring"fixed" — payer sees fixed amount; "dynamic" — payer enters amount
pay_configobjectPayment configuration
pay_config.methodsarrayEnabled payment methods, e.g. ["card", "sbp"]
productsarrayArray of product UUIDs to attach to the link. Products must belong to the same partner. On update, replaces the current list entirely
imagestringImage 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" \
-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" \
-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"

GET /api/v1/links
curl https://4pay.online/api/v1/links \
-H "x-api-key: YOUR_API_KEY"

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" \
-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"

When someone pays via a link, you receive a webhook with type: "link":

{
"type": "link",
"link": "abc12345-...",
"txid": "generated-txid",
"id": "550e8400-...",
"status": "charged",
"amount": 1000,
"amount_dest": 950,
"amount_with_fee": 1050,
"error_description": ""
}

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" \
-d '{
"header": "Coffee",
"text": "Espresso 200ml",
"price": 350,
"currency": "RUB",
"qty": "1"
}'

Product parameters

FieldTypeRequiredDescription
headerstringProduct name shown on the payment page
textstringShort product description
priceintegerPrice in the smallest currency unit
currencystringISO 4217 currency code (default: "RUB")
qtystringQuantity (default: "1")
imagestringImage 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" \
-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.