AI-generated Key Takeaways
-
This API retrieves the transaction details of an order after payment initiation using a POST request.
-
It is crucial to verify the payment status with your payment service provider and cross-check the amount with the API response before fulfilling the order.
-
The request body requires your Google Merchant ID and the unique Merchant Transaction ID.
-
The API response includes transaction status (SUCCESS, FAILURE, IN_PROGRESS, etc.), payment mode, and other relevant details.
-
Error responses provide specific codes and messages for troubleshooting, such as invalid arguments or unauthorized access.
After the payment is initiated, you can use this API to get the transaction details of an order.
Request
To get the transaction details, make a POST request to the following endpoint:
Prod
POST https://nbupayments.googleapis.com/v1/merchantTransactions:get
Request Body
{
// Merchant identifier, googleMerchantId should be set. This ID is globally
// unique across all Google Pay merchants.
"merchantInfo": {
"googleMerchantId": "ABCDE12345"
},
// Merchant transaction ID for which payment details need to be fetched.
"transactionIdentifier": {
"merchantTransactionId": "someTransactionId"
}
}
Request Body parameters
Merchant Info
The following data parameter for the merchantInfo
object must be passed in the
API request:
Parameters | Type of value | Description | Required/Optional |
---|---|---|---|
googleMerchantId |
String | Google assigned merchant ID. Generated during onboarding. | Required |
Transaction Id
You must pass the unique transaction ID that you generated while creating the
payment/order in the merchantTransactionId
key. It is a required field.
Response
The response contains "UPI" as the value for paymentMode
object and one of the
following possible values for the transactionStatus
object.
- SUCCESS
- FAILURE: Transaction has failed
- IN_PROGRESS: Transaction is in progress
- PAYMENT_NOT_INITIATED: Payment hasn't been initiated by the user
- DECLINED: Payment has been declined by the user
- EXPIRED: Payment request expired
Successful response
If successful, the GET request returns a 200 OK
HTTP status code, including
the following response:
{
// Merchant transaction ID for which payment details are fetched.
"transactionId": "someTransactionId",
// Google’s transaction ID.
"googleTransactionId": "someGoogleTransactionId",
// Mode of payment that the user used.
"paymentMode": "UPI",
// Status of the transaction.
"transactionStatus": {
"status": "SUCCESS"
},
// Transaction details for UPI transaction.
"upiTransactionDetails": {
"upiRrn": "abcdef"
},
// Amount paid by the user (only present if the transactionStatus is SUCCESS)
"amountPaid": {
"currencyCode": "INR",
"units": "100",
"nanos": 750000000
},
// Time at which transaction was last updated in RFC 3339 format
"lastUpdatedTime": "2022-01-31T11:00:44.735Z",
// Payer account type: UPI_CREDIT, UPI_DEBIT (only populated for allowlisted merchants)
"payerAccountType": "UPI_DEBIT",
// Payee VPA of the transaction (only populated for allowlisted merchants)
"payeeVpa": "your-merchant-vpa@acquiringbank"
}
Failure response
The API returns the following response in case of a failure:
{
// Merchant transaction ID for which payment details are fetched.
"transactionId": "someTransactionId",
// Google’s transaction ID.
"googleTransactionId": "someGoogleTransactionId",
// Mode of payment that the user used.
"paymentMode": "UPI",
// Status of the transaction.
"transactionStatus": {
"status": "FAILURE",
// (String) failure error code describing the reason behind the failure
"failureErrorCode": "BENEFICIARY_VPA_RESTRICTED"
},
// Transaction details for UPI transactions.
"upiTransactionDetails": {
"upiRrn": "abcdef"
},
// Time at which transaction was last updated in RFC 3339 format
"lastUpdatedTime": "2022-01-31T11:00:44.735Z",
// Payer account type: UPI_CREDIT, UPI_DEBIT (only populated for allowlisted merchants)
"payerAccountType": "UPI_DEBIT",
// Payee VPA of the transaction (only populated for allowlisted merchants)
"payeeVpa": "your-merchant-vpa@acquiringbank"
}
In case of a malformed request, you will receive the following response with an appropriate error message and error code:
{
"error": {
"code": 400,
"status": "INVALID_ARGUMENT",
"message": "MerchantInfo not present"
}
}
Malformed request error codes
Code | Title | Description |
---|---|---|
403 | PERMISSION_DENIED | The merchant is not authorized. |
400 | INVALID_ARGUMENT | Request contains an invalid argument. |
404 | NOT_FOUND | Request contains invalid transaction ID. |