> For the complete documentation index, see [llms.txt](https://docs.payr.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.payr.com/payment-interface/payr-sdk/features/wallet-payments-setup-apple-pay-and-google-pay.md).

# Wallet Payments Setup (Apple Pay & Google Pay)

### Overview

Wallet payments offer a provide fast, secure payments with biometric authentication instead of manual card entry:

* **Apple Pay**&#x20;
* **Google Pay**

**Important:** Both wallets require a one-time setup process with Payr support before they can be used.

***

### SDK Implementation

#### Enable Wallet Payments

Add the `applePay` and `googlePay` feature flags when initializing the SDK:

```javascript
PAYR.init({
  apiBaseUrl: 'https://api.mypayr.co.uk',
  authToken: token,
  container: '#payr-payment-form',
  features: {
    applePay: true,   // Enable Apple Pay button
    googlePay: true   // Enable Google Pay button
  },
  onSuccess: (result) => {
    console.log('Payment successful:', result);
  },
  onError: (error) => {
    console.error('Payment failed:', error);
  }
});
```

#### What Happens When Enabled

When wallet feature flags are enabled:

* The SDK automatically checks if the wallet is available on the user's device/browser
* **Apple Pay button** appears if:
  * Device supports Apple Pay
  * Site is served over HTTPS
  * Domain is verified (see setup below)
* **Google Pay button** appears if:
  * User is on Chrome/Android (or supported browser)
  * Device supports Google Pay
  * Domain is allowlisted (see setup below)

### Apple Pay Setup

Apple Pay requires a **one-time domain verification** process coordinated with Payr support.

#### Setup Process

1. **Request Apple Pay** - Contact **<support@mypayr.co.uk>** to request Apple Pay enablement for your domain
2. **Receive Verification File** - Payr will email you a verification file named `apple-developer-merchantid-domain-association`
3. **Host Verification File** - Upload the file to your web server at:

   ```
   https://yourdomain.com/.well-known/apple-developer-merchantid-domain-association
   ```

   **Important:**

   * Must be accessible at the exact path shown (no redirects)
   * Must be served over HTTPS
   * File should return `200 OK` when accessed directly
4. **Verify Domain** - Notify Payr support once the file is hosted. Payr admin will verify the domain in Apple Developer Portal
5. **Enablement** - Payr admin enables `apple_pay_enabled` in the backend for your domain
6. **Apple Pay Button Appears** - The Apple Pay button will automatically appear in your SDK integration

#### Requirements

* **HTTPS Required** - Apple Pay only works on secure connections
* **Merchant Validation** - Automatic at runtime (handled by Payr backend)

***

### Google Pay Setup

Google Pay has a simpler setup process.

#### Setup Process

1. **Request Google Pay** - Contact **<support@mypayr.co.uk>** to request Google Pay enablement
2. **Domain Allowlisting** - Provide your domain(s). Payr admin will allowlist them in Google Pay configuration
3. **Enablement** - Payr admin enables `google_pay_enabled` in the backend
4. **Google Pay Button Appears** - The Google Pay button will automatically appear in your SDK integration

#### Requirements

* **HTTPS Recommended** - Required for production (localhost allowed for development)
* **Environment** - TEST mode in sandbox, PRODUCTION mode in production

***

#### Benefits

* **Faster checkout** - No card details to type
* **Biometric authentication** - Face ID, Touch ID, or fingerprint
* **Higher conversion** - Reduced friction leads to more completed payments
* **Secure** - Tokenized payments, no card data exposed

#### Important Limitations

* **One-time payments only** - Wallets don't support recurring payments (use cards for recurring payments)

***

### Testing Wallet Payments

#### Apple Pay Testing

**Sandbox Environment:**

* Use Safari on macOS or iOS device
* Set up a Sandbox Apple ID in Settings
* Add test cards to Wallet
* Test on `https://localhost` or your staging domain (after verification)

**Production Environment:**

* Use real Apple ID with real cards
* Test on your production domain (after verification)

#### Google Pay Testing

**Sandbox Environment:**

* SDK automatically uses Google Pay TEST environment
* Use test card numbers in Google Pay
* Available on Chrome desktop and Android

**Production Environment:**

* SDK automatically uses Google Pay PRODUCTION environment
* Real cards required

***

### Support

Need help with wallet payment setup? Contact **<support@mypayr.co.uk>**
