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:- The customer logs into the Google Pay app.
- The customer clicks on your app, selects a product or service, and clicks the Pay button.
- The Razorpay Custom Checkout creates and sends a payment request to Google Pay.
- The customer completes the payment on the Google Pay app.
- After the payment is complete, the customer receives an order confirmation (After you get a payment confirmation from Custom Checkout).
Prerequisites
- Contact our Support Team to get a dedicated VPA (UPI ID). This VPA is for Google Spot Platform Integration.
- Sign up for a business account with Google Pay.
- 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.
- Generate API Keys from the Dashboard.
Integration Steps
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_idreceived in the response should be passed to the checkout. This ties the order with the payment and secures the request from being tampered.
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./ordersCurl
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.
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 thecreatePayment 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.Therazorpay.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:
-
Create a signature in your server using the following attributes:
order_id: Retrieve theorder_idfrom your server. Do not use therazorpay_order_idreturned by Checkout.razorpay_payment_id: Returned by Checkout.key_secret: Available in your server. Thekey_secretthat was generated from the Dashboard.
-
Use the SHA256 algorithm, the
razorpay_payment_idand theorder_idto construct a HMAC hex digest as shown below:HMAC Hex Digest -
If the signature you generate on your server matches the
razorpay_signaturereturned 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.- Copy the UPI reference ID from
resp.transaction_referencewhich you will receive as part of thepayment.successresponse in step 2.4. - Add it as the value for the
transactionReferenceIdparameter in the Google Spot Orders API. - 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 isauthorized, 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.
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
- Log in to the Dashboard and navigate to Transactions → Payments.
- Look if a
payment_IDhas been generated. If nopayment_IDhas 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, thepayment.authorized event is created in Razorpay.Poll APIs
You can retrieve the status of the payments by polling our Payment APIs.Related Information
- Webhooks (Recommended)
- Error Codes (Recommended)
- How Payment Gateway Works
- Payment States
- Settlements
- Refunds