## Check if a payment can be made

`paymentRequest.canMakePayment()`

Returns a `Promise` that resolves with an object detailing if an enabled wallet is ready to pay. If no wallet is available, it resolves with `null`. The resolution object has the properties in the table below.

**NOTE**: The `paymentRequestButton` element automatically shows the correct wallet branding. You shouldn't need to inspect the return object's properties unless you are building your own custom button.

> `canMakePayment` resolves to `null` outside the following supported cases:
>
> * Safari 10.1+ (desktop and mobile)
> * with a saved Apple Pay card
> * or when in a Private Browsing window
> * or when the “Allow websites to check if Apple Pay is set up” preference is disabled
> * Chrome 61+ (desktop and mobile)
> * with a saved Google Pay card
> * or when the browser has a saved card (i.e. autofill)
>
> For more information, see [Testing your integration](https://docs.stripe.com/stripe-js/elements/payment-request-button.md#testing).

### Return object properties

- `applePay`
`true` if Apple Pay wallet is ready to pay. In this case:
- `paymentRequestButton` Element will show as a branded Apple Pay button automatically.
- When using a custom button, you‘ll want to show a button that conforms to the Apple Pay [Human Interface Guidelines](https://developer.apple.com/apple-pay/web-human-interface-guidelines/).

- `googlePay`
`true` if Google Pay wallet is ready to pay. In this case:
- `paymentRequestButton` Element will show as a branded Google Pay button automatically.
- When using a custom button, you'll want to show a button that conforms to the Google Pay [Brand Guidelines](https://developers.google.com/pay/api/web/guides/brand-guidelines).

- `link`
`true` if Link wallet is ready to pay. In this case:
- `paymentRequestButton` Element will show as a branded Link button automatically.
- Link is not supported in custom button configurations.

### Example

```javascript
// Create a new PaymentRequest
const paymentRequest = stripe.paymentRequest({
  country: 'US',
  currency: 'usd',
  total: {
    label: 'Demo order',
    amount: 1000,
  },
});

// Check if Apple Pay or Google Pay is available
const result = await paymentRequest.canMakePayment();

if (result.applePay) {
  // Show Apple Pay button
} else if (result.googlePay) {
  // Show Google Pay button
} else {
  // Show other payment methods
}
```