Skip to main content

What is Google Pay Spot Platform

You can use the Google Pay Spot Platform to set up your Spot on Google Pay. A Spot is a digital storefront that you can create, brand and host, the way you want. Know more about Google Spot Platform.

Advantages

Given below are the advantages:
  • You need not handle reconciliation separately.
  • You do not have to integrate directly with Google Pay.

Workflow

Following are the payment flow steps:
  1. The customer logs into the Google Pay app.
  2. The customer clicks on your app, selects a product or service, and clicks the Pay button.
  3. The Razorpay Custom Checkout creates and sends a payment request to Google Pay.
  4. The customer completes the payment on the Google Pay app.
  5. After the payment is complete, the customer receives an order confirmation (After you get a payment confirmation from Custom Checkout).

Prerequisites

  1. Contact our Support Team to get a dedicated VPA (UPI ID). This VPA is for Google Spot Platform Integration.
  2. Sign up for a business account with Google Pay.
  3. Verify your VPA (UPI ID) details on the Google Merchant Console. Here, Google deposits a small amount into the bank account linked to your VPA (UPI ID). It might take up to 48 hours for the money to reflect in your account.
Tips for Multiple VPAsIf you have multiple VPAs, you need to verify all of them individually on the Google Merchant Console.
  1. Generate API Keys from the Dashboard.

Integration Steps

Watch Out!This feature is available only on the Chrome browser on your Android mobile devices.

Step 1: Create an Order

Order is an important step in the payment process.
  • An order should be created for every payment.
  • You can create an order using the Orders API. It is a server-side API call. Know how to authenticate Orders API.
  • The order_id received in the response should be passed to the checkout. This ties the order with the payment and secures the request from being tampered.
Watch Out!Payments made without an order_id cannot be captured and will be automatically refunded. You must create an order before initiating payments to ensure proper payment processing.You can create an order:
  • Using the sample code on the Razorpay Postman Public Workspace.
  • By manually integrating the API sample codes on your server.

Razorpay Postman Public Workspace

You can use the Postman workspace below to create an order:
Handy TipsUnder the Authorization section in Postman, select Basic Auth and add the Key Id and secret as the Username and Password, respectively.

API Sample Code

Use this endpoint to create an order using the Orders API./orders
Curl
Success Response

Request Parameters

amount mandatory : integer Payment amount in the smallest currency subunit. For example, if the amount to be charged is 299, then pass 29900 in this field. In the case of three decimal currencies, such as KWD, BHD and OMR, to accept a payment of 295.991, pass the value as 295990. And in the case of zero decimal currencies such as JPY, to accept a payment of 295, pass the value as 295.
Watch Out!As per payment guidelines, you should pass the last decimal number as 0 for three decimal currency payments. For example, if you want to charge a customer 99.991 KD for a transaction, you should pass the value for the amount parameter as 99990 and not 99991.currency mandatory : string The currency in which the transaction should be made. See the list of supported currencies. Length must be 3 characters.
Handy TipsRazorpay has added support for zero decimal currencies, such as JPY and three decimal currencies, such as KWD, BHD and OMR, allowing businesses to accept international payments in these currencies. Know more about Currency Conversion (May 2024).receipt optional : string Your receipt id for this order should be passed here. Maximum length is 40 characters.notes optional : json object Key-value pair that can be used to store additional information about the entity. Maximum 15 key-value pairs, 256 characters (maximum) each. For example, "note_key": "Beam me up Scotty”.partial_payment optional : boolean Indicates whether the customer can make a partial payment. Possible values:
  • true: The customer can make partial payments.
  • false (default): The customer cannot make partial payments.
first_payment_min_amount optional : integer Minimum amount that must be paid by the customer as the first partial payment. For example, if an amount of 7000 is to be received from the customer in two installments of #1 - 5000, #2 - 2000 then you can set this value as 500000. This parameter should be passed only if partial_payment is true.Know more about Orders API.

Response Parameters

Descriptions for the response parameters are present in the Orders Entity parameters table.

Error Response Parameters

The error response parameters are available in the API Reference Guide.

Step 2: Invoke Checkout and Pass Order ID and Other Options to it

Step 2.1: Include the Razorpay Custom Checkout JavaScript

Include the following script, preferably in the “ section of your page:
razorpay.js
Include the Javascript, Not the LibraryInclude the script from https://checkout.razorpay.com/v1/razorpay.js instead of serving a copy from your server. This allows new updates and bug fixes to the library to get automatically served to your application.We always maintain backward compatibility with our code.

Step 2.2: Include the Google Spot JavaScript

Include the following script, preferably in the “ section of your page:
microapps.js

Step 2.3: Instantiate Razorpay Custom Checkout

Single Instance on a Page

Multiple Instances on Same Page

If you need multiple Razorpay instances on the same page, you can globally set some of the options:

Step 2.4: Submit Payment Details

Once the order is created and the customer’s payment details are obtained, the information should be sent to Razorpay to complete the payment. The data that needs to be submitted depends upon the payment method selected by the customer.You can do this by invoking the createPayment method.The checkout parameters are listed here.

Apply Offers

During checkout, if there is a co-branded offer run by GooglePay, you should apply the discount, and pass on the offer details to Google. Use these offers parameters to pass the offer details.The razorpay.js file receives this data and appends this to the existing data being shared with Google.
Handy TipsRazorpay will be agnostic to whatever data is passed within this additional information section. You must structure the data as per Google’s formats.
CreatePayment with handler function

Step 3: Store fields in your Database

A successful payment returns the following fields to the Checkout form.

Success Callback

  • You need to store these fields in your server.
  • You can confirm the authenticity of these details by verifying the signature in the next step.
Success Callback
razorpay_payment_id : string Unique identifier for the payment returned by Checkout only for successful payments. razorpay_order_id : string Unique identifier for the order returned by Checkout. razorpay_signature : string Signature returned by the Checkout. This is used to verify the payment.

Step 4: Verify the Signature

This is a mandatory step to confirm the authenticity of the details returned to the Checkout form for successful payments.

To verify the razorpay_signature returned to you by the Checkout form:

  1. Create a signature in your server using the following attributes:
    • order_id: Retrieve the order_id from your server. Do not use the razorpay_order_id returned by Checkout.
    • razorpay_payment_id: Returned by Checkout.
    • key_secret: Available in your server. The key_secret that was generated from the Dashboard.
  2. Use the SHA256 algorithm, the razorpay_payment_id and the order_id to construct a HMAC hex digest as shown below:
    HMAC Hex Digest
  3. If the signature you generate on your server matches the razorpay_signature returned to you by the Checkout form, the payment received is from an authentic source.

Generate Signature on Your Server

Given below is the sample code for payment signature verification:
Java

Post Signature Verification

After you have completed the integration, you can set up webhooks, make test payments, replace the test key with the live key and integrate with other APIs.

Step 5: Send Payment Details to Google

Once the payment is complete and signature verified, you must pass the UPI reference ID to Google.
  1. Copy the UPI reference ID from resp.transaction_reference which you will receive as part of the payment.success response in step 2.4.
  2. Add it as the value for the transactionReferenceId parameter in the Google Spot Orders API.
  3. Fire the Google Spot Orders API.
Handy TipsYou need to be signed in with a whitelisted ID to view the Google Spot Orders API document.If you get a 404 error on the above link, contact Google Support and ask them to whitelist your ID.

Payment Capture Settings

After payment is authorized, you need to capture it to settle the amount to your bank account as per the settlement schedule. Payments that are not captured are auto-refunded after a fixed time.
Watch Out
  • You should deliver the products or services to your customers only after the payment is captured. Razorpay automatically refunds all the uncaptured payments.
  • You can track the payment status using our Fetch a Payment API or webhooks. Authorized payments can be automatically captured. You can auto-capture all payments using global settings on the Razorpay Dashboard. Know more about capture settings for payments.
Watch Out!Payment capture settings work only if you have integrated with Orders API on your server side. Know more about the Orders API.Each authorized payment can also be captured individually. You can manually capture payments using Payment Capture API or Dashboard. Know more about capture settings for payments.

Test Integration

Now that the integration is complete, you must ensure that your integration works as expected. Make a test transaction, verify the payment status from Dashboard, APIs or subscribe to related Webhook events to take appropriate actions at your end. After testing the integration, you can start accepting payments from your customers in real-time.
Handy Tips
  • The Google Pay Spot Platform only supported UPI payments.
  • Testing can only be done with real money. You can make low-value transactions to test the integration.

Verify Payment Status

You can track the payment status from the Dashboard or subscribe to the Webhook event or poll our APIs.

From Dashboard

  1. Log in to the Dashboard and navigate to TransactionsPayments.
  2. Look if a payment_ID has been generated. If no payment_ID has been generated, it means that the transaction has failed.

Subscribe to Webhook events

You can subscribe to a Webhook event that is generated when a specific event happens in our server. When one of those events is triggered, Razorpay sends the Webhook payload to the configured URL.Know more about how to set up Webhooks.When the customer makes a successful payment on the Checkout, the payment.authorized event is created in Razorpay.

Poll APIs

You can retrieve the status of the payments by polling our Payment APIs.