Payment Gateway Setup

This is the most critical configuration step. If your gateway is not set up correctly โ€” specifically the webhook โ€” payments will appear to succeed but subscribers will receive no access. Read every step carefully.

๐Ÿšจ
The #1 reason "plugin is not working"

In almost every case where payment succeeded but no account was created, the webhook was not configured in the gateway dashboard. Complete Webhook Configuration before going live.

How the Payment Flow Works

Understanding this flow is essential for diagnosing any issues:

1

Reader clicks Pay button on your subscribe page

The gateway's checkout opens (Razorpay modal, Cashfree redirect, etc.) in the reader's browser.

2

Reader completes payment

Money moves from reader's account to your gateway account. The gateway shows a success screen.

3

Gateway sends a webhook to your site

This is a server-to-server notification from the gateway to your WordPress site saying "payment captured." This is what actually triggers account creation. The reader never sees this โ€” it happens in the background.

4

MyPaywall receives the webhook and creates the account

The plugin verifies the webhook signature, creates (or updates) the WordPress user account, sets the plan and expiry, and sends the welcome email.

5

Reader is redirected to the thank-you page

They are now logged in with full access to premium content.

โš ๏ธ
Step 3 is where most setups fail

If the webhook URL is wrong, not registered, or your site blocks the gateway's request, step 4 never happens. Payment was taken but no account exists. This is why webhook setup is mandatory.

Razorpay Setup

Razorpay is the recommended gateway for Indian sites. It supports UPI, cards, net banking, wallets, and EMI.

Step 1 โ€” Create a Razorpay account

Go to razorpay.com and sign up. Complete KYC verification with your PAN, GST (if applicable), and bank account details. Razorpay typically activates accounts within 1โ€“2 business days.

โ„น๏ธ
Test mode vs Live mode

Razorpay has two modes. In Test mode, no real money moves โ€” you use special test card numbers. In Live mode, real payments are processed. Always test first, then switch to Live when ready.

Step 2 โ€” Get your API keys

1

Log into your Razorpay Dashboard

Go to dashboard.razorpay.com and log in.

2

Navigate to Settings โ†’ API Keys

In the left sidebar, click Settings, then API Keys.

3

Generate test mode keys

Make sure the toggle at the top shows Test Mode. Click Generate Test Key. You will see a Key ID (starts with rzp_test_) and a Key Secret. Copy both โ€” the secret is shown only once.

4

Enter keys in MyPaywall

In WordPress, go to Settings โ†’ MyPaywall โ†’ Payment Gateway. Select Razorpay. Enter your Key ID and Key Secret. Enable Test Mode. Click Save Settings.

Step 3 โ€” Register your webhook (critical)

See the Webhook Configuration section below โ€” complete this before testing.

Step 4 โ€” Register your domain

See Domain Registration below. Your site domain must be added to your Razorpay account or payments will be blocked.

Cashfree Setup

Cashfree is an alternative Indian gateway with competitive rates and supports all major payment methods.

1

Create account at cashfree.com

Sign up at merchant.cashfree.com and complete KYC. Approval is usually within 1 day.

2

Get App ID and Secret Key

Go to Merchants Dashboard โ†’ Developers โ†’ API Keys. Copy your App ID and Secret Key (test credentials for sandbox mode).

3

Enter in MyPaywall

In WordPress, go to Settings โ†’ MyPaywall โ†’ Payment Gateway. Select Cashfree. Enter App ID and Secret Key. Enable Test Mode. Save.

4

Register webhook

In Cashfree Dashboard โ†’ Developers โ†’ Webhooks, add your MyPaywall webhook URL. See Webhook Configuration.

PhonePe Setup

PhonePe Payment Gateway (for merchants, separate from the consumer app) supports UPI and cards.

1

Apply at business.phonepe.com

PhonePe gateway requires a business account with GST number. Apply online โ€” approval takes 2โ€“5 business days.

2

Get Merchant ID and API key

From your PhonePe merchant dashboard, copy your Merchant ID and API key.

3

Enter in MyPaywall and register webhook

In Settings โ†’ MyPaywall โ†’ Payment Gateway, select PhonePe. Enter credentials. Register the webhook URL in your PhonePe dashboard.

Stripe Setup

Stripe supports credit cards, Apple Pay, Google Pay, and more โ€” available in 46+ countries. Note: Stripe does not currently accept new accounts from Indian merchants directly. International publishers outside India can use Stripe freely.

1

Create a Stripe account

Go to stripe.com and sign up. For international publishers, activation is instant. Complete identity verification in the Stripe Dashboard.

2

Get your API keys

In your Stripe Dashboard โ†’ Developers โ†’ API keys, copy your Publishable key (starts with pk_live_) and Secret key (starts with sk_live_). Use pk_test_ / sk_test_ for testing.

3

Enter in MyPaywall and register webhook

In Settings โ†’ MyPaywall โ†’ Payment Gateway, select Stripe. Enter your Publishable and Secret keys. Click Register Webhook Automatically โ€” MyPaywall will create the webhook in Stripe for you.

PayPal Setup

PayPal is available in 200+ countries and 25+ currencies. Ideal for publishers whose readers prefer PayPal or are outside India and Europe.

1

Create a PayPal Developer app

Go to developer.paypal.com โ†’ My Apps & Credentials โ†’ Create App. Give it any name. You will get a Client ID and Client Secret.

2

Enter in MyPaywall

In Settings โ†’ MyPaywall โ†’ Payment Gateway, select PayPal. Enter your Client ID and Client Secret. Set Currency (e.g. USD, EUR, GBP). Enable Sandbox mode for testing, disable for live payments.

3

Add webhook in PayPal

In your PayPal developer app โ†’ Webhooks โ†’ Add Webhook. Paste the webhook URL shown in MyPaywall settings. Select event: CHECKOUT.ORDER.APPROVED.

Mollie Setup

Mollie is the most popular payment gateway in Europe, covering iDEAL (Netherlands), Bancontact (Belgium), SOFORT (Germany), SEPA, Klarna, credit cards, Apple Pay, and 20+ more โ€” all from a single integration. Ideal for European publishers.

1

Create a Mollie account

Go to mollie.com and sign up. Verification is quick โ€” usually same day. No monthly fees, pay-per-transaction only.

2

Get your API key

In your Mollie Dashboard โ†’ Developers โ†’ API keys. Copy the Live API key (starts with live_) for production, or Test API key (starts with test_) for testing.

3

Enter in MyPaywall โ€” no manual webhook needed

In Settings โ†’ MyPaywall โ†’ Payment Gateway, select Mollie. Enter your API key and set your currency (e.g. EUR). No manual webhook setup is required โ€” MyPaywall sets the webhook URL automatically per payment.

Webhook Configuration

This is the most important step. Without a correctly configured webhook, payments will be taken but no accounts will be created.

๐Ÿ”—
Your MyPaywall webhook URLs

Replace yoursite.com with your actual domain.

https://yoursite.com/wp-json/rpw/v1/razorpay
https://yoursite.com/wp-json/rpw/v1/cashfree
https://yoursite.com/wp-json/rpw/v1/phonepe
https://yoursite.com/wp-json/rpw/v1/stripe
https://yoursite.com/wp-json/rpw/v1/paypal

Note: Mollie does not need a webhook URL entered manually โ€” it is set automatically per payment by MyPaywall.

Registering the Razorpay Webhook

1

Open Razorpay Dashboard โ†’ Settings โ†’ Webhooks

Log into dashboard.razorpay.com. Click Settings in the left sidebar. Click Webhooks.

2

Click "Add New Webhook"

A form opens asking for Webhook URL and Secret.

3

Enter the webhook URL

Paste: https://yoursite.com/wp-json/rpw/v1/razorpay โ€” replacing yoursite.com with your actual domain. The URL must start with https://.

4

Create and copy a webhook secret

Type a long random string as the webhook secret (e.g. mpw_secure_2024_xk9qr8). Keep this secret โ€” you will paste it into MyPaywall next. Razorpay uses this to sign webhook requests so your site can verify they are genuine.

5

Select the required events

Check the following event: payment.captured. This is the event that fires when a payment is successfully captured. Click Create Webhook.

6

Enter the webhook secret in MyPaywall

In WordPress, go to Settings โ†’ MyPaywall โ†’ Payment Gateway โ†’ Razorpay section. Find the Webhook Secret field. Paste the same secret you entered in Razorpay. Click Save Settings.

โš ๏ธ
Webhook secret mismatch = silent failure

If the secret in MyPaywall does not exactly match what you entered in Razorpay, the plugin will reject every webhook silently. Double-check: no extra spaces, same case, copy-paste don't retype.

Verify the webhook is working

After saving, go back to Razorpay Dashboard โ†’ Settings โ†’ Webhooks. Click on your webhook URL. You will see a Test button. Click it. If your site returns a 200 response, the webhook is working. If it returns 400 or 0, there is a problem โ€” see Troubleshooting below.

Domain Registration with Razorpay

This is a separate requirement from the webhook. Razorpay only processes payments from domains registered on your account.

๐Ÿšจ
Payment blocked due to domain mismatch

If you use the plugin on a domain not registered with your Razorpay account, Razorpay will block the payment with an "unauthorized domain" error. You may not see an obvious error โ€” the payment will simply fail silently.

1

Go to Razorpay Dashboard โ†’ Settings โ†’ Website / App Details

This section is sometimes under Business Settings or Profile depending on your account type.

2

Add your site's domain

Enter your domain exactly as it appears in the browser (e.g. myblog.com or www.myblog.com). If you install the plugin on multiple sites, each domain must be added.

3

Save and wait for approval

For verified accounts, domain addition is usually instant. New accounts may require review. You will receive an email confirmation.

โ„น๏ธ
One Razorpay account per business, any number of domains

You do not need separate Razorpay accounts for different sites. Add all your domains to the same account. However, each customer installing MyPaywall on their own site needs their own Razorpay account โ€” they cannot share yours.

Testing Payments

Always test with test mode enabled before going live. No real money is moved in test mode.

Razorpay test credentials

Payment Method Test Value OTP / PIN
Visa card (success) 4111 1111 1111 1111 Any 3-digit CVV, any future expiry, OTP: 1234
Visa card (failure) 4000 0000 0000 0002 โ€”
UPI (success) success@razorpay โ€”
UPI (failure) failure@razorpay โ€”
Net banking Select any bank, use test credentials Any values
โœ…
What to check after a successful test payment

1. A new WordPress user was created at WP Admin โ†’ Users with the subscriber's email. 2. The user's profile shows the correct plan, expiry date, and amount. 3. A welcome email was received. 4. The user can now read premium content when logged in.

Switching to Live mode

When you are ready to accept real payments:

  1. In Razorpay Dashboard โ†’ Settings โ†’ API Keys, generate Live mode keys (the toggle must show Live Mode). Live keys start with rzp_live_.
  2. In WordPress โ†’ Settings โ†’ MyPaywall โ†’ Payment Gateway, replace the test keys with your live keys.
  3. Disable Test Mode.
  4. In Razorpay Dashboard โ†’ Settings โ†’ Webhooks, create a new webhook for live mode (test and live webhooks are separate). Use the same URL but a new or same webhook secret.
  5. Update the Webhook Secret in MyPaywall if you changed it.
  6. Save Settings.
โš ๏ธ
Test mode and Live mode have separate webhooks

In Razorpay, webhooks registered in Test mode do not work in Live mode and vice versa. You must register your webhook URL in both modes separately.

Troubleshooting

Payment succeeded, but no subscriber account was created

Cause: Webhook not configured, wrong URL, wrong secret, or server blocking the request.

Fix: Go to Razorpay Dashboard โ†’ Settings โ†’ Webhooks โ†’ click your webhook โ†’ check delivery attempts and response codes. A 200 = working. A 400 = wrong secret. A 0 or connection refused = server is blocking the request.

If your site uses a security plugin (Wordfence, iThemes Security, etc.), add the gateway's IP ranges to your allowlist, or temporarily disable the security plugin and test again.

Payment modal does not open

Cause: Wrong API Key ID, Test Mode mismatch, or domain not registered.

Fix: Confirm your Key ID starts with rzp_test_ if Test Mode is ON, or rzp_live_ if Test Mode is OFF. Confirm your domain is added to Razorpay account. Check browser console for error messages.

"Unauthorized domain" or payment silently fails

Cause: Your site's domain is not registered in Razorpay account.

Fix: See Domain Registration above. Add the exact domain and wait for confirmation.

Webhook test returns 400

Cause: Webhook secret in MyPaywall does not match the secret in Razorpay.

Fix: In Razorpay, delete the webhook and create a new one. Copy the secret exactly. Paste it in Settings โ†’ MyPaywall โ†’ Payment Gateway โ†’ Razorpay โ†’ Webhook Secret. Save.

Webhook test returns 404

Cause: WordPress REST API is disabled or the permalink structure is not set to use post names.

Fix: Go to WordPress โ†’ Settings โ†’ Permalinks. Select Post name and save. This flushes the rewrite rules and re-registers the REST API routes. Test the webhook again.