Create Order
curl --request POST \
--url https://api.paytring.com/api/v2/order/create \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: application/json' \
--data '
{
"amount": 10000,
"currency": "INR",
"receipt_id": "DEMO202611030001",
"cname": "Test Customer",
"phone": "9999999999",
"email": "customer@example.com",
"callback_url": "https://merchant.example.com/payment/callback"
}
'import requests
url = "https://api.paytring.com/api/v2/order/create"
payload = {
"amount": 10000,
"currency": "INR",
"receipt_id": "DEMO202611030001",
"cname": "Test Customer",
"phone": "9999999999",
"email": "customer@example.com",
"callback_url": "https://merchant.example.com/payment/callback"
}
headers = {
"Authorization": "Basic <encoded-value>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Basic <encoded-value>', 'Content-Type': 'application/json'},
body: JSON.stringify({
amount: 10000,
currency: 'INR',
receipt_id: 'DEMO202611030001',
cname: 'Test Customer',
phone: '9999999999',
email: 'customer@example.com',
callback_url: 'https://merchant.example.com/payment/callback'
})
};
fetch('https://api.paytring.com/api/v2/order/create', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.paytring.com/api/v2/order/create",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'amount' => 10000,
'currency' => 'INR',
'receipt_id' => 'DEMO202611030001',
'cname' => 'Test Customer',
'phone' => '9999999999',
'email' => 'customer@example.com',
'callback_url' => 'https://merchant.example.com/payment/callback'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.paytring.com/api/v2/order/create"
payload := strings.NewReader("{\n \"amount\": 10000,\n \"currency\": \"INR\",\n \"receipt_id\": \"DEMO202611030001\",\n \"cname\": \"Test Customer\",\n \"phone\": \"9999999999\",\n \"email\": \"customer@example.com\",\n \"callback_url\": \"https://merchant.example.com/payment/callback\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Basic <encoded-value>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.paytring.com/api/v2/order/create")
.header("Authorization", "Basic <encoded-value>")
.header("Content-Type", "application/json")
.body("{\n \"amount\": 10000,\n \"currency\": \"INR\",\n \"receipt_id\": \"DEMO202611030001\",\n \"cname\": \"Test Customer\",\n \"phone\": \"9999999999\",\n \"email\": \"customer@example.com\",\n \"callback_url\": \"https://merchant.example.com/payment/callback\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.paytring.com/api/v2/order/create")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Basic <encoded-value>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"amount\": 10000,\n \"currency\": \"INR\",\n \"receipt_id\": \"DEMO202611030001\",\n \"cname\": \"Test Customer\",\n \"phone\": \"9999999999\",\n \"email\": \"customer@example.com\",\n \"callback_url\": \"https://merchant.example.com/payment/callback\"\n}"
response = http.request(request)
puts response.read_body{
"status": true,
"url": "aHR0cHM6Ly9jaGVja291dC5leGFtcGxlLmNvbS9vcmRlci8xMTExMTExMTExMTExMTEx",
"order_id": "1111111111111111"
}Paytring Checkout Payment
Create Order
Create a collection order using HTTP Basic Auth with your API key and secret. Omit key and hash from the JSON body. Business parameters and success responses are unchanged from V1; url is a Base64-encoded checkout URL.
POST
/
api
/
v2
/
order
/
create
Create Order
curl --request POST \
--url https://api.paytring.com/api/v2/order/create \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: application/json' \
--data '
{
"amount": 10000,
"currency": "INR",
"receipt_id": "DEMO202611030001",
"cname": "Test Customer",
"phone": "9999999999",
"email": "customer@example.com",
"callback_url": "https://merchant.example.com/payment/callback"
}
'import requests
url = "https://api.paytring.com/api/v2/order/create"
payload = {
"amount": 10000,
"currency": "INR",
"receipt_id": "DEMO202611030001",
"cname": "Test Customer",
"phone": "9999999999",
"email": "customer@example.com",
"callback_url": "https://merchant.example.com/payment/callback"
}
headers = {
"Authorization": "Basic <encoded-value>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Basic <encoded-value>', 'Content-Type': 'application/json'},
body: JSON.stringify({
amount: 10000,
currency: 'INR',
receipt_id: 'DEMO202611030001',
cname: 'Test Customer',
phone: '9999999999',
email: 'customer@example.com',
callback_url: 'https://merchant.example.com/payment/callback'
})
};
fetch('https://api.paytring.com/api/v2/order/create', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.paytring.com/api/v2/order/create",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'amount' => 10000,
'currency' => 'INR',
'receipt_id' => 'DEMO202611030001',
'cname' => 'Test Customer',
'phone' => '9999999999',
'email' => 'customer@example.com',
'callback_url' => 'https://merchant.example.com/payment/callback'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.paytring.com/api/v2/order/create"
payload := strings.NewReader("{\n \"amount\": 10000,\n \"currency\": \"INR\",\n \"receipt_id\": \"DEMO202611030001\",\n \"cname\": \"Test Customer\",\n \"phone\": \"9999999999\",\n \"email\": \"customer@example.com\",\n \"callback_url\": \"https://merchant.example.com/payment/callback\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Basic <encoded-value>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.paytring.com/api/v2/order/create")
.header("Authorization", "Basic <encoded-value>")
.header("Content-Type", "application/json")
.body("{\n \"amount\": 10000,\n \"currency\": \"INR\",\n \"receipt_id\": \"DEMO202611030001\",\n \"cname\": \"Test Customer\",\n \"phone\": \"9999999999\",\n \"email\": \"customer@example.com\",\n \"callback_url\": \"https://merchant.example.com/payment/callback\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.paytring.com/api/v2/order/create")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Basic <encoded-value>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"amount\": 10000,\n \"currency\": \"INR\",\n \"receipt_id\": \"DEMO202611030001\",\n \"cname\": \"Test Customer\",\n \"phone\": \"9999999999\",\n \"email\": \"customer@example.com\",\n \"callback_url\": \"https://merchant.example.com/payment/callback\"\n}"
response = http.request(request)
puts response.read_body{
"status": true,
"url": "aHR0cHM6Ly9jaGVja291dC5leGFtcGxlLmNvbS9vcmRlci8xMTExMTExMTExMTExMTEx",
"order_id": "1111111111111111"
}Create a collection order and receive a checkout URL. Authenticate with HTTP Basic Auth using your API key and secret. Do not include
If your integration already sends
key or hash in the request body.
Request example
amount is an integer in minor units. For INR, 10000 means INR 100.00. receipt_id is your alphanumeric order reference, and callback_url is the URL to return the customer to after checkout, not your webhook endpoint.
curl --request POST 'https://api.paytring.com/api/v2/order/create' \
--user "${PAYTRING_API_KEY}:${PAYTRING_API_SECRET}" \
--header 'Content-Type: application/json' \
--data '{
"amount": 10000,
"currency": "INR",
"receipt_id": "DEMO202611030001",
"cname": "Test Customer",
"phone": "9999999999",
"email": "customer@example.com",
"callback_url": "https://merchant.example.com/payment/callback"
}'
pg_pool_id, keep the existing valid pool ID as a string. It is optional and does not change when migrating from V1 to V2.
Success response
{
"status": true,
"url": "aHR0cHM6Ly9jaGVja291dC5leGFtcGxlLmNvbS9vcmRlci8xMTExMTExMTExMTExMTEx",
"order_id": "1111111111111111"
}
url is Base64-encoded. Decode the returned value before redirecting the customer. The URL above is an illustrative example, not a working checkout link. order_id is Paytring’s identifier and is distinct from your receipt_id.
Fetch the order using your receipt ID or the Paytring order ID. Check the fetched order_status before treating the order as paid. Creating an order does not mean the payment succeeded.
Errors
Check the response body’sstatus, not only the HTTP status code. Known validation and authentication errors can return HTTP 200 with status: false and an error object. Validation failures may also include field details in validation.
For V1 compatibility, credential reuse, and collection webhook considerations, see Migrating collection requests from V1.Authorizations
Body
application/json
Response
Inspect status. A successful create returns url and order_id. Known authentication and validation errors can also return HTTP 200 with status false and error.

