Payfast offers a secure and instant transfer of money between online buyers and sellers. Merchants can accept funds from local and international customers from anywhere in the world in ZAR.

Fees are charged per-transaction according to this fee schedule and there are no setup or monthly fees.

Video Demo

Installation

  1. Make sure you have the Paid Memberships Pro plugin installed and activated.
  2. Navigate to Plugins > Add New in the WordPress admin.
  3. Search for “Payfast Payment Gateway for PMPro”.
    • Or, install this plugin manually, download the .zip file above then upload the compressed directory via the Plugins > Add New > Upload Plugin screen in the WordPress admin.
  4. Activate the plugin through the ‘Plugins’ menu in WordPress.

Continue following the setup instructions below.

Setup

  1. Register and validate your account with Payfast.
  2. Log in to your Payfast account and select ‘Settings’ to retrieve your merchant details.
  3. Log in to your WordPress dashboard and navigate to Memberships > Payment Settings.
  4. Set your “Payment Gateway” to “Payfast”. Fill out your merchant details and Passphrase*
  5. Set your currency to “South African Rand”.
  6. Save your settings.
* Please note that a “Security Passphrase” is required in order to accept all payments. You are able to set this under your account settings inside Payfast.

Enable “Payfast Debug Mode”

To enable the debugging mode, navigate to Payment Settings > Payfast. Then, change the setting for “Payfast Debug Mode” then save settings. With this setting enabled, you can test payments, cancellations, and recurring payments. The log file will be created inside the pmpro-payfast/logs folder.

Custom Trial Periods

The Payfast Gateway API does not support custom trials. You can set the initial payment to $0 and adjust your recurring amount to offer a trial for members. If you need to set a variable length period between the initial payment and the start of the recurring subsection, please use the Subscription Delays Add On.

Troubleshooting Payfast Orders Stuck in Pending Status

The most common reason orders stay in ‘pending’ status with Payfast is due to Instant Transaction Notifications (ITN) not sending or processing on the site. Similar to the PayPal IPN system, a working Payfast ITN is required to confirm the charge is valid and was successful with the gateway.

ITN is required for all types of payments, including the initial payment and all recurring payments. Some possible reasons your ITN is failing are listed below.

ITN URL is hardcoded/set incorrectly.

With PMPro, you do not need to set the Notify URL in Payfast. Leave your ITN Status set to “disabled”. The API will handle setting ITN and status this automatically.

If the ITN URL set inside Payfast settings is hardcoded or it is set to an incorrect URL (or another site’s URL), your ITN can fail. To fix this, disable the ITN URL in Payfast settings.

Screenshot of the Notification Settings > ITN section of Payfast Gateway Account

Server Side Blocking IP Addresses

Your web host may block incoming IP requests from frequent addresses. We do not see this as a common issue, but it is possible and important to note here for debugging.

Listed below are the IP address ranges that Payfast servers use (including their Sandbox server).

  • 197.97.145.144 / 28 (197.97.145.145 – 197.97.145.158)
  • 41.74.179.192 / 27 (41.74.179.193 – 41.74.179.222)
  • 144.126.193.139 (Sandbox IP)

Reach out to your hosting provider to ensure there is no block on these IPs from the server side

Orders in Token Status

Orders in the “token” status mean that the customer reached the Payfast checkout page but did not complete the order. This is similar to how PayPal Express handles payments. This guide has more detailed information about the various order statuses in Paid Memberships Pro.

Action and Filter Hooks

`apply_filters( ‘pmpro_payfast_hide_update_billing_button’, true );`

`apply_filters( ‘pmpro_payfast_data’, $data, $order );`

`apply_filters( ‘pmpro_payfast_itnhandler_level’, $morder->membership_level, $morder->user_id );`

`do_action( ‘pmpro_before_send_to_payfast’, $user_id, $morder );`

Looking to change payment gateways on your live PMPro membership site? We have a guide on switching payment gateways without affecting your existing customers.

Read Now: Switching Payment Gateways

This is a Free Add On.

Create a free account or log in to gain access to downloads and documentation.