
PayFast
Track affiliate sales from PayFast, the South African payment gateway, with the Post Affiliate Pro PayFast ITN plugin. Setup guide with payment form code, notify URL and plugin settings.
PayFast integration
PayFast is a South African payment gateway. The Post Affiliate Pro plugin connects it to your affiliate program. After each payment, PayFast sends an Instant Transaction Notification (ITN) to your Post Affiliate Pro installation, and the plugin registers the sale for the affiliate who referred the customer. When the payment belongs to a PayFast subscription, the plugin registers a recurring payment instead.
How to integrate PostAffiliatePro with PayFast
Plugin activation
In your merchant panel navigate to Configuration > Plugins > PayFast ITN handling > Activate. After activation, configure the plugin at least with the following:
- Custom string field: the PayFast custom field (custom_str1 to custom_str5) that carries the tracking value from your payment form. The default is custom_str1. All other options are described in the plugin settings section below.
- Signature passphrase: use the same passphrase you are using in the Settings section of your PayFast dashboard. PayFast requires the passphrase on your account and on your site to be identical.
Integration of the payment form
To track the affiliate who referred the customer, the payment form has to pass the tracking value to PayFast, and PayFast has to send the notification to Post Affiliate Pro. Add these parts to your PayFast payment form:
<input type="hidden" name="custom_str1" value="" id="pap_dx8vc2s5" />
<input type="hidden" name="notify_url" value="https://URL_TO_PostAffiliatePro/plugins/PayFast/payfast.php" />
<script id="pap_x2s6df8d" src="https://URL_TO_PostAffiliatePro/scripts/notifysale.php" type="text/javascript">
</script>
Remember, if you already use custom_str1 for something else, use another custom string and select the same one in the plugin configuration.
Note:
If you have more than one payment form on a page, you can place the <script> part only once per whole page. Each payment form needs the <input> parts only.
Example
Here is an example of a payment form with the integration code added:
<form action="https://www.payfast.co.za/eng/process" method="post">
<input type="hidden" name="merchant_id" value="YOUR_MERCHANT_ID" />
<input type="hidden" name="merchant_key" value="YOUR_MERCHANT_KEY" />
<input type="hidden" name="amount" value="100.00" />
<input type="hidden" name="item_name" value="Product 1" />
<input type="hidden" name="custom_str1" value="" id="pap_dx8vc2s5" />
<input type="hidden" name="notify_url" value="https://URL_TO_PostAffiliatePro/plugins/PayFast/payfast.php" />
<script id="pap_x2s6df8d" src="https://URL_TO_PostAffiliatePro/scripts/notifysale.php" type="text/javascript">
</script>
<input type="submit" value="Pay now" />
</form>
Do not forget to integrate your site with the click tracking code .
Subscriptions
For PayFast subscriptions, PayFast sends a notification for every payment together with a subscription token. The plugin recognizes the token and registers the payment as a recurring payment, using the token as the order ID. For this to work in PayFast, you need a passphrase set and recurring billing enabled on your PayFast account. To see how the recurring commissions are set up on the Post Affiliate Pro side, read about recurring commissions .
Plugin settings
The plugin has the following options:
- Custom string field: the PayFast custom field that carries the tracking value. Default: custom_str1.
- Signature passphrase: the passphrase from your PayFast dashboard.
- Use PayFast order ID: by default the plugin uses the unique payment ID set by your system (m_payment_id) as the order ID. Check this to use the PayFast payment ID instead.
- Discount fee: enabled by default. The commission is calculated from the net amount, after PayFast’s fee. Disable it to use the gross amount.
- Register new affiliate with every occurred event: creates a new affiliate from the customer’s name and email in the payment.
- Register affiliate on purchase of these products: limits the registration above to specific products. Leave it empty to register an affiliate on every purchase, or enter product names separated by a semicolon, for example product1;perfect product;product3. The product name is the item name sent to PayFast.
- Approve affiliate after successful payment: a pending affiliate whose email matches the paying customer is approved after a successful payment.
- Use recurring total cost from notification: for recurring commissions, uses the amount from each PayFast notification instead of the amount of the initial payment.
- Extra data 1 to 5: saves a detail from the notification into the extra data fields of the sale. You can choose the customer’s email, phone number, name, first name, last name, item name, item description, or the PayFast transaction ID. Extra data 1 is set to the customer’s email by default.
- Resend IPN to URL: forwards the PayFast notification to another address, for example another system that also uses the ITN. The address must be a valid URL with the protocol, and it cannot point to the same Post Affiliate Pro installation.
How does the plugin work exactly?
When PayFast sends a notification to the plugin address, the plugin:
- Reads the payment: the amount, the payment ID, the customer’s email and name, the item name, and the tracking value from your custom string field.
- Checks the payment status. Only the status COMPLETE is processed, any other status is skipped.
- Finds the affiliate from the tracking value and, if enabled, registers a new affiliate or approves a pending one.
- Registers the commission. If the notification contains a subscription token, it is registered as a recurring payment, otherwise as a regular sale.
Lifetime commissions
If you use lifetime commissions , the plugin needs a detail that identifies the customer across payments. When the Lifetime Commissions plugin is active, set the extra data field it uses to the customer’s email or phone number. If you choose anything else, the plugin settings show an error for that field.
What is PayFast?
PayFast is a payment gateway based in South Africa, founded in 2007. It is part of Network International and says it is trusted by more than 80,000 South African businesses. It lets online stores accept payments from customers without building their own payment processing.
For affiliate programs, this makes it a natural choice when your customers or your affiliates are in South Africa, because customers pay with the methods they already use and every sale can still be tracked back to the affiliate who referred it.
Key features of PayFast
- Many payment methods: more than 18 methods, including credit cards, Instant EFT, QR codes, Mobicred, and store cards.
- Subscriptions: recurring billing for memberships and subscription products.
- Tokenization and split payments: store payment details securely and split a payment between parties.
- Refunds and invoicing: merchant refunds and invoices from your PayFast account.
- Integrations: it connects to more than 70 existing platforms and has a developer API.
- Instant Transaction Notification: a notification for every payment, which is how sales reach Post Affiliate Pro.
PayFast pricing options
PayFast states that its aggregation solution has no monthly fees, and that you only pay a small transaction fee when you make a sale. The exact fees depend on the payment method, so check them on the PayFast website before you decide. Fees change, so use the current numbers from PayFast.
Alternatives to PayFast
If PayFast does not fit your business, these are payment gateways used in South Africa:
Other payment gateway integrations
Post Affiliate Pro also integrates with many other payment gateways. See the guides for Stripe , PayPal , Worldpay , or browse all integrations .
Frequently asked questions
Track PayFast Sales with Post Affiliate Pro
Reward your affiliates for every PayFast sale, including recurring payments. Try the PayFast integration with Post Affiliate Pro.
Cookie Consent
We use cookies to enhance your browsing experience and analyze our traffic. See our privacy policy.
