Skip to main content
Unlisted page
This page is unlisted. Search engines will not index it, and only users having a direct link can access it.

Google Pay on Websites

This guide will walk you through adding Google Pay to your website and accepting payments using Moyasar.

Before Starting

Create Your Google Pay Merchant Profile

Follow this guide to set up your merchant profile and acquire your merchantId from Google.

Add Your Website To Google Wallet

Follow this guide to accept Google Pay payments from your website.

Ensure you select Gateway as the integration type.

Initialize The Moyasar Form

Follow our basic integration guide to successfully show the web form.

Add the following configuration to show the Google Pay button:

Moyasar.init({
element: '.mysr-form',
amount: 1000,
currency: 'SAR',
description: 'Coffee Order #1',
publishable_api_key: 'YOUR_PUBLISHABLE_API_KEY',
callback_url: 'https://moyasar.com/thanks',
methods: ['creditcard', 'googlepay'], // Add Goolge Pay Method
google_pay: {
// Add Google Pay Config
merchant_id: 'MERCHANT_ID',
country: 'SA',
label: 'MERCHANT_NAME',
environment: 'PRODUCTION',
},
on_completed: async function (payment) {
await savePaymentOnBackend(payment);
},
});

You are now ready to accept Google Pay payments.