After the payment is initiated, you can use this API to get the transaction details of an order.
To get the transaction details, make the following POST request to the API:
GET https://nbupayments.googleapis.com/v1/merchantTransactions:get
{
// Merchant identifier.
// googleMerchantId should be set. This ID is globally unique across all
Google Pay merchants.
“merchantInfo”: {
“googleMerchantId”: “BREKJWNFNFLS”
},
// Merchant transaction ID for which payment details need to be fetched.
"transactionIdentifier": {
"merchantTransactionId": "transactionId"
}
}
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 |
You must pass the unique transaction ID that you generate in the
merchantTransactionId
key. This field is required.
Response
Success
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”: “transactionId”,
// Google’s transaction ID.
“googleTransactionId”: “GoogleTransactionId”,
// Mode of payment that the user used.
“paymentMode”: UPI,
// Status of the transaction.
“transactionStatus”: {
“status”: SUCCESS
},
// Transaction details for UPI transactions.
“upiTransactionDetails”: {
“upiRrn”: “abcdef”,
},
// Amount paid by the user
“amountPaid”: {
“currencyCode”: “INR”,
“units”: 100,
“nanos”: 0
},
// Time at which transaction was last updated in RFC 3339 format
“lastUpdatedTime”: “2017-02-15T10:50:30Z”
}
Failure
The API returns the following response if the request fails:
{
// Merchant transaction ID for which payment details are fetched
“transactionId”: “transactionId”,
// Google’s transaction ID
“googleTransactionId”: “GoogleTransactionId”,
// Mode of payment used
“paymentMode”: UPI,
// Status of the transaction
“transactionStatus”: {
“status”: FAILURE,
“upiErrorDetails”: {
“upiErrorCode”: “upierrorcode”,
“upiErrorMessage”: “upierrormessage”
}
},
// Transaction details for UPI transactions
“upiTransactionDetails”: {
“upiRrn”: “abcdef”,
},
// Time at which transaction was last updated in RFC 3339 format
“lastUpdatedTime”: “2017-02-15T10:50:30Z”
}
The response contains the UPI as the value for paymentMode
object.
The response contains any 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
You may encounter the following message if the response contains error:
{
“error”: {
“code”: 400,
“status”: “INVALID_ARGUMENT”,
“message”: “MerchantInfo not present”
}
}
API specific error codes
You may encounter the following error codes while working with the
getTransactionDetails
API.
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. |
404 | NOT_FOUND | Merchant was not found. |