require __DIR__ . '/vendor/autoload.php';
# Set configuration
\Paynl\Config::setApiToken('e41f83b246b706291ea9ad798ccfd9f0fee5e0ab');
\Paynl\Config::setServiceId('SL-3490-4320');
# Get available payment methods
$paymentMethods = \Paynl\Paymentmethods::getList();
# Display paymentmethods
var_dump($paymentMethods);
require __DIR__ . '/vendor/autoload.php';
# Set configuration
\Paynl\Config::setApiToken('e41f83b246b706291ea9ad798ccfd9f0fee5e0ab');
\Paynl\Config::setServiceId('SL-3490-4320');
# Start a transaction
$result = \Paynl\Transaction::start(array(
// required vars
'amount' => 10,
'returnUrl' => \Paynl\Helper::getBaseUrl().'/return.php',
// optional vars
'exchangeUrl' => \Paynl\Helper::getBaseUrl().'/exchange.php',
'paymentMethod' => 10,
'bank' => 1,
'description' => 'Demo payment',
'testmode' => 1,
'extra1' => 'ext1',
'extra2' => 'ext2',
'extra3' => 'ext3',
'products' => array(
array(
'id' => 1,
'name' => 'Your product',
'price' => 5,
'tax' => 0.87,
'qty' => 1,
),
array(
'id' => 2,
'name' => 'Other product',
'price' => 5,
'tax' => 0.87,
'qty' => 1,
)
),
'language' => 'EN',
'enduser' => array(
'initials' => 'M',
'lastName' => 'Pay',
'gender' => 'M',
'dob' => '14-05-1999',
'phoneNumber' => '0612345678',
'emailAddress' => 'customer@pay.nl',
),
'address' => array(
'streetName' => 'Test',
'houseNumber' => '10',
'zipCode' => '1234AB',
'city' => 'Test',
'country' => 'NL',
),
'invoiceAddress' => array(
'initials' => 'IT',
'lastName' => 'ITEST',
'streetName' => 'Istreet',
'houseNumber' => '70',
'zipCode' => '5678CD',
'city' => 'ITest',
'country' => 'NL',
),
));
# Save this transactionid and link it to your order
$transactionId = $result->getTransactionId();
# Redirect the customer to this url to complete the payment
$redirect = $result->getRedirectUrl();
require __DIR__ . '/vendor/autoload.php';
# Set configuration
\Paynl\Config::setApiToken('e41f83b246b706291ea9ad798ccfd9f0fee5e0ab');
$transaction = \Paynl\Transaction::getForReturn();
# Verify the transaction status
if( $transaction->isPaid() || $transaction->isPending()){
// redirect to thank you page
} elseif($transaction->isCanceled()) {
// redirect back to checkout
}
require __DIR__ . '/vendor/autoload.php';
# Set configuration
\Paynl\Config::setApiToken('e41f83b246b706291ea9ad798ccfd9f0fee5e0ab');
$transaction = \Paynl\Transaction::getForExchange();
# Verify the transaction status
if($transaction->isPaid()){
// process the payment
} elseif($transaction->isCanceled()){
// payment canceled, restock items
}
// required exchange response
echo "TRUE|";
require __DIR__ . '/vendor/autoload.php';
# Set configuration
\Paynl\Config::setApiToken('e41f83b246b706291ea9ad798ccfd9f0fee5e0ab');
$transactionId = $_GET['transactionId']
# Refund a transaction
try{
$result = \Paynl\Transaction::refund($transactionId, 5);
} catch(\Paynl\Error\Api $e){
echo $e->getMessage();
}
# Display result
var_dump($result);