2022 Nov BFCM Marketplace Sale

  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

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.
Screenshot of the PayPast developer settings section of the PayFast account dashboard

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

Screenshot of the PayPast Recurring Billing section of the PayFast account dashboard

Setup and Configuration

↑ Back to top
Screenshot of PayFast as an options on the WooCommerce > Settings > Payments screen in the site's admin area

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.

Screenshot of the PayFast settings in the site's admin area. Note the PayFast Sandbox box is unchecked, and thus live credentials are required to function.

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.
Screenshot of the PayFast settings in the site's admin area. Note the PayFast Sandbox box is checked, and thus sandbox credentials are required  as the site is in test mode, and no real transactions will be processed.

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.

WooCommerce

The most customizable eCommerce platform for building your online business.

  • 30-day money-back guarantee
  • Support teams across the world
  • Safe and secure online payment