Overview
This API allows you to create a PayIN Request using the platform.
Request Parameters
| Parameter |
Type |
| customer_mobile |
Integer |
| user_token |
string |
| amount |
float |
| order_id |
string |
| redirect_url |
url |
| remark1 |
string |
| remark2 |
string |
| route |
integer |
Request Headers
| Parameter |
Description |
| Content-Type |
Form-Encoded Payload (application/x-www-form-urlencoded) |
Response
| Field |
Type |
Description |
| status |
boolean |
API request status. |
| result |
object |
Details of successful request. |
| payment_url |
string |
URL for processing payment. |
| message |
string |
Description of request result. |
Example - Create PayIN Request
Request:
<?php
// API URL
$api_url = 'https://upipay.thebharateasy.in.net/api/create-order';
// Form-encoded payload data
$post_data = [
'customer_mobile' => '7070491046',
'user_token' => '46e3df7c23755ce157d59dbf5932ca86',
'amount' => '1',
'order_id' => '1234561741239529',
'redirect_url' => 'https://upipay.thebharateasy.in.net',
'remark1' => 'testremark',
'remark2' => 'testremark2',
'route' => '1'
];
// Initialize cURL session
$ch = curl_init($api_url);
// Set cURL options
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($post_data)); // to format POST data
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Content-Type: application/x-www-form-urlencoded'
]);
// Execute the cURL session and capture the response
$response = curl_exec($ch);
// Check for cURL errors
if (curl_errno($ch)) {
echo 'cURL Error: ' . curl_error($ch);
} else {
echo $response;
}
// Close the cURL session
curl_close($ch);
?>
Response (Success):
{
"status": true,
"message": "Order Created Successfully",
"result": {
"orderId": "1234561705047510",
"payment_url": "https://upipay.thebharateasy.in.net/payment/MTIzNDU2MTc"
}
}
Response (Error):
{
"status": false,
"message": "Your Plan Expired Please Renew"
}
Error Handling
If the status in the response is error, check the message field for details on the issue.
Request Parameters
| Parameter |
Type |
Description |
| user_token |
string |
The API Key. |
| order_id |
string |
AlphaNumeric. |
Request Headers
| Parameter |
Description |
| Content-Type |
Form-Encoded Payload (application/x-www-form-urlencoded) |
Response
| Field |
Type |
Description |
| status |
boolean |
API request success status. |
| message |
string |
API result message. |
| result |
object |
Details of transaction. |
| txnStatus |
string |
Transaction status. |
| orderId |
string |
Order ID. |
| amount |
string |
Transaction amount. |
| date |
string |
Transaction time. |
| utr |
string |
UTR Number. |
Example - Check PayIN Status
Request:
<?php
// API URL
$api_url = 'https://upipay.thebharateasy.in.net/api/check-order-status';
// Form-encoded payload data
$post_data = [
'user_token' => '9856ce42fc26349fe5fab9c6b630e9c6',
'order_id' => '1234561741239529'
];
// Initialize cURL session
$ch = curl_init($api_url);
// Set cURL options
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($post_data)); // to format POST data
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Content-Type: application/x-www-form-urlencoded'
]);
// Execute the cURL session and capture the response
$response = curl_exec($ch);
// Check for cURL errors
if (curl_errno($ch)) {
echo 'cURL Error: ' . curl_error($ch);
} else {
echo $response;
}
// Close the cURL session
curl_close($ch);
?>
Response (Success):
{
"status": true,
"message": "Transaction Successfully",
"result": {
"txnStatus": "SUCCESS", //For Pending PENDING
"orderId": "784525sdD",
"amount": "1",
"date": "2024-01-12 13:22:08",
"utr": "454525454245" //only when success
}
}
Response (Error):
{
"status": false,
"message": "Error Message",
}
Example - Webhook Response
POST:
<?php
// Check if the POST request has been made
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
// Retrieve data from POST request
$status = $_POST['status'];
$order_id = $_POST['order_id'];
$customer_mobile = $_POST['customer_mobile'];
$amount = $_POST['amount'];
$remark1 = $_POST['remark1'];
$remark2 = $_POST['remark2'];
// Process the received data
// For example, you can save it to a database, log it, or perform other actions
} else {
// Handle other request methods if necessary
http_response_code(405); // Method Not Allowed
echo 'Only POST requests are allowed';
}
?>