Skip to main content

Transformation Layer API’s

The Transformation Layer enables merchants to integrate with Paytring using API formats they’re already familiar with from other payment gateways. This eliminates the need for code changes when migrating from Razorpay, PayU, Pinelabs, Cashfree, or Worldline.

Overview

GatewayAuthenticationEndpointsFeatures
RazorpayHash-based (V1) / Basic Auth (V2)Create, FetchOrder creation & status
PayUHash-based (V1) / Basic Auth (V2)Create, FetchOrder creation & status
PinelabsHash-based (V1) / Basic Auth (V2)Create, FetchOrder creation & status
CashfreeHeader-based (x-client-id/secret)Create, Fetch, Payments, RefundsFull order & refund lifecycle
WorldlineNone (V1) / Basic Auth (V2)CreateOrder creation

Authentication Methods

V1 - Hash-based Authentication

Used by: Razorpay, PayU, Pinelabs Include in request body:
{
  "key": "your_paytring_api_key",
  "hash": "sha512_hash_of_params"
}
Hash Calculation:
  1. Sort all request parameters alphabetically by key
  2. Concatenate values with | separator
  3. Append | + API secret
  4. Generate SHA512 hash
See Hash Documentation for details.

V2 - Basic Authentication

Used by: Razorpay, PayU, Pinelabs, Worldline Include HTTP header:
Authorization: Basic base64(api_key:api_secret)

Cashfree-style Header Authentication

Used by: Cashfree Include HTTP headers:
x-client-id: your_paytring_api_key
x-client-secret: your_paytring_api_secret
x-api-version: 2023-08-01 (optional)

Razorpay

Emulates Razorpay’s order API format.

Create Order

V2 Endpoint: POST /api/v2/order/via/rzp/create

Request

{
  "amount": 50000,
  "currency": "INR",
  "receipt": "receipt_123",
  "notes": {
    "key1": "value1"
  }
}
FieldTypeRequiredDescription
amountintegerYesAmount in paise (e.g., 50000 = ₹500)
currencystringYesCurrency code (INR)
receiptstringYesUnique receipt/order identifier
notesobjectNoAdditional metadata

Response

{
  "id": "order_ABC123",
  "entity": "order",
  "amount": 50000,
  "currency": "INR",
  "receipt": "receipt_123",
  "status": "created",
  "created_at": 1234567890
}

Fetch Order

V2 Endpoint: POST /api/v2/order/via/rzp/fetch

Request

{
  "order_id": "order_ABC123"
}

Response

{
  "id": "order_ABC123",
  "entity": "order",
  "amount": 50000,
  "amount_paid": 50000,
  "amount_due": 0,
  "currency": "INR",
  "receipt": "receipt_123",
  "status": "paid",
  "created_at": 1234567890
}

PayU

Emulates PayU’s order API format.

Create Order

V2 Endpoint: POST /api/v2/order/via/payu/create

Request

{
  "txnid": "TXN123456",
  "amount": "500.00",
  "productinfo": "Product Description",
  "firstname": "John",
  "email": "[email protected]",
  "phone": "9876543210",
  "surl": "https://merchant.com/success",
  "furl": "https://merchant.com/failure"
}
FieldTypeRequiredDescription
txnidstringYesUnique transaction ID
amountstringYesAmount in rupees (e.g., “500.00”)
productinfostringYesProduct/order description
firstnamestringYesCustomer first name
emailstringYesCustomer email
phonestringYesCustomer phone
surlstringYesSuccess callback URL
furlstringYesFailure callback URL

Response

{
  "status": 1,
  "msg": "Order Created",
  "result": {
    "txnid": "TXN123456",
    "order_id": "order_ABC123",
    "payment_url": "https://paytring.com/pay/..."
  }
}

Fetch Order

V2 Endpoint: POST /api/v2/order/via/payu/fetch

Request

{
  "txnid": "TXN123456"
}

Response

{
  "status": 1,
  "result": {
    "txnid": "TXN123456",
    "amount": "500.00",
    "status": "success",
    "mode": "CC",
    "bank_ref_num": "123456789"
  }
}

Pinelabs

Emulates Pinelabs’ order API format.

Create Order

V2 Endpoint: POST /api/v2/order/via/pinelabs/create

Request

{
  "merchant_txn_id": "PINE123456",
  "amount": 50000,
  "currency": "INR",
  "customer_name": "John Doe",
  "customer_email": "[email protected]",
  "customer_mobile": "9876543210",
  "callback_url": "https://merchant.com/callback"
}
FieldTypeRequiredDescription
merchant_txn_idstringYesUnique transaction ID
amountintegerYesAmount in paise
currencystringYesCurrency code
customer_namestringNoCustomer name
customer_emailstringNoCustomer email
customer_mobilestringNoCustomer phone
callback_urlstringYesWebhook callback URL

Response

{
  "response_code": 1,
  "response_message": "SUCCESS",
  "ppc_MerchantTxnId": "PINE123456",
  "ppc_PinelabsTxnId": "order_ABC123",
  "redirect_url": "https://paytring.com/pay/..."
}

Fetch Order

V2 Endpoint: POST /api/v2/order/via/pinelabs/fetch

Request

{
  "merchant_txn_id": "PINE123456"
}

Response

{
  "response_code": 1,
  "response_message": "SUCCESS",
  "ppc_MerchantTxnId": "PINE123456",
  "ppc_Amount": 50000,
  "ppc_TxnStatus": "SUCCESS",
  "ppc_PaymentMode": "CREDIT_CARD"
}

Cashfree

Emulates Cashfree’s PG API format with full order and refund lifecycle support.

Create Order

V2 Endpoint: POST /api/v2/pg/via/cashfree/orders

Request

{
  "order_id": "CF_ORDER_123",
  "order_amount": 500.50,
  "order_currency": "INR",
  "customer_details": {
    "customer_id": "cust_123",
    "customer_name": "John Doe",
    "customer_email": "[email protected]",
    "customer_phone": "9876543210"
  },
  "order_meta": {
    "return_url": "https://merchant.com/return?order_id={order_id}",
    "notify_url": "https://merchant.com/webhook"
  },
  "order_note": "Test order"
}
FieldTypeRequiredDescription
order_idstringYesUnique order identifier
order_amountnumberYesAmount in rupees (decimal, e.g., 500.50)
order_currencystringYesCurrency code (INR)
customer_details.customer_idstringYesCustomer identifier
customer_details.customer_namestringNoCustomer name
customer_details.customer_emailstringYesCustomer email
customer_details.customer_phonestringYesCustomer phone (10 digits)
order_meta.return_urlstringNoReturn URL after payment
order_meta.notify_urlstringNoWebhook notification URL
order_notestringNoOrder description

Response

{
  "cf_order_id": "order_ABC123",
  "order_id": "CF_ORDER_123",
  "order_status": "ACTIVE",
  "order_token": "token_xyz",
  "order_amount": 500.50,
  "order_currency": "INR",
  "payment_session_id": "session_abc",
  "payments": {
    "url": "https://api.paytring.com/api/v1/pg/via/cashfree/orders/order_ABC123/payments"
  },
  "refunds": {
    "url": "https://api.paytring.com/api/v1/pg/via/cashfree/orders/order_ABC123/refunds"
  }
}

Fetch Order

V2 Endpoint: GET /api/v2/pg/via/cashfree/orders/{order_id}

Response

{
  "cf_order_id": "order_ABC123",
  "order_id": "CF_ORDER_123",
  "order_status": "PAID",
  "order_amount": 500.50,
  "order_currency": "INR",
  "customer_details": {
    "customer_id": "cust_123",
    "customer_name": "John Doe",
    "customer_email": "[email protected]",
    "customer_phone": "9876543210"
  },
  "created_at": "2024-01-15T10:30:00+05:30"
}
Order Status Values:
StatusDescription
ACTIVEOrder created, awaiting payment
PAIDPayment successful
EXPIREDOrder expired or payment failed

Get Order Payments

V2 Endpoint: GET /api/v2/pg/via/cashfree/orders/{order_id}/payments

Response

[
  {
    "cf_payment_id": "pay_123",
    "order_id": "CF_ORDER_123",
    "payment_status": "SUCCESS",
    "payment_amount": 500.50,
    "payment_currency": "INR",
    "payment_method": {
      "card": {
        "card_network": "VISA",
        "card_type": "CREDIT_CARD",
        "card_last4": "1234"
      }
    },
    "payment_time": "2024-01-15T10:35:00+05:30",
    "bank_reference": "123456789"
  }
]

Create Refund

V2 Endpoint: POST /api/v2/pg/via/cashfree/orders/{order_id}/refunds

Request

{
  "refund_id": "refund_123",
  "refund_amount": 100.00,
  "refund_note": "Customer requested refund"
}
FieldTypeRequiredDescription
refund_idstringYesUnique refund identifier
refund_amountnumberYesRefund amount in rupees
refund_notestringNoReason for refund

Response

{
  "cf_refund_id": "rf_ABC123",
  "refund_id": "refund_123",
  "order_id": "CF_ORDER_123",
  "refund_status": "PENDING",
  "refund_amount": 100.00,
  "refund_currency": "INR",
  "created_at": "2024-01-15T11:00:00+05:30"
}

List Refunds

V2 Endpoint: GET /api/v2/pg/via/cashfree/orders/{order_id}/refunds

Response

[
  {
    "cf_refund_id": "rf_ABC123",
    "refund_id": "refund_123",
    "refund_status": "SUCCESS",
    "refund_amount": 100.00,
    "created_at": "2024-01-15T11:00:00+05:30"
  }
]

Fetch Refund

V2 Endpoint: GET /api/v2/pg/via/cashfree/orders/{order_id}/refunds/{refund_id}

Response

{
  "cf_refund_id": "rf_ABC123",
  "refund_id": "refund_123",
  "order_id": "CF_ORDER_123",
  "refund_status": "SUCCESS",
  "refund_amount": 100.00,
  "refund_currency": "INR",
  "refund_note": "Customer requested refund",
  "created_at": "2024-01-15T11:00:00+05:30",
  "processed_at": "2024-01-15T11:05:00+05:30"
}
Refund Status Values:
StatusDescription
PENDINGRefund initiated
SUCCESSRefund processed successfully
CANCELLEDRefund cancelled

Worldline

Emulates Worldline’s order creation API.

Create Order

V2 Endpoint: POST /api/v2/order/via/worldline/create (Basic Auth)

Request

{
  "merchant_id": "MID123",
  "order_id": "WL_ORDER_123",
  "amount": "500.00",
  "currency": "INR",
  "customer_name": "John Doe",
  "customer_email": "[email protected]",
  "customer_phone": "9876543210",
  "return_url": "https://merchant.com/return"
}
FieldTypeRequiredDescription
merchant_idstringYesMerchant identifier
order_idstringYesUnique order ID
amountstringYesAmount in rupees
currencystringYesCurrency code
customer_namestringNoCustomer name
customer_emailstringNoCustomer email
customer_phonestringNoCustomer phone
return_urlstringYesReturn URL after payment

Response

{
  "status": "SUCCESS",
  "order_id": "WL_ORDER_123",
  "paytring_order_id": "order_ABC123",
  "payment_url": "https://paytring.com/pay/..."
}

Error Responses

All endpoints return consistent error responses:

Validation Error (400)

{
  "status": "ERROR",
  "code": "VALIDATION_ERROR",
  "message": "Invalid request parameters",
  "errors": {
    "amount": ["Amount is required"],
    "email": ["Invalid email format"]
  }
}

Authentication Error (401)

{
  "status": "ERROR",
  "code": "AUTHENTICATION_FAILED",
  "message": "Invalid API credentials"
}

Not Found (404)

{
  "status": "ERROR",
  "code": "ORDER_NOT_FOUND",
  "message": "Order not found"
}

Server Error (500)

{
  "status": "ERROR",
  "code": "INTERNAL_ERROR",
  "message": "An unexpected error occurred"
}

Migration Guide

From Razorpay

  1. Replace base URL: https://api.razorpay.com/v1https://api.paytring.com/api/v2/order/via/rzp
  2. Update authentication to use Paytring API credentials
  3. No changes needed to request/response handling

From PayU

  1. Replace endpoint: PayU’s endpoint → https://api.paytring.com/api/v2/order/via/payu
  2. Update key and salt to Paytring credentials
  3. Hash calculation remains the same

From Pinelabs

  1. Replace base URL → https://api.paytring.com/api/v2/order/via/pinelabs
  2. Use Paytring API credentials
  3. Response format remains compatible

From Cashfree

  1. Replace base URL: https://api.cashfree.com/pghttps://api.paytring.com/api/v2/pg/via/cashfree
  2. Update x-client-id and x-client-secret headers with Paytring credentials
  3. All endpoints and response formats remain compatible

Rate Limits

Endpoint TypeLimit
Create Order100 requests/minute
Fetch Order300 requests/minute
Refund Operations50 requests/minute

Support

For integration support or issues: