Payment Links
API for creating links with individual pricing for specific products. Allows creating personalized payment links with unique prices and metadata.
Prerequisites
Important
You need to first create and configure a product in Mesilat platform personal cabinet before creating payment links.
Restriction
Payment links cannot be created for free products. Attempting to create a payment link for a free product (is_free = true) will result in a 422 error.
How to Get Product ID
Product ID can be obtained from the product editing page URL in browser:
Where :product_id is the product ID.
Payment Link Format
API response includes payment link in the following format:
Where:
- app.mesilat.com - platform domain
- alexsample - username/store name
- 141 - product ID
- uuid=d83dff3a - unique payment link identifier
This link leads to payment page where client can purchase the product at specified price.
Prefilling Customer Data
You can add URL parameters to prefill customer information on the payment page:
| Parameter | Description | Example |
|---|---|---|
email |
Customer email | [email protected] |
name |
Customer name | Sonya Miller |
phone_number |
Customer phone in international format (with + or 00 before country code) |
+35799123456 or 0035799123456 |
Example:
https://app.mesilat.com/alexsample/141?uuid=d83dff3a&[email protected]&name=Sonya%20Miller&phone_number=%2B35799123456
URL Encoding
Special characters (spaces, +, @, etc.) must be URL-encoded:
- Space →
%20 +→%2B@→%40
Most programming languages have built-in URL encoding functions.
Manual Link Construction Examples
const baseLink = 'https://app.mesilat.com/username/141?uuid=abc123';
const url = new URL(baseLink);
url.searchParams.set('email', '[email protected]');
url.searchParams.set('name', 'Sonya Miller');
url.searchParams.set('phone_number', '+35799123456');
const finalLink = url.toString();
// https://app.mesilat.com/username/141?uuid=abc123&email=sonya%40mesilat.com&name=Sonya+Miller&phone_number=%2B35799123456
$baseLink = 'https://app.mesilat.com/username/141?uuid=abc123';
$params = [
'email' => '[email protected]',
'name' => 'Sonya Miller',
'phone_number' => '+35799123456',
];
$finalLink = $baseLink . '&' . http_build_query($params);
// https://app.mesilat.com/username/141?uuid=abc123&email=sonya%40mesilat.com&name=Sonya+Miller&phone_number=%2B35799123456
from urllib.parse import urlencode
base_link = 'https://app.mesilat.com/username/141?uuid=abc123'
params = {
'email': '[email protected]',
'name': 'Sonya Miller',
'phone_number': '+35799123456'
}
final_link = f"{base_link}&{urlencode(params)}"
# https://app.mesilat.com/username/141?uuid=abc123&email=sonya%40mesilat.com&name=Sonya+Miller&phone_number=%2B35799123456
Interactive Link Generator
Generate Prefilled Payment Link
Authentication
All endpoints require API key in X-API-Key header.
Endpoints
Creating Payment Link
Creates a new payment link for a product.
POST /api/v1/creator/products/{product}/payment-links
URL Parameters
| Parameter | Type | Description |
|---|---|---|
product |
integer | Product ID |
Request Body
{
"prices": [
{
"currency_id": 3,
"price": 500.00,
"discount_price": 39.99,
"is_discount_price": true
},
{
"currency_id": 1,
"price": 5000.00,
"is_discount_price": false
}
],
"use_once": true,
"metadata": {
"order_id": "ORD-2025-789456",
"project_id": "proj_12345",
"customer_id": "cust_67890",
"campaign": "summer_sale_2025",
"utm_source": "google",
"utm_medium": "cpc",
"referral_code": "FRIEND2025",
"affiliate_id": "aff_999"
}
}
Request Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
prices |
array | Yes | Array of prices for different currencies. EUR (currency_id: 3) required, RUB (currency_id: 1) optional |
prices[].currency_id |
integer | Yes | Currency ID (1 - RUB, 3 - EUR). EUR required, RUB optional |
prices[].price |
number | No | Regular price. Required if is_discount_price = false |
prices[].discount_price |
number | No | Discount price. Required if is_discount_price = true |
prices[].is_discount_price |
boolean | Yes | Whether discount price is enabled. If true, regular price will be "crossed out" and discount price will be applied at purchase |
use_once |
boolean | No | Whether link can be used only once (default: false) |
metadata |
object | No | Additional metadata (order_id, name, shop_url, etc.). This data will be passed in webhook on successful payment |
Currency and Prices
Required:
- EUR price (currency_id: 3) required and must be specified in prices array
- RUB price (currency_id: 1) optional
Automatic Conversion: If RUB price is not provided, it will be automatically calculated using current exchange rate based on EUR price.
Manual RUB Price Setting:
You can provide your own RUB price by specifying it in prices array along with EUR. This is useful if you want to set fixed price in rubles or use your own conversion rate.
Response
200 OK
{
"uuid": "abc123def456",
"metadata": {
"order_id": "ORD-2025-789456",
"project_id": "proj_12345",
"customer_id": "cust_67890",
"campaign": "summer_sale_2025",
"utm_source": "google",
"utm_medium": "cpc",
"referral_code": "FRIEND2025",
"affiliate_id": "aff_999"
},
"use_once": true,
"payment_link": "https://app.mesilat.com/alexsample/141?uuid=abc123def456"
}
Errors
401 Unauthorized
{
"error": "API key is required",
"message": "Please provide a valid API key in the X-API-Key header"
}
422 Unprocessable Entity
Validation errors:
{
"message": "The given data was invalid.",
"errors": {
"prices": ["The prices field is required."],
"prices.0.currency_id": ["The currency_id field is required."]
}
}
Free product error:
{
"message": "Cannot create payment links for free products",
"errors": {
"error": ["Cannot create payment links for free products"]
}
}
Getting Payment Links List
Gets list of all payment links for a product.
GET /api/v1/creator/products/{product}/payment-links
URL Parameters
| Parameter | Type | Description |
|---|---|---|
product |
integer | Product ID |
Response
200 OK
{
"data": [
{
"id": 188,
"product_id": 141,
"is_discount_price": true,
"prices": [
"€20.00",
"100.00 ₽"
],
"payment_link": "https://app.mesilat.com/alexsample/141?uuid=4204b476",
"use_once": true,
"uuid": "4204b476"
},
{
"id": 191,
"product_id": 141,
"is_discount_price": true,
"prices": [
"€20.00",
"100.00 ₽"
],
"payment_link": "https://app.mesilat.com/alexsample/141?uuid=6172bef",
"use_once": true,
"uuid": "6172bef"
},
{
"id": 193,
"product_id": 141,
"is_discount_price": true,
"prices": [
"€20.00"
],
"payment_link": "https://app.mesilat.com/alexsample/141?uuid=4b6b387e",
"use_once": true,
"uuid": "4b6b387e"
}
],
"links": {
"first": "https://api.mesilat.com/api/v1/creator/products/141/payment-links?page=1",
"last": "https://api.mesilat.com/api/v1/creator/products/141/payment-links?page=1",
"prev": null,
"next": null
},
"meta": {
"current_page": 1,
"from": 1,
"last_page": 1,
"links": [
{
"url": null,
"label": "pagination.previous",
"active": false
},
{
"url": "https://api.mesilat.com/api/v1/creator/products/141/payment-links?page=1",
"label": "1",
"active": true
},
{
"url": null,
"label": "pagination.next",
"active": false
}
],
"path": "https://api.mesilat.com/api/v1/creator/products/141/payment-links",
"per_page": 15,
"to": 3,
"total": 3
}
}
Errors
401 Unauthorized
{
"error": "API key is required",
"message": "Please provide a valid API key in the X-API-Key header"
}
Deleting Payment Link
Deletes payment link.
DELETE /api/v1/creator/products/{product}/payment-links/{paymentLink}
URL Parameters
| Parameter | Type | Description |
|---|---|---|
product |
integer | Product ID |
paymentLink |
integer | Payment link ID |
Response
204 No Content
Response body is empty.
Errors
401 Unauthorized
{
"error": "API key is required",
"message": "Please provide a valid API key in the X-API-Key header"
}
404 Not Found
Usage Examples
Creating Simple Payment Link
curl -X POST "https://api.mesilat.com/api/v1/creator/products/123/payment-links" \
-H "X-API-Key: your_api_key_here" \
-H "Content-Type: application/json" \
-d '{
"prices": [
{
"currency_id": 3,
"discount_price": 39.99,
"is_discount_price": true
},
{
"currency_id": 1,
"price": 5000.00,
"is_discount_price": false
}
],
"use_once": true,
"metadata": {
"order_id": "ORD-2025-789456",
"project_id": "proj_12345",
"customer_id": "cust_67890",
"campaign": "summer_sale_2025",
"utm_source": "google",
"utm_medium": "cpc",
"referral_code": "FRIEND2025",
"affiliate_id": "aff_999"
}
}'
Error Codes
| Code | Description |
|---|---|
| 200 | Successful request |
| 204 | Successful deletion (no content) |
| 401 | Invalid or missing API key |
| 404 | Resource not found |
| 422 | Data validation error |
| 500 | Internal server error |