Apple Pay & Google Pay Integration

Accept tap-to-pay directly on your website — fast, secure, and customer-friendly!
The myPOS Embedded SDK lets you add Apple Pay and Google Pay buttons directly to your website, giving your customers a seamless one-tap checkout experience.

What's the benefit? Customers can pay in seconds without entering card details — perfect for mobile shoppers!

Step 1: Create a Payment Session

First, create a payment session via API to get your SessionToken:

API Endpoint: IPCPaymentSessionCreate
Response: JSON containing a SessionToken

Important: You'll need this token to initialize the SDK in the next steps.

Step 2: Add the myPOS Embedded SDK

Choose your preferred installation method:

Option 1: Via Script Tag

<script src="https://developers.mypos.com/repository/mypos-embedded-sdk.js" type="text/javascript"></script>

Option 2: Import via JavaScript

import * as MyPOSEmbedded from 'mypos-embedded-checkout';

Latest version: mypos-embedded-checkout on npm

Step 3: Add the Button Placeholder

Add this div where you want the payment button to appear:

<div id="embeddedButtons"></div>

Step 4: Initialize Apple Pay or Google Pay

Use this code to automatically show the right button based on the user's device:

if (MyPOSEmbedded.IS_APPLE_PAY_AVAILABLE) {
    // Show Apple Pay button
    MyPOSEmbedded.createApplePayButton(
        'embeddedButtons',
        sessionToken, // From Step 1
        {
            isSandbox: true,
            merchantName: "Your Store Name",
            onSuccess: function (data) {
                console.log('Payment successful!', data);
            },
            onDecline: function (err) {
                console.error('Payment declined', err);
            }
        }
    ).then((sessionData) => {
        console.log('Apple Pay button loaded');
    }).catch((err) => {
        console.error('Error loading button:', err);
    });
} else {
    // Show Google Pay button
    MyPOSEmbedded.createGooglePayButton(
        'embeddedButtons',
        sessionToken, // From Step 1
        {
            isSandbox: true,
            onSuccess: function (data) {
                console.log('Payment successful!', data);
            },
            onDecline: function (data) {
                console.error('Payment declined', data);
            }
        }
    ).then((sessionData) => {
        console.log('Google Pay button loaded');
    }).catch((err) => {
        console.error('Error loading button:', err);
    });
}

How it works: The SDK automatically detects if the user's device supports Apple Pay, and shows the appropriate button.

Step 5: Configure Apple Pay (Apple Devices Only)

To use Apple Pay, you need to verify your domain with Apple:

1. Host the Domain Verification File

Download and host this file at:

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

2. Update Your Store Settings in myPOS

  • Go to Store Settings in your myPOS account
  • Add the URL of the page where the Apple Pay button will be used under: "Embedded Apple Pay button URL"
  • Ensure this same URL is listed in "Request URLs"
  • Click Save to apply the changes

That’s it!

You’ve now enabled Apple Pay and Google Pay on your site using the myPOS Embedded SDK. For any issues, be sure to check console logs and confirm proper configuration of session tokens and domain verification.