Send food delivery receipts

To send a food delivery receipt, you must first retrieve the transactionID of the user for whom you want to generate a receipt. Provide the transactionId for every transaction.

After getting the user transactionID, pass the food delivery receipt template parameters in the message payload.

To send a food delivery receipt to a user, make the following POST request to the API:

POST https://nbupayments.googleapis.com/v1/merchantCommunications:send
Content-type: application/json

{
  "merchantInfo": {
    "googleMerchantId": "Google assigned merchant ID."
  },
  "recipients": [
    {
      "vendorPaymentTransactionId": "35 digit UPI transaction ID"
    }
  ],
  "messagePayload": {
    "merchantMessageId": "Unique message ID",
    "components": [
      {
        "template": {
          "templateType": "FOOD_DELIVERY",
          "templateParameters": {
            "expectedArrivalTime": "Expected time of delivery in RFC 3339 format (2018-05-30T18:00:00Z)",
            "sellerInfo": {
              "sellerName": "Restaurant Name",
            },
            "orderDetails": {
              "orderNumber": "Order number generated by merchant"
            },
            "deliveryStatus": {
              "statusMessage": "Status regarding delivery provided by merchant. For e.g.       confirmed"
            },
            "deliveryItems": [
              {
               "itemName": "Name of the ordered item",
               "itemQuantity": "Quantity if the item ordered, e.g. 5"
              },
              {
               "itemName": "Name of the ordered item",
               "itemQuantity": "Quantity if the item ordered, e.g. 12"
              },
            ],
            "trackingDetails": {
              "contactNumber": {
                "countryCode": 91,
                "nationalNumber": 9876543210
              },
              "trackingUrl" : "URL of the web page which the user can use to get detailed information regarding the status and current location of the delivery items"
            }
          }
        }
      }
    ]
  }
}

Parameters

User and merchant

The following data parameters for the user object must be passed in the API request:

Parameters Type of value Description Required/Optional
googleMerchantId String The ID provided by Google for a business. Required
vendorPaymentTransactionId String The 35-digit UPI transaction ID generated either by vendor (payment service provider) or merchant for every transaction. Required

Message payload

You must pass the merchant-created unique ID for every message in the merchantMessageId.

Template type

You must pass the value for templateType object as HOTEL_RESERVATION. Pass the expected time of food delivery in RFC 3339 format in the expectedArrivalTime key.

Seller info object

The following is the data parameters to pass into the sellerInfo object:

Parameter Type of value Description Required/Optional
sellerName String Name of the restaurant where the user is ordering food. Required

Order details object

The following is the data parameters to pass into the orderDetails object:

Parameter Type of value Description Required/Optional
orderNumber String A unique number generated by merchant for every order. Required

Delivery status object

The following is the data parameters to pass into the deliveryStatus object:

Parameter Type of value Description Required/Optional
statusMessage String Staus of the order placed in a restaurant. For example, confirmed or pending. Required

Delivery items

The following are the data parameters to pass into the deliveryItems array:

Parameters Type of value Description Required/Optional
itemName String Name of the food item ordered from a restaurant. Required
itemQuantity Number Quantity of the food item ordered. Required

If more than one item is ordered from a restaurant, define the key-value pairs as itemName and itemQuantity for each item ordered in the deliveryItems array as shown in the sample request.

Tracking details object

The following are the data parameters to pass into the contactNumber object nested in the trackingDetails object:

Parameters Type of value Description Required/Optional
countryCode Number Country code of the user phone number. Optional
nationalNumber Number Contact of the user who has placed an order in a restaurant. Required

You must pass the URL of the web page that user can use to get detailed information of the order status and current location of the delivery items in the trackingUrl key.

Response

The API returns the following response if the request is successful.


{
  "sendMessageResults": [
    {
      "recipient": {
        "vendorPaymentTransactionId": "35 digit UPI transaction ID"
      },
      "status": {
        "code": 200,
        "message": "Success response message"
      }
    }
  ]
}

The response contains the recipient vendorPaymentTransactionId, API response status, and the relevant message.