Get Started

API Endpoint: https://pg.bnypay.in

The BNYPay API offers programmatic access to various payment services, enabling seamless integration with financial transactions. Using our API, you can:

  • Create Payment Links for UPI - Initiate UPI payment links through the Payin – Create Order API to request payments.
  • Generate Secure Hashes - Ensure secure transactions with Payin Hash Logic (HMAC-SHA256), which generates a secure hash to validate requests.
  • Check Payment Status - Track and monitor the progress of your payments with the Payin – Status Check API.
  • Receive Payment Updates in Real-Time - Get real-time payment status updates through the Payin – Webhook.
  • Initiate Payouts - Make outbound payments with the Payout – Payment API to facilitate payouts directly.
  • Verify Payout Status - Confirm the completion of a payout using the Payout – Status Check API.
  • Check Available Balance - Retrieve account balances in real time with the Payout – Balance Check API.

Note: Please use corresponding secret keys according to the API service, like use payin secret key for Payin APIs and use payout secret key for Payout APIs :

1. Payin – Create Order API (UPI payment link generation) (POST)


1. Payin – Create Order API (UPI payment link generation) (POST)

Request

# Here is a curl example
curl --location 'https://pg.bnypay.in:52118/Payment/TransactionDirect' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'MERCHANT_ID=U104' \
--data-urlencode 'ORDER_ID=OD123451' \
--data-urlencode 'AMOUNT=100' \
--data-urlencode 'CUST_NAME=test' \
--data-urlencode 'CUST_EMAIL=sample@gmail.com' \
--data-urlencode 'CUST_MOBILE=9876543210' \
--data-urlencode 'REMARK=test txn' \
--data-urlencode 'PAY_MODE=UPI' \
--data-urlencode 'UPI_CHANNEL=INTENT' \
--data-urlencode 'RETURN_URL=NA' \
--data-urlencode 'HASH=d4fe2cc4627d3c2cc646bbf55db31584459e50a8b338256a1fb14f768de7c557'


The table below lists the various request.

Field Type Description
MERCHANT_IDStringYour Merchant ID
ORDER_IDStringUnique identifier entered while creating an order
AMOUNTStringOrder Amount in INR
CUST_NAMEstringName of the customer
CUST_EMAILStringEmail of the customer
CUST_MOBILEstringMobile number of the Customer
REMARKstringRemark for the order
PAY_MODEstringMode of payment, use 'UPI'
UPI_CHANNELstringUse 'INTENT'
RETURN_URLstringBy default use 'NA'

Response (upi intent in response):
{
  "respCode": "0",
  "respStatus": "SUCCESS",
  "data": {
    "ORDER_ID": "OD123451",
    "GatewayTID": "1234567918",
    "IntentURL": "upi://pay?pa=testmerchant@upi&pn=DemoEnterprises&mc=0000&tr=1234567918&tn=1234567918&am=100&cu=INR",
    "Amount": "100",
    "Message": "Payment link generated",
    "QR_Image": ""
  }
}


Response (base64 QR image in response): 
{ 
    "respCode": "0", 
    "respStatus": "SUCCESS", 
    "data": { 
        "ORDER_ID": "TESTC1203", 
        "GatewayTID": "567783271", 
        "IntentURL": "", 
        "Amount": "10", 
        "Message": "QR image generated", 
        "QR_Image": 
"iVBORw0KGgoAAAANSUhEUgAAASwAAAEsCAIAAAD2HxkiAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAC1QSURBVHhe7dNRjtzAki3bO/9J9wMM6yMBx3HEYUqR6n5cn7adpKqE+n//83q9fur9I3y9fI3y9fuz9I3y9fuz9I3y9fuz9I3y9fuz9I3y9fuz9I3y9fuz9I3y9fuz9I3y9fuz9I3y9fuz9I3y9fuz9I3y9fuz9I3y9fuz9I3y9fuz9I3y9fuz9I3y9fuzqH+H/+wu8OtJgPuaxSMc8FinSI14RaTBHinTMYyunK6eDOVKkSIN5MP9RXn3F3Y/9BV4daTAf81ikYx6LFOkRr4g0mCNFOuaxldOV08EcKVKkwTyY/yivvuLux/kJggg==" 
    } 
}



    

2. Payin Hash Logic (HAMC-SHA256)

Payin hash should include only the below parameters in the given sequence.

Hash input string:
AMOUNT=100|CUST_EMAIL=sample@gmail.com|CUST_MOBILE=9876543210 |CUST_NAME=demo|MERCHANT_ID=U10XXX|ORDER_ID=order123|RETURN_URL=NA
Please verify the generated hash on the link below:

https://www.devglan.com/online-tools/hmac-sha256-online

3. Payin – Status Check API (POST)



3. Payin – Status Check API (POST)
    
Request

# Here is a curl example
curl --location 'https://status.bnypay.in:52118/api/payin/TransactionStatus' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic VTEwWFg6YXBpLWtleS1zZWNyZXQtc2hhcmVkLWJ5LWFkbWlu' \
--data '{
"ORDER_ID": "OD123451",
"TxnDate": "2024-07-11"
}'

The table below lists the various request parameters.

Field Type Description
ORDER_IDStringUnique identifier entered while creating an order
TxnDateStringDate of transaction in YYYY-DD-MM format
                
Response Initiated/Pending:
{
    "respCode": "0",
    "respStatus": "SUCCESS",
    "data": {
        "ORDER_ID": "OD123451",
        "GatewayTID": "1234567918",
        "StatusCode": "2",
        "TxnStatus": "INITIATED", // "PENDING"
        "Amount": "100.00",
        "MDR": "2.00",
        "GST": "0.36",
        "BankRefNum": "NA",
        "Message": "Payment link generated",
        "CustomerVPA": "",
        "CustomerName": "",
        "CustomerMobile": ""
    }
}

Response Success:
{
    "respCode": "0",
    "respStatus": "SUCCESS",
    "data": {
        "ORDER_ID": "OD123450",
        "GatewayTID": "1234567917",
        "StatusCode": "0",
        "TxnStatus": "SUCCESS",
        "Amount": "100.00",
        "MDR": "2.00",
        "GST": "0.36",
        "BankRefNum": "444282073503",
        "Message": "Transaction Successful",
        "CustomerVPA": "customer.vpa@upi",
        "CustomerName": "customer name",
        "CustomerMobile": "9876543210"
    }
}
Response Failed:
{
    "respCode": "0",
    "respStatus": "SUCCESS",
    "data": {
        "ORDER_ID": "OD123451",
        "GatewayTID": "1234567918",
        "StatusCode": "1",
        "TxnStatus": "FAILED",
        "Amount": "100.00",
        "MDR": "2.00",
        "GST": "0.36",
        "BankRefNum": "NA",
        "Message": "Transaction Failed",
        "CustomerVPA": "",
        "CustomerName": "",
        "CustomerMobile": ""
    }
}

                    

4. Payin – Webhook (POST)


4. Payin – Webhook (POST)



# Request: 
Content-Type="application/x-www-form-urlencoded" 
data={
"ORDER_ID": "OD123451",
"GatewayTID": "100123456",
"StatusCode": "0",
"TxnStatus": "Success",
"Amount": "200.00",
"MDR": "2.40",
"GST": "0.43",
"BankRefNum": "420012362325",
"Message": "transaction successful",
"CustomerVPA": "customer-vpa@upi",
"CustomerName": "",
"CustomerMobile": ""
}&hash=83C88AFCE2B5926AE4D5F5D66A489DF42F8FED6C662DF8ED04438F1234273160

Method Type: POST

When the event is triggered, BNYPay send a HTTP POST request with two parameters data and hash, both in the POST Body. BNYPay POST below 2 attributes-

Field DataType Mandatory Description
dataJSONYJson transaction data
hashStringYHash calculated using payin api token of the merchant

HASH Calculation:

Step 1: Concatenate the parameter name and values in alphabetic sequence with “|” between each parameter, as shown below (include only the below param and in the exact sequence):

string strForHash = "Amount=" + data.Amount + "|" + "BankRefNum=" + data.BankRefNum + "|" + "GatewayTID=" + data.GatewayTID + "|" + "GST=" + data.GST + "|" + "MDR=" + data.MDR + "|" + "Message=" + data.Message + "|" + "ORDER_ID=" + data.ORDER_ID + "|" + "StatusCode=" + data.StatusCode + "|" + "TxnStatus=" + data.TxnStatus;

Step 2:Use HMAC function to calculate the hash of strForHash using payin_API_KEY provided to you by BNYPay. The algorithm used should be HMACSHA256.

Step 3: Convert the result to HEX format.

Step 4:Convert the HEX format to uppercase and match with the hash value received in callback response. E.g., if result of step 3 is “feab12cd” then convert it to “FEAB12CD”.

5. Payout – Payment API (POST)



5. Payout – Payment API (POST)

Request

# Here is a curl example
curl --location 'https://api.bnypay.in:52118/api/payout/transaction' \ 
--header 'Content-Type: application/json' \
--header 'Authorization: Basic VTEwWFg6YXBpLWtleS1zZWNyZXQtc2hhcmVkLWJ5LWFkbWlu' \
--data-raw '{
"ClientTID": "PAY12347",
"Amount": "100",
"AccHolderName": "DEMO",
"BeneficiaryEmail": "test@mail.com",
"BeneficiaryMobile": "9876543210",
"BeneficiaryAddress": "Mumbai",
"Remark": "test",
"AccountNo": "110023456005",
"IFSC": "SBIN0012345",
"TxnMode": "IMPS"
}'

The table below lists the various request parameters.

Field Type Description
ClientIDStringYour Client ID
AMOUNTStringTransaction Amount in INR
AccHolderNamestringName of the account holder
BeneficiaryEmailStringEmail of the beneficiary
BeneficiaryMobilestringMobile number of the beneficiary
BeneficiaryAddressstringAddress of the beneficiary
RemarkstringRemark/Comment for the payment
AccountNostringAccount Number
IFSCstringIFSC
TxnModestringMode of transaction (IMPS|NEFT|RTGS)

Response Success:
{
    "respCode": "0",
    "respStatus": "SUCCESS",
    "respMsg": "transaction successful",
    "data": {
        "ClientTID": "PAY12347",
        "GatewayTID": "1003",
        "StatusCode": "0",
        "TxnStatus": "SUCCESS",
        "Transfer_Amount": "100",
        "Charge": "5.00",
        "GST": "0.90",
        "TDS": "0",
        "Total_Amount": "105.90",
        "BankRefNum": "417051649929",
        "Balance": "788.20"
    }
}


Response Failed:
{
    "respCode": "0",
    "respStatus": "SUCCESS",
    "respMsg": "transaction failed",
    "data": {
        "ClientTID": "PAY12348",
        "GatewayTID": "1004",
        "StatusCode": "1",
        "TxnStatus": "FAILED",
        "Transfer_Amount": "150",
        "Charge": "5.00",
        "GST": "0.90",
        "TDS": "0",
        "Total_Amount": "155.90",
        "BankRefNum": "",
        "Balance": "788.20"
    }
}

6. Payout – Status Check API (POST)


6. Payout – Status Check API (POST)
Request

# Here is a curl example
curl --location 'https://status.bnypay.in:52118/api/payout/TransactionStatus' \ 
--header 'Content-Type: application/json' \
--header 'Authorization: Basic VTEwWFg6YXBpLWtleS1zZWNyZXQtc2hhcmVkLWJ5LWFkbWlu' \
--data '{
"ClientTID": "PAY12345",
"TxnDate": "2024-07-11"
}'


The table below lists the various request parameters.

Field Type Description
ORDER_IDStringUnique identifier entered while creating an order
TxnDateStringDate of transaction in YYYY-DD-MM format

Response:
{
    "respCode": "0",
    "respStatus": "SUCCESS",
    "respMsg": "Transaction is SUCCESS",
    "data": {
        "ClientTID": "PAY12345",
        "GatewayTID": "1001",
        "StatusCode": "0",
        "TxnStatus": "SUCCESS",
        "Transfer_Amount": "100.00",
        "Charge": "5.00",
        "GST": "0.90",
        "TDS": "0.00",
        "Total_Amount": "105.90",
        "BankRefNum": "417054697472",
        "Balance": ""
    }
}

7. Payout – Balance Check API (GET)


7. Payout – Balance Check API (GET)

Request

# Here is a curl example
curl --location 'https://api.bnypay.in:52118/api/payout/balance' \ 
--header 'Authorization: Basic VTEwWFg6YXBpLWtleS1zZWNyZXQtc2hhcmVkLWJ5LWFkbWlu'

Response: 
{ 
    "respCode": "0", 
    "respStatus": "SUCCESS", 
    "respMsg": "Balance for the account", 
    "data": { 
        "balance": "788.20" 
    } 
} 

8. API Response Codes

API Response Code

respCode respStatus Description
0SUCCESSAPI request successful
1FAILEDAPI request failed

Payin Transaction Status Code

StatusCode TxnStatus Description
0SUCCESSTransaction is successful
1FAILEDTransaction is failed
2PENDINGTransaction is pending, please re-check status after few minutes
3EXCEPTIONTransaction status is unknown, please check status again
4CHARGEBACKTransaction has moved to chargeback from success.
5REFUNDEDTransaction is refunded back to customer

Payout Transaction Status Code

StatusCode TxnStatus Description
0SUCCESSTransaction is successful
1FAILEDTransaction is failed
2PENDINGTransaction is pending, please re-check status after few minutes
3EXCEPTIONTransaction status is unknown, please check status again.