This is an experimental technology
Because this technology's specification has not stabilized, check the compatibility table for usage in various browsers. Also note that the syntax and behavior of an experimental technology is subject to change in future versions of browsers as the specification changes.

The PaymentRequest.complete() method of the PaymentRequest API notifies the user agent that the user interaction is over, and causes any remaining user interface to be closed. This method must be called after the user accepts the payment request and the Promise returned by the method is resolved.


   .then(function() { ... } )
   .catch( error => { ... } )


A Promise.


A string with one of the following values:
  • "success": Indicates the payment was successfully processed. The user agent may or may not indicate success to the user.
  • "fail": Indicates the payment was not successfully processed. The user agent may or may not indicate failure to the user.
  • "" (empty string): The user agent will show nothing to the user.  This is the default.

Note: The value passed to this method must include the quotation marks.


The following example sends payment information to a secure server using the Fetch API. It calls complete() with an answer appropriate to the status in the response.

// Initialization of PaymentRequest arguments are excerpted for the 
//   sake of brevity.
var payment = new PaymentRequest(supportedInstruments, details, options); {
  var fetchOptions = {
    method: 'POST',
    credentials: include,
    body: JSON.stringify(paymentResponse)
  var serverPaymentRequest = new Request('secure/payment/endpoint');
  fetch(serverPaymentRequest, fetchOptions).then( response => {
    if (response.status < 400) {
    } else {
  }).catch( reason => {
}).catch(function(err) {
  console.error("Uh oh, something bad happened", err.message);


Specification Status Comment
Payment Request API
The definition of 'PaymentResponse' in that specification.
Working Draft Initial definition.

Browser Compatibility

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari (WebKit)
Basic support


? ? ? ?
Feature Android Android Webview Firefox Mobile (Gecko) Firefox OS IE Mobile Opera Mobile Safari Mobile Chrome for Android
Basic support No support 53.0 ? ? ? ? ? 53.0


© 2016 Mozilla Contributors
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.

API complete Method Payment Request PaymentResponse Reference