🎉 Celebrate with 10% OFF on All Products! Use Code: GFEX10 Or Buy Any 2+ Items for 30% OFF with Code: GFEX30!

Gravity Forms PayFast Payment Premium Add-on Setup Guide

Updated 8 min read Gravity Forms Payments & Pricing
On this page
  1. What you need
  2. Install and activate
  3. Connect Sandbox and Live
  4. Add a PayFast feed
  5. What the visitor sees
  6. Payment notifications
  7. Subscriptions
  8. Saved cards and extra charges
  9. The entry screen and refunds
  10. For developers
  11. Frequently asked questions
  12. PayFast says the signature does not match. What is wrong?
  13. The visitor paid but the entry still says Processing.
  14. Can I take other currencies?
  15. Is the card stored on my site?
  16. Does it work with conditional logic and multi-page forms?
  17. Get the add-on

The Gravity Forms PayFast Payment Premium Add-on takes payments in South African rand with your forms through your own PayFast account. When a visitor submits the form, the add-on prepares the payment for the exact total Gravity Forms worked out on the server, signs it with your passphrase and sends the visitor to the PayFast payment page. Card and bank details are entered on PayFast, never on your website. PayFast then sends a payment notification to your site, and the entry is marked paid only after that notification has passed four security checks. This guide covers what you need, connecting Sandbox and Live, one-off payments, subscriptions, saved cards, refunds and the questions merchants ask most.

What you need

  • WordPress 6.5 or newer, PHP 7.4 or newer and Gravity Forms 2.9 or newer.
  • A PayFast merchant account. Your merchant ID and merchant key are on the Settings page of your PayFast dashboard. For tests, use the free PayFast sandbox at sandbox.payfast.co.za, which has its own merchant ID and key.
  • A passphrase (PayFast also calls it the salt passphrase), set in the security section of your PayFast settings. One-off payments work without one, but PayFast requires it for subscriptions, saved cards, refunds and cancelling subscriptions, and it makes every payment harder to forge. We recommend setting one.
  • The Gravity Forms currency set to South African Rand in Forms → Settings. PayFast takes rand only.
  • Your site on HTTPS with a valid certificate for live payments.
  • A form with at least one product field (or a total). Donations and subscriptions work too.

The add-on talks to PayFast in two places only: the payment host (sandbox.payfast.co.za in Sandbox and www.payfast.co.za in Live) to confirm notifications, and the PayFast API at api.payfast.co.za for refunds, subscriptions and saved cards. Apart from that, it checks gravityextra.com for your licence and plugin updates.

Install and activate

  1. Upload the zip in Plugins → Add New → Upload Plugin and activate it.
  2. Open Forms → Settings → PayFast, enter your GravityExtra licence key and press Activate License.
  3. The PayFast account and Payment notifications sections appear once the licence is active.

Connect Sandbox and Live

The add-on starts in the Sandbox environment, where no money moves. Entries paid in Sandbox carry a “Sandbox — test payment” badge on the entry screen. Each environment has its own three settings:

  • Merchant ID: the number on your PayFast settings page.
  • Merchant key: the letters and digits next to it.
  • Passphrase: exactly as you typed it in PayFast, including capital letters. A wrong passphrase is the most common reason PayFast refuses a payment page with a signature error.

The merchant key and passphrase are stored encrypted with a key derived from your site’s security salts, are never shown again and never written to a log. The settings page shows the merchant ID and only the first and last three characters of the key. When a passphrase is saved, the add-on sends a signed test call to the PayFast API and shows whether PayFast accepted your merchant ID and passphrase.

PayFast settings: Sandbox or Live, the merchant ID, merchant key and passphrase for each, the South African rand currency line and the connected status with the masked merchant key
Settings: choose Sandbox or Live and enter the merchant ID, merchant key and passphrase. The key and passphrase are stored encrypted.

The Currency line checks that your forms use South African rand. If they use another currency, payments are refused on the form with a clear message instead of failing at PayFast.

Test before you go live

Keep Sandbox selected and make a few test payments: one that you pay, one that you cancel on the PayFast page and, if you plan to sell subscriptions, one subscription. Check the entries and the e-mails, then switch the Environment to Live, enter the live merchant ID, key and passphrase and save.

Add a PayFast feed

Open the form, go to Settings → PayFast and add a feed.

  • Transaction type: Products and Services, Donations or Subscription.
  • Payment amount: the form total or one product field.
  • Customer details: map the first name, last name, e-mail and cell number. PayFast fills them in on its page and sends its receipt to that e-mail.
  • Item name: shown on the PayFast page and in PayFast’s e-mails, up to 100 characters. Merge tags work, and the default is the form title and entry number.
  • Item description: optional, up to 255 characters, merge tags work.
  • Payment method: all methods on your PayFast account, or only credit card, debit card or instant EFT.
  • Saved card: keep a card agreement so you can charge extra amounts later (see below).
  • Notifications: send the form notifications only after the customer has paid. This is on by default, so your team never prepares an order that was not paid.
The PayFast feed: a monthly subscription for twelve payments with a setup fee, customer name, e-mail and cell number mapping, item name and description with merge tags, payment method and the notification option
The feed: a monthly subscription with a setup fee, the customer details and the item name shown on PayFast.

What the visitor sees

The visitor fills in the form and presses the submit button. A short hand-over page posts the signed payment to PayFast and the visitor lands on the PayFast payment page with the amount, the item name and their details filled in.

A wine tasting booking form with name, e-mail, cell number, two products and the total in rand, and a Continue to payment button
The form your customer fills in. Card and bank details are entered on PayFast, not here.
  • Paid: PayFast sends the visitor back to your form page. If the payment notification has already arrived, your normal Gravity Forms confirmation is shown. If not, a short “Confirming your payment” message checks again every few seconds and then shows the confirmation.
  • Cancelled: the visitor sees that the payment was cancelled and nothing was charged, with a link back to the form. The entry is marked Cancelled.
  • Failed: the entry is marked Failed and your “Payment Failed” notification is sent.

The amount sent to PayFast always comes from the server. Changing the total in the browser does not change what PayFast charges.

Payment notifications

PayFast tells your site about every payment with an Instant Transaction Notification (ITN). The add-on sends its own notification address with each payment, so there is nothing to set up in the PayFast dashboard. Every notification must pass the four checks PayFast documents before an entry changes:

  1. Signature: rebuilt from the posted values and your passphrase, and the merchant ID must be yours.
  2. Sender: the notification must come from a PayFast server address.
  3. Amount: the amount must match the entry to the cent.
  4. Server confirmation: the add-on posts the notification back to PayFast, which must answer that it is valid.

A notification that fails a check is refused and logged, and the entry stays as it was. PayFast sends a notification again when it is not accepted, and repeated notifications never complete a payment twice. If your site is behind a proxy that hides the sender address, a developer can pass the real address with the gravityextra_payfast_itn_remote_ip filter.

Subscriptions

Choose Subscription as the transaction type and the add-on creates a PayFast subscription. Set the recurring amount, the billing cycle and how many payments to take (or until cancelled). PayFast bills daily, weekly, monthly, every 3 months, every 6 months or yearly; other cycles are refused on the form. The recurring amount must be at least R5.00. An optional setup fee is added to the first payment only.

  • The first notification starts the subscription: the entry becomes Active and the PayFast token is stored as the subscription ID.
  • Every later payment is added to the entry with its PayFast payment ID, and your “Subscription Payment Added” notification is sent.
  • Press Cancel Subscription on the entry to cancel it at PayFast as well. A subscription cancelled in the PayFast dashboard is marked Cancelled when PayFast’s notification arrives.

Saved cards and extra charges

Tick Saved card on a Products and Services feed and PayFast keeps a card agreement when the customer pays. The entry then shows a Charge saved card form: enter an amount and what it is for, and PayFast charges the card straight away. Each extra charge is listed on the entry and confirmed when PayFast’s notification arrives. This suits deposits followed by a balance, damages after a rental or add-ons ordered after booking. Tell your customers on the form that you may charge the card later.

The entry screen and refunds

Every PayFast entry has a PayFast box with the status, the last notification, your reference, the PayFast payment ID, the amount, the PayFast fee and what has been refunded.

An entry paid through PayFast: the PayFast box with the status, last notification, reference, PayFast payment ID, amounts, PayFast fee and the refund form
The entry after payment: status, PayFast references, the fee and the refund form.

To refund, type the amount and a short reason and press Refund. The add-on first asks PayFast how much can still be refunded and how, then sends the refund back to the card or account the customer paid with, and tells the customer by e-mail. Partial refunds mark the entry Partially Refunded; refunding the rest marks it Refunded. Each refund form can only be sent once, so a double click never refunds twice. When PayFast can only refund a payment by bank payout, which needs the customer’s bank details, the add-on says so and you make that refund in the PayFast dashboard.

For developers

The gravityextra_payfast_payment_fields filter lets you add PayFast fields to the payment, for example the merchant confirmation e-mail. The merchant, amounts, reference, return and notification addresses and subscription terms are always set by the add-on.

// Ask PayFast to send its confirmation e-mail to your bookings address.
// The merchant, amounts, reference, addresses and subscription terms are
// always set by the add-on and cannot be changed here.
add_filter( 'gravityextra_payfast_payment_fields', function ( $fields, $feed, $entry, $form ) {
    $fields['email_confirmation']   = '1';
    $fields['confirmation_address'] = 'bookings@your-domain.example';
    return $fields;
}, 10, 4 );

Other filters: gravityextra_payfast_notify_url changes the notification address, gravityextra_payfast_itn_ips adds sender addresses you trust and gravityextra_payfast_resolve_itn_hosts turns off the host name lookup used as a second sender check.

Frequently asked questions

PayFast says the signature does not match. What is wrong?

Almost always the passphrase. It must be exactly the one in your PayFast settings for that environment, or empty if no passphrase is set there. Re-type it in the add-on and save.

The visitor paid but the entry still says Processing.

The notification has not reached your site yet or was refused. Check that the site is reachable from the internet (a local or password-protected test site cannot receive notifications), that a firewall does not block PayFast’s servers, and look at the Gravity Forms log for this add-on.

Can I take other currencies?

No. PayFast takes South African rand only, so the add-on refuses other currencies before the visitor leaves your site.

Is the card stored on my site?

No. Card and bank details are entered on PayFast. A saved card is a PayFast token; your site only keeps the token reference.

Does it work with conditional logic and multi-page forms?

Yes. Use the feed condition to send only some submissions to PayFast, and multi-page forms work as usual. The payment starts when the last page is submitted.

Get the add-on

The Gravity Forms PayFast Payment Premium Add-on is available on the product page. Questions before you buy? Our support team answers them.

Still need help?

Our support team answers tickets every day, usually within a few hours.

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