<!--
{
  "availability" : [

  ],
  "documentType" : "symbol",
  "framework" : "ApplePayontheWeb",
  "identifier" : "/documentation/ApplePayontheWeb/ApplePaySession/completePayment",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Apple Pay on the Web"
    ],
    "preciseIdentifier" : "instm/ApplePaySession/completePayment"
  },
  "title" : "completePayment"
}
-->

# completePayment

Completes the payment authorization with a result.

```
undefined completePayment();
```

## Parameters

`result`

The result of the payment authorization, including its status and list of errors. See [`ApplePayPaymentAuthorizationResult`](/documentation/ApplePayontheWeb/ApplePayPaymentAuthorizationResult).

## Discussion

This method must be called by [`onpaymentauthorized`](/documentation/ApplePayontheWeb/ApplePaySession/onpaymentauthorized).

Use status values of [`STATUS_SUCCESS`](/documentation/ApplePayontheWeb/ApplePaySession/STATUS_SUCCESS) or [`STATUS_FAILURE`](/documentation/ApplePayontheWeb/ApplePaySession/STATUS_FAILURE) only.  You should pass in [`STATUS_FAILURE`](/documentation/ApplePayontheWeb/ApplePaySession/STATUS_FAILURE) along with the errors.

### completePayment in Apple Pay JS API version 1 and 2

The parameter for [`completePayment`](/documentation/ApplePayontheWeb/ApplePaySession/completePayment) in versions 1 and 2 is the following:

`status`

The status of the payment, whether it succeeded or failed. See <doc://com.apple.documentation/documentation/ApplePayontheWeb/apple-pay-status-codes>.

The Apple Pay payment sheet is dismissed when this method is called with a status value of [`STATUS_SUCCESS`](/documentation/ApplePayontheWeb/ApplePaySession/STATUS_SUCCESS) or [`STATUS_FAILURE`](/documentation/ApplePayontheWeb/ApplePaySession/STATUS_FAILURE). Other status values display an error on the payment sheet to prompt the user to update the information and authenticate again.

## See Also

[`supportsVersion`](/documentation/ApplePayontheWeb/ApplePaySession/supportsVersion)

Detects whether a web browser supports a particular Apple Pay version.



---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)