1. Go to this page and download the library: Download cashfree/omnipay-cashfree 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/ */
cashfree / omnipay-cashfree example snippets
use Omnipay\Omnipay;
use Omnipay\Common\CreditCard;
// Create the gateway object.
$gateway = GatewayFactory::create('Cashfree');
$response = $gateway->initialize($params);
// Create the credit card object from details entered by the user.
$card = new CreditCard([
'firstName' => 'Card',
'billingPhone' => '91********',
// Billing address details are eways/Cashfree/acceptNotification',
]);
#### Redirect (3D Secure)
If the authorization result is a redirect, then a quick and dirty way to redirect is:
if ($response->isSuccessful()) {
// The transaction is complete and successful and no further action is needed.
// This may happen if a cardReference has been supplied, having captured
// the card reference with a CVV and using it for the first time. The CVV will
// only be kept by the gateway for this first authorization. This also assumes
// 3D Secure is turned off.
} elseif ($response->isRedirect()) {
// Redirect to offsite payment gateway to capture the users credit card
// details.
// If a cardReference was provided, then only the CVV will be asked for.
// 3D Secure will be performed here too, if enabled.
// Once the user is redirected to the gateway, the results will be POSTed
// to the [notification handler](#sage-pay-server-notification-handler).
// The handler will then inform the gateway where to finally return the user
// to on the merchant site.
$response->redirect();
} else {
// Something went wrong; get the message.
// The error may be a simple validation error on the address details.
// Catch those and allow the user to correct the details and submit again.
// This is a particular pain point of Sage Pay Server.
$reason = $response->getMessage();
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.