• About Us
  • Disclaimer
  • Contact Us
  • Privacy Policy
Wednesday, August 26, 2026
mGrowTech
No Result
View All Result
  • Technology And Software
    • Account Based Marketing
    • Channel Marketing
    • Marketing Automation
      • Al, Analytics and Automation
      • Ad Management
  • Digital Marketing
    • Social Media Management
    • Google Marketing
  • Direct Marketing
    • Brand Management
    • Marketing Attribution and Consulting
  • Mobile Marketing
  • Event Management
  • PR Solutions
  • Technology And Software
    • Account Based Marketing
    • Channel Marketing
    • Marketing Automation
      • Al, Analytics and Automation
      • Ad Management
  • Digital Marketing
    • Social Media Management
    • Google Marketing
  • Direct Marketing
    • Brand Management
    • Marketing Attribution and Consulting
  • Mobile Marketing
  • Event Management
  • PR Solutions
No Result
View All Result
mGrowTech
No Result
View All Result
Home Google Marketing

Enhancing Android Checkout with Dynamic Callbacks in Google Pay

Josh by Josh
May 26, 2026
in Google Marketing
0
Enhancing Android Checkout with Dynamic Callbacks in Google Pay


We are excited to bring Express checkout with Google Pay for Android native apps enabling developers to leverage users stored credentials (payment and address) from Google Wallet to streamline their checkout journeys. You will be able to implement familiar callbacks onPaymentDataChanged and onPaymentAuthorized that are already supported on Web now in your Android applications and streamline the checkout funnels. With these callbacks, you can update shipping options, taxes, and total prices dynamically as users interact with the Google Pay sheet, and handle authorization feedback without ever closing the sheet. This is available with play-services-wallet:20.0.0 and onwards.

Why use Dynamic Callbacks?

Dynamic callbacks enable a true “Express Checkout” experience. By moving the Google Pay button upstream to your Product Detail or Cart pages, you can provide the user’s shipping address, payment credentials, and contact details all within the Pay sheet.

  • Dynamic Shipping & Taxes: Update shipping methods and calculate tax on-the-fly based on the user’s selected address.
  • Upstream Positioning: Place the Pay button earlier in the funnel to drive higher conversion rates.
  • Inline Authorization: Handle transaction authorization and retries directly within the Google Pay interface.

Getting Started

To get started, update your Google Pay dependency in your build.gradle file:

com.google.android.gms:play-services-wallet:20.0.0

Kotlin

1. Implement the Callback Logic

Extend BasePaymentDataCallbacks to handle the specific events triggered during the checkout process.

import com.google.android.gms.wallet.PaymentData
import com.google.android.gms.wallet.callback.BasePaymentDataCallbacks
import com.google.android.gms.wallet.callback.IntermediatePaymentData
import com.google.android.gms.wallet.callback.OnCompleteListener
import com.google.android.gms.wallet.callback.PaymentAuthorizationResult
import com.google.android.gms.wallet.callback.PaymentDataRequestUpdate
import org.json.JSONObject

class MerchantPaymentDataCallbacks : BasePaymentDataCallbacks() {

    /**
     * Handles payment data changes in the payment sheet such as shipping address and shipping options.
     */
    override fun onPaymentDataChanged(
        request: IntermediatePaymentData,
        onCompleteListener: OnCompleteListener<PaymentDataRequestUpdate>
    ) {

        // Example: Process the request and return updates
        // In a real application, you would likely make a network request to your server
        // to get updated shipping options and cart details based on the new address.

        val shippingAddress = request.shippingAddress
        val shippingOptionData = request.shippingOptionData

        // Construct the response object
        val responseJson = JSONObject().apply {
            // Example: Add new shipping options based on the address
            put("newShippingOptionParameters", JSONObject().apply {
                put("defaultSelectedOptionId", "shipping-001")
                put("shippingOptions", JSONObject().apply {
                    put("id", "shipping-001")
                    put("label", "$0.00: Free shipping")
                    put("description", "Free shipping on all orders")
                })
            })

            // Example: Update transaction info
            put("newTransactionInfo", JSONObject().apply {
                put("totalPriceStatus", "FINAL")
                put("totalPrice", "12.34")
                put("currencyCode", "USD")
            })
        }

        val response = PaymentDataRequestUpdate.fromJson(responseJson.toString())
        onCompleteListener.complete(response)
    }

    /**
     * Called when a payment is authorized in the payment sheet.
     */
    override fun onPaymentAuthorized(
        request: PaymentData,
        onCompleteListener: OnCompleteListener<PaymentAuthorizationResult>
    ) {
        // Log the payment data for debugging
        println("onPaymentAuthorized called with PaymentData: ${request.toJson()}")

        // Example: Process the payment authorization
        // In a real application, you would send the payment token and other data
        // to your server to be processed by your payment service provider.

        // Construct the response object
        val responseJson = JSONObject().apply {
            put("transactionState", "SUCCESS") // Or "ERROR"
            // Optionally include an error message
            // put("error", JSONObject().apply {
            //     put("reason", "PAYMENT_DATA_INVALID")
            //     put("intent", "PAYMENT_AUTHORIZATION")
            //     put("message", "Invalid payment method.")
            // })
        }

        val response = PaymentAuthorizationResult.fromJson(responseJson.toString())
        onCompleteListener.complete(response)
    }
}

Kotlin

2. Host the Callback Service

Implement a service that extends BasePaymentDataCallbacksService to provide an instance of your callbacks.

import androidx.annotation.NonNull
import com.google.android.gms.wallet.callback.BasePaymentDataCallbacks
import com.google.android.gms.wallet.callback.BasePaymentDataCallbacksService

/**
 * Service class which hosts the payment data callbacks.
 */
class MerchantPaymentDataCallbacksService : BasePaymentDataCallbacksService() {

    @NonNull
    override fun createPaymentDataCallbacks(): BasePaymentDataCallbacks {
        return MerchantPaymentDataCallbacks()
    }
}

Kotlin

3. Update the Android Manifest

You must declare your service and protect it with the BIND_PAYMENTS_CALLBACK_SERVICE permission.

<service
    android:name=".service.MerchantPaymentDataCallbacksService"
    android:permission="com.google.android.gms.permission.BIND_PAYMENTS_CALLBACK_SERVICE"
    android:exported="true">
    <intent-filter>
        <action android:name="com.google.android.gms.wallet.callback.PAYMENT_DATA_CALLBACKS" />
    </intent-filter>
</service>

XML

4. Configure the Payment Request

Finally, include the callbackIntents in your PaymentDataRequest JSON object to tell Google Pay which events you want to listen for.

{
  "apiVersion": 2,
  "apiVersionMinor": 0,
  ...
  "callbackIntents": [
    "PAYMENT_AUTHORIZATION",
    "SHIPPING_ADDRESS",
    "SHIPPING_OPTION"
  ]
}

JSON

Takeaways

Implementing dynamic callbacks on Android allows you to:

  • Reduce Friction: Enable a 1-click experience by moving checkout upstream.
  • Increase Accuracy: Provide real-time shipping and tax pricing.
  • Improve Authorization: Handle success or failure feedback within the Pay sheet to increase conversion.

Dynamic callbacks bring the Google Pay developer platform on Android to parity with its capabilities on the web. For a full implementation guide, see the updated developer documentation: goo.gle/pay-android-dpu



Source_link

READ ALSO

Enterprise-Grade Precision for Long-Context Multimodal Embedding Inference on Cloud TPU

How to turn on intelligent dictation in the Gemini app for macOS

Related Posts

Enterprise-Grade Precision for Long-Context Multimodal Embedding Inference on Cloud TPU
Google Marketing

Enterprise-Grade Precision for Long-Context Multimodal Embedding Inference on Cloud TPU

August 26, 2026
How to turn on intelligent dictation in the Gemini app for macOS
Google Marketing

How to turn on intelligent dictation in the Gemini app for macOS

August 26, 2026
AI, IP, and the future of innovation
Google Marketing

AI, IP, and the future of innovation

August 26, 2026
Nothing OS 5.0 brings a new Glyph Interface app and a more customizable homescreen
Google Marketing

Nothing OS 5.0 brings a new Glyph Interface app and a more customizable homescreen

August 26, 2026
Buy the new Pixel 11 phones and Pixel Watch 5 today
Google Marketing

Buy the new Pixel 11 phones and Pixel Watch 5 today

August 25, 2026
Google and Delaware offer free career and AI training.
Google Marketing

Google and Delaware offer free career and AI training.

August 25, 2026
Next Post
Minute Rice Bowl Heads and Cave Raves

Minute Rice Bowl Heads and Cave Raves

POPULAR NEWS

Trump ends trade talks with Canada over a digital services tax

Trump ends trade talks with Canada over a digital services tax

June 28, 2025
15 Trending Songs on TikTok in 2025 (+ How to Use Them)

15 Trending Songs on TikTok in 2025 (+ How to Use Them)

June 18, 2025
Communication Effectiveness Skills For Business Leaders

Communication Effectiveness Skills For Business Leaders

June 10, 2025
Comparing the Top 7 Large Language Models LLMs/Systems for Coding in 2025

Comparing the Top 7 Large Language Models LLMs/Systems for Coding in 2025

November 4, 2025
App Development Cost in Singapore: Pricing Breakdown & Insights

App Development Cost in Singapore: Pricing Breakdown & Insights

June 22, 2025

EDITOR'S PICK

10 Best vFairs Alternatives and Competitors in 2026

10 Best vFairs Alternatives and Competitors in 2026

January 13, 2026
Why is keyword research essential to content marketing?

Why is keyword research essential to content marketing?

September 29, 2025
Fixing CX: An Interview with Michael Lowenstein, Founding Principal, The Linkage Group

Fixing CX: An Interview with Michael Lowenstein, Founding Principal, The Linkage Group

March 3, 2026
It’s All About the Talent Now

It’s All About the Talent Now

July 16, 2025

About

We bring you the best Premium WordPress Themes that perfect for news, magazine, personal blog, etc. Check our landing page for details.

Follow us

Categories

  • Account Based Marketing
  • Ad Management
  • Al, Analytics and Automation
  • Brand Management
  • Channel Marketing
  • Digital Marketing
  • Direct Marketing
  • Event Management
  • Google Marketing
  • Marketing Attribution and Consulting
  • Marketing Automation
  • Mobile Marketing
  • PR Solutions
  • Social Media Management
  • Technology And Software
  • Uncategorized

Recent Posts

  • How local service businesses actually get found on social media
  • ASUS Introduces New Ace Esports-Focused Gaming Monitors
  • Alibaba’s Qwen Team Releases Qwen3.8-Flash-Next: A 125B Multimodal MoE With 6B Active Parameters Previewing the Qwen4 Architecture
  • The Checklist for Combating Creative Block
  • About Us
  • Disclaimer
  • Contact Us
  • Privacy Policy
No Result
View All Result
  • Technology And Software
    • Account Based Marketing
    • Channel Marketing
    • Marketing Automation
      • Al, Analytics and Automation
      • Ad Management
  • Digital Marketing
    • Social Media Management
    • Google Marketing
  • Direct Marketing
    • Brand Management
    • Marketing Attribution and Consulting
  • Mobile Marketing
  • Event Management
  • PR Solutions