Google Pay
Complete Google Pay Order
Places the order using the token minted by the Google Pay sheet
POST
Complete Google Pay Order
Overview
Completes the checkout in a single call. The wallet ceremony happens client-side: the client reads the ready-to-use Google Pay configuration from the cart, callsgooglePay.loadPaymentData() to mint a token, and posts that token here. Google Pay has no separate start or authorize step; this endpoint authorizes and places the order. The cart must already carry a shipping address and a selected shipping method (see Preparing the cart). Merchants that process Google Pay through Braintree take a payment nonce instead of the token; see Braintree merchants (nonce flow).
Google Pay is enabled per merchant. Look for the entry with
"type": "GooglePay" in the cart’s payment_method_options; its config is the PaymentDataRequest to pass to the Google Pay SDK (see Discovering Google Pay support). No entry, or an entry without config, means the sheet cannot be built for this merchant: do not show the button. For the client-side steps, see Integrate Google Pay.Authentication
Path Parameters
Request Body
Response
Returns the order confirmation object.Code Example
Response Example
Discovering Google Pay support
A client learns that a merchant accepts Google Pay, and gets the configuration to build the sheet, from the cart response. Inpayment_method_options, find the entry whose type is "GooglePay" (wallet: "google_pay"). Its config is a Google Pay PaymentDataRequest: pass it straight to googlePay.loadPaymentData(). No entry means the merchant does not accept Google Pay. An entry without config means the merchant has Google Pay enabled but its tokenization settings are incomplete, so no request can be built: do not show the button in that case either.
emailRequired and shippingAddressRequired are set on the config only when the cart needs shipping and does not yet hold a shipping address, so the sheet does not collect an address the cart already has.
The PaymentDataRequest carries no environment. The sheet environment (TEST or PRODUCTION) is exposed at shop_properties.google_pay.environment on the cart response; read it from there rather than hardcoding it on the client.
Preparing the cart
This endpoint completes an already-prepared cart: Google Pay mints a payment token, it does not build the cart. For a physical-goods order, the cart must carry a shipping address and a selected shipping method before you complete.- If the cart already has shipping (the shopper entered it on the page), complete directly with the token.
- For a guest flow where the Google Pay sheet collects the address, persist it with Set Shipping Info, select a method with Set Shipping Method, then complete.
transactionInfo.totalPriceStatus is ESTIMATED until a shipping method is selected, because shipping and tax are not yet known, and FINAL afterwards. If the shopper authorizes on an estimated total and shipping or tax then raise it, confirm the final total with the shopper before completing: this API flow does not push an updated total back into the Google Pay sheet.
Braintree merchants (nonce flow)
A merchant that processes Google Pay through Braintree is recognisable from itsconfig: allowedPaymentMethods[0].tokenizationSpecification has type: "PAYMENT_GATEWAY" and parameters.gateway: "braintree", with the Braintree key under parameters (braintree:tokenizationKey or braintree:clientKey). For these merchants Firmly does not unwrap the Google Pay token; the merchant’s checkout takes a Braintree payment method nonce, so the client mints the nonce with Braintree’s Google Pay SDK and sends it here as nonce.
- Load Braintree’s
clientandgoogle-paymentmodules and create a client with the key fromparameters. - Create the Google Payment instance (
braintree.googlePayment.create({ client, googlePayVersion: 2, googleMerchantId })) and build the request withgooglePayment.createPaymentDataRequest({ transactionInfo, emailRequired: true, shippingAddressRequired: true }), takingtransactionInfofrom the cart’sconfig. Braintree merchants require the address and the email on this call, so request both even when the cart’sconfigdoes not. - Call
loadPaymentData(), thengooglePayment.parseResponse(paymentData)to obtain the nonce. - Post
nonce, the sheet’sshippingAddressasgoogle_pay_addressand the sheet’semail.google_pay_tokenis not sent.
nonce fails with ErrorBadRequest (“Missing Google Pay nonce”); a missing google_pay_address or email fails with ErrorBadRequest from the merchant adapter. google_pay_card_network, google_pay_card_details and google_pay_description are not used on this flow.
Error Responses
Related Endpoints
- Integrate Google Pay - Client-side steps with Google’s SDK
- Express Checkout overview - All express gateways
- Complete Order (Credit Card) - Alternative credit card flow
- Complete Apple Pay Order - Apple Pay express flow