Skip to main content
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 '
{
  "key": "test_123",
  "amount": 100,
  "cname": "Jhon Doe",
  "phone": "9897969594",
  "receipt_id": "xx00011",
  "callback_url": "https://httpbin.org/post",
  "hash": "<string>",
  "email": "<string>",
  "currency": "INR",
  "billing_address": {
    "line1": "<string>",
    "line2": "<string>",
    "city": "<string>",
    "state": "<string>",
    "zipcode": 123,
    "country": "<string>",
    "phone": "<string>",
    "firstname": "<string>",
    "lastname": "<string>"
  },
  "shipping_address": {
    "line1": "<string>",
    "line2": "<string>",
    "city": "<string>",
    "state": "<string>",
    "zipcode": 123,
    "country": "<string>",
    "phone": "<string>",
    "firstname": "<string>",
    "lastname": "<string>"
  },
  "notes": {
    "udf1": "<string>",
    "udf2": "<string>",
    "udf3": "<string>",
    "udf4": "<string>",
    "udf5": "<string>"
  },
  "pg": "<string>",
  "pg_pool_id": "<string>",
  "tpv": [
    {
      "account_number": "<string>",
      "name": "<string>",
      "ifsc": "<string>"
    }
  ],
  "split_settlement": [
    {
      "vendor_id": "<string>",
      "amount": "<string>"
    }
  ],
  "split_type": "percent",
  "autocapture": "true"
}
'
import requests

url = "https://api.paytring.com/api/v2/order/create"

payload = {
"key": "test_123",
"amount": 100,
"cname": "Jhon Doe",
"phone": "9897969594",
"receipt_id": "xx00011",
"callback_url": "https://httpbin.org/post",
"hash": "<string>",
"email": "<string>",
"currency": "INR",
"billing_address": {
"line1": "<string>",
"line2": "<string>",
"city": "<string>",
"state": "<string>",
"zipcode": 123,
"country": "<string>",
"phone": "<string>",
"firstname": "<string>",
"lastname": "<string>"
},
"shipping_address": {
"line1": "<string>",
"line2": "<string>",
"city": "<string>",
"state": "<string>",
"zipcode": 123,
"country": "<string>",
"phone": "<string>",
"firstname": "<string>",
"lastname": "<string>"
},
"notes": {
"udf1": "<string>",
"udf2": "<string>",
"udf3": "<string>",
"udf4": "<string>",
"udf5": "<string>"
},
"pg": "<string>",
"pg_pool_id": "<string>",
"tpv": [
{
"account_number": "<string>",
"name": "<string>",
"ifsc": "<string>"
}
],
"split_settlement": [
{
"vendor_id": "<string>",
"amount": "<string>"
}
],
"split_type": "percent",
"autocapture": "true"
}
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({
key: 'test_123',
amount: 100,
cname: 'Jhon Doe',
phone: '9897969594',
receipt_id: 'xx00011',
callback_url: 'https://httpbin.org/post',
hash: '<string>',
email: '<string>',
currency: 'INR',
billing_address: {
line1: '<string>',
line2: '<string>',
city: '<string>',
state: '<string>',
zipcode: 123,
country: '<string>',
phone: '<string>',
firstname: '<string>',
lastname: '<string>'
},
shipping_address: {
line1: '<string>',
line2: '<string>',
city: '<string>',
state: '<string>',
zipcode: 123,
country: '<string>',
phone: '<string>',
firstname: '<string>',
lastname: '<string>'
},
notes: {
udf1: '<string>',
udf2: '<string>',
udf3: '<string>',
udf4: '<string>',
udf5: '<string>'
},
pg: '<string>',
pg_pool_id: '<string>',
tpv: [{account_number: '<string>', name: '<string>', ifsc: '<string>'}],
split_settlement: [{vendor_id: '<string>', amount: '<string>'}],
split_type: 'percent',
autocapture: 'true'
})
};

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([
'key' => 'test_123',
'amount' => 100,
'cname' => 'Jhon Doe',
'phone' => '9897969594',
'receipt_id' => 'xx00011',
'callback_url' => 'https://httpbin.org/post',
'hash' => '<string>',
'email' => '<string>',
'currency' => 'INR',
'billing_address' => [
'line1' => '<string>',
'line2' => '<string>',
'city' => '<string>',
'state' => '<string>',
'zipcode' => 123,
'country' => '<string>',
'phone' => '<string>',
'firstname' => '<string>',
'lastname' => '<string>'
],
'shipping_address' => [
'line1' => '<string>',
'line2' => '<string>',
'city' => '<string>',
'state' => '<string>',
'zipcode' => 123,
'country' => '<string>',
'phone' => '<string>',
'firstname' => '<string>',
'lastname' => '<string>'
],
'notes' => [
'udf1' => '<string>',
'udf2' => '<string>',
'udf3' => '<string>',
'udf4' => '<string>',
'udf5' => '<string>'
],
'pg' => '<string>',
'pg_pool_id' => '<string>',
'tpv' => [
[
'account_number' => '<string>',
'name' => '<string>',
'ifsc' => '<string>'
]
],
'split_settlement' => [
[
'vendor_id' => '<string>',
'amount' => '<string>'
]
],
'split_type' => 'percent',
'autocapture' => 'true'
]),
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 \"key\": \"test_123\",\n \"amount\": 100,\n \"cname\": \"Jhon Doe\",\n \"phone\": \"9897969594\",\n \"receipt_id\": \"xx00011\",\n \"callback_url\": \"https://httpbin.org/post\",\n \"hash\": \"<string>\",\n \"email\": \"<string>\",\n \"currency\": \"INR\",\n \"billing_address\": {\n \"line1\": \"<string>\",\n \"line2\": \"<string>\",\n \"city\": \"<string>\",\n \"state\": \"<string>\",\n \"zipcode\": 123,\n \"country\": \"<string>\",\n \"phone\": \"<string>\",\n \"firstname\": \"<string>\",\n \"lastname\": \"<string>\"\n },\n \"shipping_address\": {\n \"line1\": \"<string>\",\n \"line2\": \"<string>\",\n \"city\": \"<string>\",\n \"state\": \"<string>\",\n \"zipcode\": 123,\n \"country\": \"<string>\",\n \"phone\": \"<string>\",\n \"firstname\": \"<string>\",\n \"lastname\": \"<string>\"\n },\n \"notes\": {\n \"udf1\": \"<string>\",\n \"udf2\": \"<string>\",\n \"udf3\": \"<string>\",\n \"udf4\": \"<string>\",\n \"udf5\": \"<string>\"\n },\n \"pg\": \"<string>\",\n \"pg_pool_id\": \"<string>\",\n \"tpv\": [\n {\n \"account_number\": \"<string>\",\n \"name\": \"<string>\",\n \"ifsc\": \"<string>\"\n }\n ],\n \"split_settlement\": [\n {\n \"vendor_id\": \"<string>\",\n \"amount\": \"<string>\"\n }\n ],\n \"split_type\": \"percent\",\n \"autocapture\": \"true\"\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 \"key\": \"test_123\",\n \"amount\": 100,\n \"cname\": \"Jhon Doe\",\n \"phone\": \"9897969594\",\n \"receipt_id\": \"xx00011\",\n \"callback_url\": \"https://httpbin.org/post\",\n \"hash\": \"<string>\",\n \"email\": \"<string>\",\n \"currency\": \"INR\",\n \"billing_address\": {\n \"line1\": \"<string>\",\n \"line2\": \"<string>\",\n \"city\": \"<string>\",\n \"state\": \"<string>\",\n \"zipcode\": 123,\n \"country\": \"<string>\",\n \"phone\": \"<string>\",\n \"firstname\": \"<string>\",\n \"lastname\": \"<string>\"\n },\n \"shipping_address\": {\n \"line1\": \"<string>\",\n \"line2\": \"<string>\",\n \"city\": \"<string>\",\n \"state\": \"<string>\",\n \"zipcode\": 123,\n \"country\": \"<string>\",\n \"phone\": \"<string>\",\n \"firstname\": \"<string>\",\n \"lastname\": \"<string>\"\n },\n \"notes\": {\n \"udf1\": \"<string>\",\n \"udf2\": \"<string>\",\n \"udf3\": \"<string>\",\n \"udf4\": \"<string>\",\n \"udf5\": \"<string>\"\n },\n \"pg\": \"<string>\",\n \"pg_pool_id\": \"<string>\",\n \"tpv\": [\n {\n \"account_number\": \"<string>\",\n \"name\": \"<string>\",\n \"ifsc\": \"<string>\"\n }\n ],\n \"split_settlement\": [\n {\n \"vendor_id\": \"<string>\",\n \"amount\": \"<string>\"\n }\n ],\n \"split_type\": \"percent\",\n \"autocapture\": \"true\"\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 \"key\": \"test_123\",\n \"amount\": 100,\n \"cname\": \"Jhon Doe\",\n \"phone\": \"9897969594\",\n \"receipt_id\": \"xx00011\",\n \"callback_url\": \"https://httpbin.org/post\",\n \"hash\": \"<string>\",\n \"email\": \"<string>\",\n \"currency\": \"INR\",\n \"billing_address\": {\n \"line1\": \"<string>\",\n \"line2\": \"<string>\",\n \"city\": \"<string>\",\n \"state\": \"<string>\",\n \"zipcode\": 123,\n \"country\": \"<string>\",\n \"phone\": \"<string>\",\n \"firstname\": \"<string>\",\n \"lastname\": \"<string>\"\n },\n \"shipping_address\": {\n \"line1\": \"<string>\",\n \"line2\": \"<string>\",\n \"city\": \"<string>\",\n \"state\": \"<string>\",\n \"zipcode\": 123,\n \"country\": \"<string>\",\n \"phone\": \"<string>\",\n \"firstname\": \"<string>\",\n \"lastname\": \"<string>\"\n },\n \"notes\": {\n \"udf1\": \"<string>\",\n \"udf2\": \"<string>\",\n \"udf3\": \"<string>\",\n \"udf4\": \"<string>\",\n \"udf5\": \"<string>\"\n },\n \"pg\": \"<string>\",\n \"pg_pool_id\": \"<string>\",\n \"tpv\": [\n {\n \"account_number\": \"<string>\",\n \"name\": \"<string>\",\n \"ifsc\": \"<string>\"\n }\n ],\n \"split_settlement\": [\n {\n \"vendor_id\": \"<string>\",\n \"amount\": \"<string>\"\n }\n ],\n \"split_type\": \"percent\",\n \"autocapture\": \"true\"\n}"

response = http.request(request)
puts response.read_body
"{\n  \"status\": true,\n  \"url\": \"aHR0cHM6Ly91YXQubWNzYW0uaW4vcGVnYXN1cy9hc0b2tlbi80ODg2NDUxNjAxODQzMTYwMTE=\",\n  \"order_id\": \"48864xxxxxxxxxx\"\n}"
"{\n    \"status\": false,\n    \"error\": {\n        \"message\": \"Hash is not verified\",\n        \"code\": 204\n    }\n}"
This API is used to initiate a payment request for a specific order.

Request Body

{
  "email": "string", // End User Email
  "callback_url": "https://httpbin.org/post", // Default callback URL
  "currency": "INR", // Default currency
  "pg": "string", // Payment gateway code (optional)
  "pg_pool_id": "string", // Payment gateway pool ID (optional)
  "hash": "string" // Calculated hash for request validation
}

Responses

200 OK

{
  "status": true,
  "order_id": "string",
  "message": "Order created successfully"
}

400 Bad Request

{
  "status": false,
  "error": {
    "message": "Invalid request",
    "code": 400
  }
}

Authorizations

Authorization
string
header
required

Basic authentication header of the form Basic <encoded-value>, where <encoded-value> is the base64-encoded string username:password.

Body

application/json
key
string
default:test_123
required

Merchant key, available in dashboard profile section

amount
integer<int32>
default:100
required

Amount will always be in paisa/cents.

cname
string
default:Jhon Doe
required

End User/Payes Name

phone
string
default:9897969594
required

End Users Phone

receipt_id
string
default:xx00011
required

a random string a sting provided by merchant for reference.

callback_url
string
default:https://httpbin.org/post
required

callback url of merchant website on which will we redirect to , once payment is done.

hash
string
required

to be calculated by key sort of all non-object key values of this request

email
string
required

End User Email

currency
string
default:INR

Please Get Currency Active by our team

billing_address
object
shipping_address
object
notes
object

These fields can be used for reporting

pg
string

if you pass a pg code then only that payment gateway will be used to process this transection. eg, payu

pg_pool_id
string

this can be grabbed from pg integration manager available in your dashboard..

tpv
object[]

add tpv info

split_settlement
object[]
split_type
enum<string>
default:percent
Available options:
"percent",
"fixed"
autocapture
string
default:true

if merchant wan't they can disable autocapture by sending false in request

Response

200

status
boolean
default:true
Example:

true

url
string
Example:

"aHR0cHM6Ly91YXQubWNzYW0uaW4vcGVnYXN1cy9hc0b2tlbi80ODg2NDUxNjAxODQzMTYwMTE="

order_id
string
Example:

"48864xxxxxxxxxx"