1. Go to this page and download the library: Download krsman/omnipay library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
$response = $gateway->purchase(array('amount' => '10.00', 'card' => $card))->send();
$response->isSuccessful(); // is the response successful?
$response->isRedirect(); // is the response a redirect?
$response->getTransactionReference(); // a reference generated by the payment gateway
$response->getTransactionId(); // the reference set by the originating website if available.
$response->getMessage(); // a message generated by the payment gateway
$response = $gateway->purchase(array('amount' => '10.00', 'card' => $card))->send();
if ($response->isSuccessful()) {
// payment is complete
} elseif ($response->isRedirect()) {
$response->redirect(); // this will automatically forward the customer
} else {
// not successful
}
$url = $response->getRedirectUrl();
// for a form redirect, you can also call the following method:
$data = $response->getRedirectData(); // associative array of fields which must be posted to the redirectUrl
try {
$response = $gateway->purchase(array('amount' => '10.00', 'card' => $card))->send();
if ($response->isSuccessful()) {
// mark order as complete
} elseif ($response->isRedirect()) {
$response->redirect();
} else {
// display error to customer
exit($response->getMessage());
}
} catch (\Exception $e) {
// internal error, log exception and display a generic message to the customer
exit('Sorry, there was an error processing your payment. Please try again later.');
}
if ($is_developer_mode) {
if (method_exists($gateway, 'setDeveloperMode')) {
$gateway->setDeveloperMode(TRUE);
} else {
$gateway->setTestMode(TRUE);
}
}
$notification = $gateway->acceptNotification();
$notification->getTransactionReference(); // A reference provided by the gateway to represent this transaction
$notification->getTransactionStatus(); // Current status of the transaction, one of NotificationInterface::STATUS_*
$notification->getMessage(); // Additional message, if any, provided by the gateway
// update the status of the corresponding transaction in your database
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.