Create Payment Link
Create a hosted payment link and retain the returned order ID to track the transaction.
/create-orderRequest parameters
| Field | Type | Required | Description |
|---|---|---|---|
amount | number | Yes | Payment amount. Minimum 1. |
call_back_url | string | Yes | Public URL for server-to-server payment updates. |
gateway_id | integer | Yes | Valid gateway ID. See Get Gateway List. |
payment_link_expiry | string | Yes | YYYY-MM-DD HH:MM:SS. At least 25 minutes after the current server time. Timezone is unspecified. |
payment_for | string | Yes | Payment label or reason. Maximum 255 characters. |
customer | object | Yes | Payer information. |
customer.name | string | Yes | Full name. Maximum 100 characters. |
customer.email | string | Yes | Valid email address. |
customer.phone | string | Yes | 10–15 digits. |
mode | object | Yes | Explicitly set all four payment method flags. The sample labels this configuration Razorpay. |
mode.netbanking | boolean | Yes | Enable net banking. |
mode.card | boolean | Yes | Enable card payments. |
mode.upi | boolean | Yes | Enable UPI. |
mode.wallet | boolean | Yes | Enable wallets. |
redirection_url | string | No | Customer return URL. The gateway can use GET or POST. |
notification | object | No | Customer notification settings. |
notification.sms | boolean | No | Enable SMS notifications. |
notification.email | boolean | No | Enable email notifications. |
credit_card_only | boolean | Unspecified | The sample labels this PayU-specific. The collection provides no validation rules for it. |
Request examples
Complete request · cURL, PHP, Node.js, Python
cURL
curl --fail-with-body --request POST https://api.slpe.in/api/v2/create-order \
--header 'Accept: application/json' \
--header 'access-token: YOUR_ACCESS_TOKEN' \
--header 'api-key: YOUR_API_KEY' \
--header 'api-secret: YOUR_API_SECRET' \
--header 'api-mode: test' \
--header 'Content-Type: application/json' \
--data '{
"amount": 108,
"call_back_url": "https://merchant.example.com/slpe/webhook",
"redirection_url": "https://merchant.example.com/thank-you",
"gateway_id": 8,
"payment_link_expiry": "YYYY-MM-DD HH:MM:SS",
"payment_for": "Utility Payment",
"customer": {
"name": "Demo Customer",
"email": "customer@example.com",
"phone": "9000000001"
},
"mode": {
"netbanking": true,
"card": true,
"upi": true,
"wallet": true
},
"notification": {
"sms": true,
"email": true
}
}'PHP
<?php
$ch = curl_init('https://api.slpe.in/api/v2/create-order');
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_HTTPHEADER => [
'Accept: application/json',
'access-token: YOUR_ACCESS_TOKEN',
'api-key: YOUR_API_KEY',
'api-secret: YOUR_API_SECRET',
'api-mode: test',
'Content-Type: application/json',
],
CURLOPT_RETURNTRANSFER => true,
CURLOPT_TIMEOUT => 30,
CURLOPT_POSTFIELDS => <<<'JSON'
{
"amount": 108,
"call_back_url": "https://merchant.example.com/slpe/webhook",
"redirection_url": "https://merchant.example.com/thank-you",
"gateway_id": 8,
"payment_link_expiry": "YYYY-MM-DD HH:MM:SS",
"payment_for": "Utility Payment",
"customer": {
"name": "Demo Customer",
"email": "customer@example.com",
"phone": "9000000001"
},
"mode": {
"netbanking": true,
"card": true,
"upi": true,
"wallet": true
},
"notification": {
"sms": true,
"email": true
}
}
JSON,
]);
$response = curl_exec($ch);
if ($response === false) {
throw new RuntimeException(curl_error($ch));
}
$status = curl_getinfo($ch, CURLINFO_RESPONSE_CODE);
if ($status >= 400) {
throw new RuntimeException("HTTP $status: $response");
}
echo $response . PHP_EOL;Node.js
// Save as request.mjs and run with Node.js 18+.
const response = await fetch('https://api.slpe.in/api/v2/create-order', {
method: 'POST',
headers: {
'Accept': 'application/json',
'access-token': 'YOUR_ACCESS_TOKEN',
'api-key': 'YOUR_API_KEY',
'api-secret': 'YOUR_API_SECRET',
'api-mode': 'test',
'Content-Type': 'application/json',
},
body: JSON.stringify({
"amount": 108,
"call_back_url": "https://merchant.example.com/slpe/webhook",
"redirection_url": "https://merchant.example.com/thank-you",
"gateway_id": 8,
"payment_link_expiry": "YYYY-MM-DD HH:MM:SS",
"payment_for": "Utility Payment",
"customer": {
"name": "Demo Customer",
"email": "customer@example.com",
"phone": "9000000001"
},
"mode": {
"netbanking": true,
"card": true,
"upi": true,
"wallet": true
},
"notification": {
"sms": true,
"email": true
}
}),
});
const text = await response.text();
if (!response.ok) {
throw new Error(`HTTP ${response.status}: ${text}`);
}
console.log(JSON.parse(text));Python
import json
from urllib.error import HTTPError
from urllib.request import Request, urlopen
headers = {
'Accept': 'application/json',
'access-token': 'YOUR_ACCESS_TOKEN',
'api-key': 'YOUR_API_KEY',
'api-secret': 'YOUR_API_SECRET',
'api-mode': 'test',
'Content-Type': 'application/json',
}
payload = {'amount': 108,
'call_back_url': 'https://merchant.example.com/slpe/webhook',
'redirection_url': 'https://merchant.example.com/thank-you',
'gateway_id': 8,
'payment_link_expiry': 'YYYY-MM-DD HH:MM:SS',
'payment_for': 'Utility Payment',
'customer': {'name': 'Demo Customer',
'email': 'customer@example.com',
'phone': '9000000001'},
'mode': {'netbanking': True, 'card': True, 'upi': True, 'wallet': True},
'notification': {'sms': True, 'email': True}}
body = json.dumps(payload).encode("utf-8")
request = Request(
'https://api.slpe.in/api/v2/create-order',
data=body,
headers=headers,
method='POST',
)
try:
with urlopen(request, timeout=30) as response:
print(json.load(response))
except HTTPError as error:
details = error.read().decode("utf-8", errors="replace")
raise RuntimeError(f"HTTP {error.code}: {details}") from errorRequest body · JSON
{
"amount": 108,
"call_back_url": "https://merchant.example.com/slpe/webhook",
"redirection_url": "https://merchant.example.com/thank-you",
"gateway_id": 8,
"payment_link_expiry": "YYYY-MM-DD HH:MM:SS",
"payment_for": "Utility Payment",
"customer": {
"name": "Demo Customer",
"email": "customer@example.com",
"phone": "9000000001"
},
"mode": {
"netbanking": true,
"card": true,
"upi": true,
"wallet": true
},
"notification": {
"sms": true,
"email": true
}
}Response
payment_url is the hosted checkout URL. Save order_id to look up the payment.
HTTP 200 Create Payment Link · JSON
{
"result": true,
"message": "Payment link created successfully",
"payment_url": "https://api.slpe.in/PAYMENT_LINK",
"order_id": "ORDER_ID"
}