PayFast is our recommended payments processing service for South Africans and South African websites. Their payment gateway 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.
- Make sure you have the Paid Memberships Pro plugin installed and activated.
- Navigate to Plugins > Add New in the WordPress admin.
- 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.
- Activate the plugin through the ‘Plugins’ menu in WordPress.
Continue following the setup instructions below.
- Register and validate your account with PayFast.
- Log in to your PayFast account and select ‘Settings’ to retrieve your merchant details.
- Log in to your WordPress dashboard and navigate to Memberships > Payment Settings.
- Set your “Payment Gateway” to “PayFast”. Fill out your merchant details and Passphrase*
- Set your currency to “South African Rand”.
- Save your settings.
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
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.
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).
- 22.214.171.124 / 28 (126.96.36.199 – 188.8.131.52)
- 184.108.40.206 / 27 (220.127.116.11 – 18.104.22.168)
- 22.214.171.124 (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 );
This is a Free Add On.
Create a free account or log in to gain access to downloads and documentation.