A PHP handler for making requests to documented PayFast endpoints.
See their docs
- CI tools
- Handle signature generation
- Generate Timestamp
- Make user defined requests
- Support R0 verification charges
- Error handling
- Built in functions
- Ping
- Transaction History
- Query Card Transaction
- Subscriptions
- Charge Subscription
- Fetch Subscription Info
- Pause Subscription
- Unpause Subscription
- Cancel Subscription
This PayFast SDK requires config variables passed to it.
merchantId
and passPhrase
are mandatory, if not defined other fields will default to values shown below:
$config = [
'merchantId' => 'testId', // Required
'passPhrase' => 'testPhrase', // Required
'endpoint' => '//api.payfast.co.za',
'port' => 443,
'ssl' => true,
'testing' => false,
];
$payfast = new PayFastSDK($config);
You can create a request to any endpoint in PayFast using $payfast->request->customRequest($verb, $method, $options)
For example, getting Transaction History
$verb = 'GET';
$method = '/history';
$options = [
'from' => '2018-02-01',
'to' => '2018-03-04',
];
$response = $payfast->request->customRequest($verb, $method, $options)
Payfast requires a MD5 hash of the alphabetised submitted variables, header and body variables, as well as the passphrase to ensure the request has not been tampered with.
Payfast provides a sandbox environment to test integrations.
Test requests are sent to the normal endpoint, but append ?testing=true
to the URI.
- Add yourself here!