Skip to main content
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, calls googlePay.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

string
required
Device authentication token from Browser Session

Path Parameters

string
required
The merchant domain (e.g., “merchant.example.com”)

Request Body

object
required
Google Pay payment attributes

Response

Returns the order confirmation object.
string
Unique identifier for the cart
string
The order number from the merchant platform
string
Status of the cart (e.g., “submitted”)
object
Relevant URLs for the order
array
Array of items in the order
object
Delivery address details (taken from google_pay_address when provided)
object
Billing address details
object
Summary of the Google Pay payment, for the confirmation screen
object
Grand total including all costs

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. In payment_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.
The config’s 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 its config: 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.
  1. Load Braintree’s client and google-payment modules and create a client with the key from parameters.
  2. Create the Google Payment instance (braintree.googlePayment.create({ client, googlePayVersion: 2, googleMerchantId })) and build the request with googlePayment.createPaymentDataRequest({ transactionInfo, emailRequired: true, shippingAddressRequired: true }), taking transactionInfo from the cart’s config. Braintree merchants require the address and the email on this call, so request both even when the cart’s config does not.
  3. Call loadPaymentData(), then googlePayment.parseResponse(paymentData) to obtain the nonce.
  4. Post nonce, the sheet’s shippingAddress as google_pay_address and the sheet’s email. google_pay_token is not sent.
The response is the same order confirmation object. A missing 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