Integration examples
Stay organized with collections
Save and categorize content based on your preferences.
This section provides examples of the Request and Response JSON to use for
integration.
UPI payment
Request
{
"apiVersion":2,
"apiVersionMinor":0,
"allowedPaymentMethods": [
{
"type":"UPI",
"parameters":{
"payeeVpa":"merchant@psp",
"payeeName":"Merchant Name",
"referenceUrl":"https://www.merchant.com/transaction/12345",
"mcc":"0000",
"transactionReferenceId":"1234",
"gstIdentificationNumber": "29ABCDE1234F2Z5",
"gstBreakUp": {
"gst": "4.14",
"cgst": "1.02",
"sgst": "1.03",
"igst": "1.04",
"cess": "1.05",
},
"invoiceNumber": "4072-STUC5012-01",
"invoiceDate": "2019-06-11T13:21:50+05:30"
}
"tokenizationSpecification": {
"type": "DIRECT",
}
},
],
"transactionInfo": {
"totalPriceStatus": "FINAL",
"totalPrice": "13.00",
"currencyCode": "INR",
"transactionNote": "Note",
}
}
Response
{
"apiVersion": 2,
"apiVersionMinor": 0,
"paymentMethodData": {
"type": "UPI",
"tokenizationData": {
"type": "DIRECT"
"token": "{
\"protocolVersion\": \"ECv1\"
\"signature\": \"TJVA95OrM7E2cBab30RMHrHDcEfxjoYZgeFONFh7HgQ\"
\"signedMessage\": \"{
\\\"messageExpiration\\\": \\\"1234567890000\\\",
\\\"paymentMethod\\\": \\\"UPI\\\",
\\\"paymentMethodDetails\\\": {
\\\"payeeVpa\\\": \\\"merchant@psp\\\",
\\\"status\\\": \\\"SUBMITTED\\\",
\\\"transactionInfo\\\": {
\\\"currencyCode\\\": \\\"INR\\\",
\\\"totalPrice\\\": \\\"13.00\\\",
\\\"totalPriceStatus\\\": \\\"FINAL\\\",
\\\"transactionNote\\\": \\\"Transaction Description\\\"
},
\\\"transactionReferenceId\\\": \\\"1234\\\"
}
}\"
}"
}
},
}
Verifying the signed response
For verifying the UPI signature, refer to the
developer documentation website.
Card payment
Request
{
"apiVersion":2,
"apiVersionMinor":0,
"allowedPaymentMethods": [
{
"type":"CARD",
"parameters":{
"allowedCardNetworks":["VISA", "MASTERCARD"],
}
"tokenizationSpecification": {
"type": "PAYMENT_GATEWAY",
"Parameters": {
"gateway": "newco-gateway",
"gatewayMerchantId": "some id",
"gatewayTransactionId": "some id",
// All parameters to be passed through to the gateway will be added here with
// the following key format <gateway-name>:<field-name>
"newco-gateway:merchantName": "RidShareApp",
}
}
},
],
"transactionInfo": {
"totalPriceStatus": "FINAL",
"totalPrice": "100.00",
"currencyCode": "INR",
"transactionNote": "Note",
}
}
Response
{
"apiVersion": 2,
"apiVersionMinor": 0,
"paymentMethodData": {
"type": "CARD",
"tokenizationData": {
"type": "DIRECT"
"token": "{
\"protocolVersion\": \"ECv1\"
\"signature\": \"TJVA95OrM7E2cBab30RMHrHDcEfxjoYZgeFONFh7HgQ\"
\"signedMessage\":\"{Signed response generated by Google Pay.}\"
}"
}
},
}
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-10-16 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-10-16 UTC."],[[["\u003cp\u003eThis section provides JSON request and response examples for integrating UPI and Card payments with Google Pay.\u003c/p\u003e\n"],["\u003cp\u003eFor UPI, the request includes payee details, transaction information, while the response contains a signed token for verification.\u003c/p\u003e\n"],["\u003cp\u003eFor Card payments, the request specifies allowed card networks and tokenization parameters, while the response includes a signed token.\u003c/p\u003e\n"],["\u003cp\u003eVerifying the signed UPI response requires referring to the developer documentation for payment data cryptography.\u003c/p\u003e\n"]]],["The provided JSON examples demonstrate integration for UPI and card payments. UPI requests include payee details, transaction specifics like `gstBreakUp`, `invoiceNumber`, and `invoiceDate`. UPI responses contain a token with a signed message that has the payment status and transaction information. Card payment requests specify allowed networks and gateway parameters. Card payment responses contain a `DIRECT` token with a signed message. The UPI signature verification requires consulting external developer documentation.\n"],null,["# Integration examples\n\nThis section provides examples of the Request and Response JSON to use for\nintegration.\n\nUPI payment\n-----------\n\n### Request\n\n {\n \"apiVersion\":2,\n \"apiVersionMinor\":0,\n \"allowedPaymentMethods\": [\n {\n \"type\":\"UPI\",\n \"parameters\":{\n \"payeeVpa\":\"merchant@psp\",\n \"payeeName\":\"Merchant Name\",\n \"referenceUrl\":\"https://www.merchant.com/transaction/12345\",\n \"mcc\":\"0000\",\n \"transactionReferenceId\":\"1234\",\n \"gstIdentificationNumber\": \"29ABCDE1234F2Z5\",\n \"gstBreakUp\": {\n \"gst\": \"4.14\",\n \"cgst\": \"1.02\",\n \"sgst\": \"1.03\",\n \"igst\": \"1.04\",\n \"cess\": \"1.05\",\n },\n \"invoiceNumber\": \"4072-STUC5012-01\",\n \"invoiceDate\": \"2019-06-11T13:21:50+05:30\"\n\n }\n \"tokenizationSpecification\": {\n \"type\": \"DIRECT\",\n }\n },\n ],\n \"transactionInfo\": {\n \"totalPriceStatus\": \"FINAL\",\n \"totalPrice\": \"13.00\",\n \"currencyCode\": \"INR\",\n \"transactionNote\": \"Note\",\n }\n }\n\n### Response\n\n {\n \"apiVersion\": 2,\n \"apiVersionMinor\": 0,\n \"paymentMethodData\": {\n \"type\": \"UPI\",\n \"tokenizationData\": {\n \"type\": \"DIRECT\"\n \"token\": \"{\n \\\"protocolVersion\\\": \\\"ECv1\\\"\n \\\"signature\\\": \\\"TJVA95OrM7E2cBab30RMHrHDcEfxjoYZgeFONFh7HgQ\\\"\n \\\"signedMessage\\\": \\\"{\n \\\\\\\"messageExpiration\\\\\\\": \\\\\\\"1234567890000\\\\\\\",\n \\\\\\\"paymentMethod\\\\\\\": \\\\\\\"UPI\\\\\\\",\n \\\\\\\"paymentMethodDetails\\\\\\\": {\n \\\\\\\"payeeVpa\\\\\\\": \\\\\\\"merchant@psp\\\\\\\",\n \\\\\\\"status\\\\\\\": \\\\\\\"SUBMITTED\\\\\\\",\n \\\\\\\"transactionInfo\\\\\\\": {\n \\\\\\\"currencyCode\\\\\\\": \\\\\\\"INR\\\\\\\",\n \\\\\\\"totalPrice\\\\\\\": \\\\\\\"13.00\\\\\\\",\n \\\\\\\"totalPriceStatus\\\\\\\": \\\\\\\"FINAL\\\\\\\",\n \\\\\\\"transactionNote\\\\\\\": \\\\\\\"Transaction Description\\\\\\\"\n },\n \\\\\\\"transactionReferenceId\\\\\\\": \\\\\\\"1234\\\\\\\"\n }\n }\\\"\n }\"\n }\n },\n }\n\n#### Verifying the signed response\n\nFor verifying the UPI signature, refer to the\n[developer documentation website](https://developers.google.com/pay/api/web/guides/resources/payment-data-cryptography).\n\nCard payment\n------------\n\n### Request\n\n {\n \"apiVersion\":2,\n \"apiVersionMinor\":0,\n \"allowedPaymentMethods\": [\n {\n \"type\":\"CARD\",\n \"parameters\":{\n \"allowedCardNetworks\":[\"VISA\", \"MASTERCARD\"],\n }\n \"tokenizationSpecification\": {\n \"type\": \"PAYMENT_GATEWAY\",\n \"Parameters\": {\n \"gateway\": \"newco-gateway\",\n \"gatewayMerchantId\": \"some id\",\n \"gatewayTransactionId\": \"some id\",\n // All parameters to be passed through to the gateway will be added here with\n // the following key format \u003cgateway-name\u003e:\u003cfield-name\u003e\n \"newco-gateway:merchantName\": \"RidShareApp\",\n }\n }\n },\n ],\n \"transactionInfo\": {\n \"totalPriceStatus\": \"FINAL\",\n \"totalPrice\": \"100.00\",\n \"currencyCode\": \"INR\",\n \"transactionNote\": \"Note\",\n }\n }\n\n### Response\n\n {\n \"apiVersion\": 2,\n \"apiVersionMinor\": 0,\n \"paymentMethodData\": {\n \"type\": \"CARD\",\n \"tokenizationData\": {\n \"type\": \"DIRECT\"\n \"token\": \"{\n \\\"protocolVersion\\\": \\\"ECv1\\\"\n \\\"signature\\\": \\\"TJVA95OrM7E2cBab30RMHrHDcEfxjoYZgeFONFh7HgQ\\\"\n \\\"signedMessage\\\":\\\"{Signed response generated by Google Pay.}\\\"\n }\"\n }\n },\n }"]]