🎉 Celebrate with 10% OFF on All Products! Use Code: GFEX10 Or Buy Any 2+ Items for 30% OFF with Code: GFEX30!
Guides & Tutorials November 5, 2026

How to Take Moyasar Payments with Gravity Forms (mada, Apple Pay, STC Pay)

GravityExtra
How to Take Moyasar Payments with Gravity Forms (mada, Apple Pay, STC Pay)

Customers in Saudi Arabia expect to pay the way they pay everywhere else: with their mada card, a Visa or Mastercard, Apple Pay on their phone or STC Pay. Moyasar brings these together on one hosted invoice page. If your workshops, bookings, registrations, deposits or donations already run on Gravity Forms, you can send each submission straight to that page and get a paid, checked entry back. This guide walks through the setup with the Gravity Forms Moyasar Premium Add-on, from test mode to your first real riyals.

Before you begin

Moyasar is a payment gateway for businesses in Saudi Arabia, and this add-on charges in Saudi riyals (SAR) by default, sending amounts in halalas. Set the Gravity Forms currency to Saudi Riyal (the add-on adds it to the Gravity Forms list when it is missing). Your customers pay on the Moyasar invoice page with the methods your Moyasar account offers there, such as mada, Visa, Mastercard, Apple Pay and STC Pay. If Moyasar has enabled multi-currency on your account, AED, QAR, USD, BHD and KWD work too (card payments only).

Why connect Gravity Forms to Moyasar

  • One form, one payment: the customer fills in your form and pays right after, without a shop or a cart.
  • The charge is the total Gravity Forms calculates on your server, so a price changed in the browser is never what gets charged.
  • Customers see the payment methods they know, including mada and STC Pay, on a page run by Moyasar.
  • The entry tells you whether the customer paid, how, and with which Moyasar invoice and payment, and you refund from the same screen.
  • Booking emails can wait until the money is really there.

What you need

  • A Moyasar account. Test mode is ready right away; live payments start when Moyasar has activated your business.
  • Gravity Forms 2.9 or newer, with the currency set to Saudi Riyal.
  • A public site on HTTPS, so Moyasar can send webhooks.
  • The add-on: one site $49 a year, five sites $69 a year, unlimited sites $199 a year.

Step 1: Copy your secret key

Log in to the Moyasar dashboard and open Settings → API Keys. You see a publishable key and a secret key for each mode. The add-on only needs the secret key: sk_test_ for test mode and sk_live_ for live mode. Keep it to yourself: it stays on your server, the add-on stores it encrypted, and every call to Moyasar is made from your server with it.

Moyasar value Needed?
Secret key (sk_test_ / sk_live_) Yes, one per mode: creates invoices, reads them back, refunds and registers the webhook
Publishable key (pk_) No: it is for card forms on your own page, which the add-on does not use
Webhook secret token Yes, created for you from the settings page (one per mode)

Step 2: Install the add-on and connect

Install and activate the add-on, open Forms → Settings → Moyasar and activate your licence. Leave the mode on Test, paste the test secret key and save. The account line turns green with a masked key, and the currency line confirms Saudi riyals.

Moyasar settings: test or live mode, the secret key of each mode, the payment window, the Saudi riyal currency line and the account-ready line with a masked sk_test_ key
Settings: choose test or live mode and paste the secret key from Settings, API Keys in the Moyasar dashboard. Keys are stored encrypted.

The payment window sets how many hours the invoice page can be paid; 72 hours is the default. For events with a deadline, a shorter window keeps unpaid places from blocking your calendar: when it runs out, Moyasar expires the invoice and the entry fails with a link to start again.

Step 3: Register the webhook

Moyasar tells your site about every payment with a webhook. In the Webhooks section of the settings, press Register the test webhook in Moyasar. The add-on registers your webhook address in your Moyasar account for the payment events, with a new random secret token, and saves the token encrypted. Every webhook Moyasar sends carries that token, and the add-on refuses webhooks without it. Do this again in live mode later; the same address serves both modes.

If you prefer the dashboard, open Settings → Webhooks in Moyasar, add the address shown in the add-on with HTTP method POST, choose a secret token of at least 16 characters and the payment events, and paste the same token into the add-on.

Step 4: Build the form

Add your product fields with a total, plus whatever you need from the customer, such as a name and an email. Quantities, options and calculations work as usual, and amounts keep their halalas. The invoice carries only the amount and your description, so you decide which customer details stay on your site.

A calligraphy workshop booking form with name, email, workshop places and starter kits with quantities, the total in Saudi riyals and the Continue to payment button
The form your customer fills in. Card details are entered on the Moyasar invoice page, not here.

Step 5: Add the Moyasar feed

In the form settings, open Moyasar and add a feed. Choose Products and Services with the form total and write an invoice description such as Workshop booking #{entry_id}; it appears on the Moyasar page next to the amount, so the customer knows what they are paying for. Keep the option to send notifications only after payment.

The Moyasar feed: products and services with the form total, the invoice description with merge tags and the option to send notifications only after payment
The feed: choose the amount and write the invoice description the customer sees on the Moyasar page.

Step 6: Test in test mode

  1. Open the form, fill it in and press the submit button.
  2. You land on the Moyasar invoice page in test mode. Pay with a test card from the Moyasar documentation.
  3. You come back to your confirmation, and the entry shows Paid with the invoice, the payment and the method.
  4. Try a declined test card: the invoice page stays open for another try, and the failed attempt is noted on the entry.
  5. Let an invoice expire, or cancel it in the dashboard: your page says nothing was charged, the entry is Failed, and Try the payment again opens a fresh invoice.

How each payment is verified

A webhook is accepted only if it carries the secret token of its mode, compared in constant time. After that the add-on does not take the webhook at its word: it reads the invoice and the payment back from Moyasar with your secret key and compares the invoice, your reference, the amount in halalas, the currency and the status with the entry. Only an invoice that Moyasar reports as paid marks the entry paid, and a repeated webhook never pays twice.

What the customer sees

  1. Your form, with the total in riyals updating as they choose places or extras.
  2. The Moyasar invoice page with the amount, your description and the payment methods of your account.
  3. Your own confirmation after paying. If the payment is still being confirmed, the page says so and checks again by itself.
  4. If a payment is still in progress, for example while an STC Pay code is entered, a message that the payment is being processed.
  5. If the invoice expires, a clear message that nothing was charged and a link to try again.

Payments in progress and failed attempts

Some payments take a moment: a 3-D Secure step at the bank, or the one-time code of an STC Pay payment. While Moyasar shows such an attempt in progress, the entry waits as Pending and your held notifications stay held. When the payment completes, Moyasar sends a webhook, the add-on reads the invoice and the entry becomes Paid. A declined attempt does not fail the entry, because the customer can try again on the same invoice page; the attempt and its reason are noted so you can see what happened.

Refunds from the entry

Open a paid entry and use the refund form in the Moyasar box. The add-on reads the payment first, sends the refund, reads the payment again and books the new refunded amount. Refund all of it at once or part of it in several steps, up to the amount paid; each request is sent only once, so a double click never refunds twice. Refunds and voids made in the Moyasar dashboard are booked too, after the add-on has read the payment.

An entry paid with mada through Moyasar and partly refunded: the Moyasar box with the status, invoice, payment, card, Moyasar status, amount, refunded amount and the refund form
The entry after payment: status, Moyasar invoice and payment, the method, and refunds from the entry screen.
Situation What happens
Full or partial refund from the entry Sent to Moyasar, read back and booked: Partially Refunded or Refunded
Refund made in the Moyasar dashboard Booked from the payment’s refunded amount when the webhook arrives
Payment voided in the dashboard The entry becomes Voided
Not enough balance (aggregation accounts) Moyasar refuses the refund; the entry does not change and a note explains why

What about subscriptions?

Moyasar charges saved cards with tokens that are created from a card form on your own page. The add-on keeps every payment on the hosted invoice page and does not offer a subscription option: each form submission is one payment. For monthly fees, a reminder email with a link to the form works well.

Good uses

Business Form
Workshops and classes Places, materials and starter kits
Clinics and services Deposits and appointment fees
Tours and stays Bookings with dates, guests and extras
Events and communities Tickets, registrations and merchandise
Schools and associations Enrolment fees, uniforms and donations

Going live

  1. Wait until Moyasar has activated your account for live payments.
  2. In the dashboard, open Settings, API Keys and copy the live secret key.
  3. Paste it into the Live field of the add-on, choose Live and save.
  4. Press Register the live webhook in Moyasar.
  5. Make one small real payment and refund it from the entry.

A quick checklist

Check Where
Account line green in the right mode Forms, Settings, Moyasar
Forms use Saudi Riyal Forms, Settings, Currency
Webhook registered for test and live mode Forms, Settings, Moyasar, Webhooks
Secret token saved for the mode you use Forms, Settings, Moyasar, Webhooks
A paid card, a declined card, an expired invoice and a refund tested Test mode

Wrapping up

With the add-on in place, your Gravity Forms send customers to the Moyasar invoice page with the ways people in Saudi Arabia pay every day, every webhook is checked with your secret token, every result is read back from Moyasar and checked on your server before an entry changes, and refunds run from the entry screen. Read the full setup guide for every setting, or get the Gravity Forms Moyasar Premium Add-on for one site $49 a year, five sites $69 a year, unlimited sites $199 a year.

0
0
Your Cart
Your cart is emptyReturn to Shop
🔥 FREQUENTLY BOUGHT TOGETHER
Complete Combo & Save 40%!
ITEM IN YOUR CART
Gravity Forms Klaviyo Add-on
$39.00/yr
+
🎁 RECOMMENDED ADD-ON SAVE 40% OFF
Original Price: $39.00/yr
Bundle Special Price: $23.40/yr