Payin P2C Non-Seamless Integration
Request Payment from Web/Android/iOS App Follow these steps to integrate the payment request from your app.
Note: The IP must be whitelisted by us to accept the request. This process involves back-end to back-end communication
PAYMENT REQUEST :
Gateway Endpoint: {baseURL}/pay/request.php
Required Fields:
order_id: Your unique order ID (at least 10 characters long).
pid: The provided merchant ID.
amount: The amount to be sent.
name: The customer's name.
email: The customer's email address.
phone: The customer's phone number.
Optional Fields:
redirect_url: The redirect url where user redirect back to merchant page
Procedure Steps:
Send the following details to the given API
GET https://<domain>/pay/request.php
Note: If the status is 'error,' a reason will be provided in the 'message' field.
Append
hash_valuetoconnect.phpfor redirecting customers to the payment completion page.
Launch this URL from your app using the
Launch Mode.externalapplication.
Here are examples in Kotlin, Java, and Flutter for launching a URL with Launch Mode.external:
CALLBACK
We invoke your callback URL with callback data whenever there is a status change against the transaction.
Valid Transaction status are:
Approved
Declined
Late Approved
Pending
User Timed Out
Cancelled
Failed
Amount Mismatch
The most famous transaction changes are (but not limited):
Pending=>Approved
Pending=>Declined
Pending=>User Timed Out
User Timed Out=>Late Approved
The callback landing page must be set up on your server at a secret path, but it should be publicly accessible from our whitelisted IP. (Ensure that it is only accessible from our server IP.)
In the POST body, the following properties will be provided in JSON format:
order_id
string
Your order id shared
requested_amount
string
requested amount
received_amount
string
received amount
bank_ref
string
transaction reference/bank reference/UTR if available
ref_code
string
unique code for the transaction
status
string
status of payment at this time
post_hash
string
signature post hash for security verification
Note:
please consider received_amount for final transaction processing
Follow the steps to verify the integrity of received data:
Capture and Decode the Payload
Capture the raw JSON data from the POST body and decode it.
Extract and Decode the
post_hash
The post_hash field in the JSON payload is a Base64-encoded string. You must Base64-decode it to get the raw binary data needed for decryption.
Decrypt the Binary Data to get the Remote Hash
Pass the raw binary data (not the Base64 string) to the decrypt function along with your secret key.
The decrypt function for your language is provided in the reference section below.
Compute the Local Hash
Compute the local hash using the MD5 128-bit hashing algorithm. Use the order_id, received_amount, and status received in the callback array for computing the local hash.
Verify Hash
Compare the decrypted $remote_hash from the request and the computed $local_hash.
Acknowledge the Payment Gateway
To confirm you have received the callback and to prevent our gateway from sending retries, you must do two things:
Respond with an HTTP 200 OK status code.
Respond with a JSON body containing the key
"acknowledge"set to the string"yes".
Our system will check for both the 200 status and the {"acknowledge": "yes"} in the response body. If either is missing, we will assume the callback failed and will attempt to send it again.
STATUS POLLING :
POST https://<domain>/api/status_polling.php
This API is used to poll the status of a particular transaction.
Headers
Content-Type
application/json
Body
pid
string
Merchant ID/PID
Yes
ref_code
string
unique ref_code which is generated in payment request
Yes
post_hash
string
The Base64-encoded encrypted hash. (See steps below).
Yes
Steps to generate post_hash :
Generate the Request
post_hash
1.1 Create Plaintext Hash: Concatenate the ref_code, pid, and your secret_key, then create an MD5 hash.
1.2 Encrypt the Hash: Encrypt the $local_hash using the encrypt function shown below.
1.3 Base64 Encode: Base64-encode the raw binary output from the encrypt function. This final string is your post_hash.
Send the POST Request
Send a POST request containing pid, ref_code, and post_hash as a JSON body , and you will receive a response after validating the data.
Processing the API Response
The API will respond with a JSON object. If the request is successful and the ref_code is found, it will return the transaction details. If it fails (e.g., bad hash, ref_code not found), it will return an error message.
Success Response Parameters
A successful response will contain the following parameters as JSON body:
order_id
String
Your order ID.
ref_code
String
The unique ref_code for this transaction.
upi_id
String
The UPI ID the payment was made to.
requested_amount
Number
The amount originally requested for the transaction.
received_amount
Number
The final amount confirmed as received.
bank_ref
String
The bank's UTR / reference number, if available.
sender_upi
String
The customer's UPI ID from which the payment was received.
webhook_acknowledged
String
"1" if our server has sent the callback, "0" otherwise.
status
String
The current status of the transaction (e.g., Approved, Pending, Declined, etc).
post_hash
String
A Base64-encoded encrypted hash to verify the integrity of this response.
Error Response
An error response will contain an error key.
Verify the Response
post_hash
Before trusting any data from the response, you must verify its post_hash to ensure the data is from us and has not been tampered with. This verification logic is identical to the logic used for verifying a callback.
You do not need to send an "Acknowledge" response for a status poll.
4.1 Compute the Local Hash
From the JSON response, get the order_id, received_amount, and status. Concatenate them with your secret_key and create an MD5 hash.
4.2 Decrypt the Remote Hash
Get the post_hash string from the JSON response. Base64-decode it, then pass the raw binary data to the decrypt function.
The decrypt function for your language is provided in the reference section below.
4.3 Compare the Hashes
Securely compare the local_hash you just computed with the remote_hash you decrypted. If they match, you can trust the data.
TRANSACTION STATUS :
Amount Mismatch : We received money but customer paid different money than the requested money
Approved : We received money same value as requested
Late Approved : We recieved money but it happened late while doing reconcilation from bank side
Declined : The transaction declined due to security reasons
Failed : The payment failed from bank side
Cancelled : This status for NonSeamess when customer cancel the payment from the screen
User Timed Out: The user did not complete the payment within the session period.
COMPLAINT
We have a dedicated Complaint Section where merchants can manage transaction-related complaints. Through this section, merchants can submit complaints with all necessary details and optional evidence. Upon submission, a unique complaint reference ID is generated, allowing merchants to track the complaint’s status and receive real-time updates via the status-check API. This ensures a smooth, secure, and efficient process for resolving any transaction issues.
RECONCILIATION
This API endpoint allows authorized users to retrieve payment transactions based on a specific pid (Partner ID) and date. The API performs authentication using a token and signature verification to ensure secure communication.
Last updated