Bitcoin
$32,157.01 -9.31%
BTC · 196w

Google is Adding XBT into Payment Options https://developers.google.com/web/fundamentals/discovery-and-monetization/payment-request/images/deep-dive/usd-bitcoin-comparison.png

Matt is a contributor to WebFundamentals
Payment request UI on desktop and mobile Chrome.

In this guide we'll explore the ins and outs of the Payment Request API, looking at how our input affects the payment request UI, how we can request information from the user (like name and phone number), and how the final payment and user information is passed to your site.

If you are unsure of what the Payment Request API is or why it's useful, check out the introduction article.

One thing to keep in the back of your mind when working with the Payment Request API is that the API manages the UI but performs no arithmetic; it will simply display whatever input you pass to it. Throughout the examples we'll discuss what this means for the developer and user.

Dogfood: PaymentRequest is still in development. While we think it's stable enough to implement, it may continue to change. We'll keep this page updated to always reflect the current status of the API. Meanwhile, to protect yourself from API changes that may be backwards incompatible, we're offering a shim that can be embedded on your site. The shim will paper over any API differences for two major Chrome versions. Feature Detect

Payment Request has been available since Chrome 53 for Android and has been enabled by default since Chrome 61 on desktop. Before we start covering how to use Payment Request, we should feature detect to ensure it's available and fallback to a traditional checkout page in browsers that don't support it.

The feature detect is simply:

if(window.PaymentRequest) { // Use Payment Request API } else { // Fallback to traditional checkout window.location.href = '/checkout/traditional'; } Note: Payment Request is only available on sites served over HTTPS. PaymentRequest Constructor

Once you are ready to collect payment details from the user, you'...

Continue on developers.google.com
Recent news