Integration examples

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.}\"
      }"
    }
  },
}