Requirements
Code samples
**HTML
DOM elementJavaScript
Component implementation exampleStep 1: Create a DOM element
Create a Document Object Model (DOM) element where you want to implement express checkout. Create a DOM elementStep 2: Set the callback intents
When you create an instance of the Component, set the callback intents from Google Pay: Callback intentsStep 3: Set shipping configurations
Configure the options for shipping address and shipping options: Shipping configurationStep 4: Pass the default shipping options
Configure the default shipping option parameters. Default shipping optionsStep 5: Set the transaction information
Set up additional component configuration, and set the initial transaction information. For example: For v6.0.0 or later, you must includeisExpress: true.
Get transaction information
Step 6: (Optional) Add additional configuration
In your configuration object, you can include additional configuration supported by the Google Pay request object. For example, to require the shopper’s email and full billing address at checkout, include the following configuration:
Add additional configuration
Step 7: Update the payment data
Implement the callback to get updated payment data from Google Pay, like if the shipping address changes. You must come up with the logic to get the new shipping options and calculate the new total. You can do this by implementing your own functions likefetchNewShippingOptions and calculateNewTransactionInfo. For example:
Get updated payment data from Google Pay
onSubmit to make the /payments request.
Step 8: Configure the callback to get the shopper’s information
Implement the event handler to get the shopper’s information from Google Pay. This is triggered beforeonSubmit:
Get the shopper information from Google Pay payment data