dev-master
9999999-devTargetPay PHP SDK
GPL-2.0+
The Requires
- php >=5.3.0
payments sofort ideal targetpay psp mistercash
Wallogit.com
2017 © Pedro Peláez
TargetPay PHP SDK
With this (namespaced) SDK you can easily make the calls to TargetPay for all the payment methods that are provided., (*1)
Required: PHP 5.3+, (*2)
First register the autoloader. If your framework already has an autoloader you might not need to use this. Use the proper route to the autoload file, (*3)
require_once __DIR__.'/../lib/TargetPay/autoload.php';
Include the TargetPay namespace:, (*4)
use \TargetPay as TargetPay;
Now start the payment by calling:, (*5)
$startPaymentResult = TargetPay\Transaction::model("Ideal")
->rtlo(121455)
->amount(1000)
->description('Test payment')
->returnUrl('http://www.test.nl/success')
->cancelUrl('http://www.test.nl/canceled')
->reportUrl('http://www.test.nl/report')
->bank('0021')
->start();
You can check the result. $startPaymentResult->status will be true in case of success. If not startPaymentResult->status will have the error message., (*6)
If all is OK, redirect to the bank:, (*7)
Header ("Location: ".$startPaymentResult->url);
After payment the reportUrl will be called by TargetPay, passing amongst others the transaction ID . See the TargetPay documentation for more information., (*8)
The script behind this report URL has to check the validity of the report, thus checking the actual payment., (*9)
This is done by calling (after including the autoloader and use statement):, (*10)
$checkPaymentResult = TargetPay\Transaction::model($method)
->rtlo(121455)
->txid($startPaymentResult->txid)
->test(false)
->check();
Check the results in $checkPaymentResult for more information about the payment. Most important: $checkPaymentResult = true indicates a succesful payment.
Save the result of the payment in your database., (*11)
When the customer paid, he will be redirected to the Return URL. If not, he is redirected to the Cancel URL., (*12)
Currently the following payment methods are implemented. See their classes (in parentheses) under /lib/TargetPay/Methods for their specifics like minimum/maximum amounts and specific properties: - iDEAL (Methods_Ideal) - Bancontact/Mister Cash (Methods_MisterCash) - Sofort Banking, former DirectEbanking (Methods_Sofort) - Paysafecard, former Wallie (Methods_Paysafecard) - Visa/Mastercard (Methods_Creditcard), (*13)
TargetPay PHP SDK
GPL-2.0+
payments sofort ideal targetpay psp mistercash