1. Documentation /
  2. Payfast Payment Gateway

Payfast Payment Gateway

Our Payfast Payment Gateway extension for WooCommerce allows you to process payments via the South African payment processor, Payfast. Payment from any country may be accepted, but it is required to use ZAR as the store currency.

Installation

↑ Back to top
  1. Download the .zip file from your WooCommerce account.
  2. Go to: WordPress Admin > Plugins > Add New and Upload Plugin with the file you downloaded with Choose File.
  3. Install Now and Activate the extension.

More information at: Install and Activate Plugins/Extensions.

Requirements

↑ Back to top
  • A Payfast account to obtain a Merchant ID and Merchant Key. Note that Merchant IDs for developers and live sites are different, so you may need to update those in your live site.
  • Instant Transaction Notification (ITN) should be enabled. Replace the following with your domain for the Notify URL. https://domain.com/?wc-api=WC_Gateway_Payfast
  • WooCommerce version 7.2 or higher
  • WordPress version 6.1 or higher
  • PHP version 7.2 or higher

Sign up for Payfast

↑ Back to top

To register for a Payfast account.

  1. Go to: Payfast
  2. Register
  3. Verify your account.
  4. Go to: Payfast > Settings > Developer Settings
  5. Copy your Merchant ID and Merchant Key (top right) to use during the setup of your WooCommerce store. Or leave this window open after signup.
  6. Add and copy the Security Passphrase
  7. Be sure to enter your Notify URL on this page as well.

If you’re using Subscriptions and/or Pre-orders, verify that Ad hoc Payments are enabled under the Recurring Billing section. 

Setup and Configuration

↑ Back to top

To connect your store with Payfast:

  1. Go toWooCommerce > Settings > Payments > Payfast.
  2. Use the toggle under Enabled to select Payfast.
  3. Select Set Up. You are taken to the Payfast settings:
    1. Enable/Disable – check the box to enable Payfast as an option on the checkout page.
    2. Title, Description – shown to customers at checkout (optional).
    3. Payfast Sandbox – check the box if you are developing your website and not ready to accept payments and/or wish to test.
    4. Merchant ID, Merchant Key, Passphrase – obtained from your Payfast account as outlined above.
    5. Send Debug Emails, Who Receives Debug E-mails? – check the box and enter an address to receive emails for each transaction (optional)
    6. Enable Logging – when checked, creates a log under WooCommerce > Status > Logs to record transaction event information, which is useful for troubleshooting.
  4. Save changes.

The Payfast extension uses the Merchant ID and Merchant Key fields to send cart information to your Payfast account.

Compatibility with other extensions

↑ Back to top

Payfast works well with several extensions. One thing to bear in mind is the initial charge may not be less than R5.00.

WooCommerce Subscriptions

↑ Back to top

Payfast works with WooCommerce Subscriptions (separate purchase). Configure a simple or variable subscription product as described in the extension’s documentation.

Using Payfast with Subscriptions:

  • Basic features available: Subscription suspension and subscription cancellation
  • Advanced features available: Recurring total modification, payment date modification, customer payment method changes

While one user can own multiple subscriptions at the same time, Payfast is unable to process the purchase of multiple subscriptions in the same transaction. Two subscriptions cannot be added to the cart at the same time.

Cancellation works from both the WooCommerce store and the Payfast side. If you cancel at the store, the token is cancelled at Payfast. If you cancel at Payfast, the order is cancelled locally.

WooCommerce Pre-Orders

↑ Back to top

Payfast works with WooCommerce Pre-Orders. Configure the products as described in the extension’s documentation.

Pre-Orders will not work if there is no initial fee charged. To address this, there are two options:

  • If you want to charge Upon Release, you need to set a Pre-Order Fee.payfast-preorders2
  • If you charge the full amount Upfront, setting a Pre-Order Fee is optional. payfast-preorders1

Test Payfast

↑ Back to top

It’s possible to test the Payfast payment gateway before going live by using Payfast Sandbox credentials.

The PayFast Sandbox settings screen.

To do this:

  1. Go to: WooCommerce > Settings > Payments > Payfast.
  2. Tick the Payfast Sandbox checkbox to put the gateway in test mode.
  3. Replace your Merchant ID, Merchant Key, and Passphrase with the equivalent from your Payfast Sandbox.
  4. Save changes.

Note: When ready to go live, be sure to untick the Payfast Sandbox checkbox and check your live credentials again.  Your Merchant ID and Merchant Key must be entered correctly and in the appropriate fields, even when using Sandbox mode. Otherwise, there will be an error in checkout. Also note that Merchant IDs for developers and live sites are different, so you may need to update those in your live site after testing.

Questions and Feedback

↑ Back to top

Have a question before you buy? Please fill out this pre-sales form.

Already purchased and need some assistance? Get in touch with a Happiness Engineer via the Help Desk.