PHP code example of ambroisemaupate / omnipay-sips2
1. Go to this page and download the library: Download ambroisemaupate/omnipay-sips2 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/ */
ambroisemaupate / omnipay-sips2 example snippets
$gateway = \Omnipay\Omnipay::create('SipsPayPage');
$gateway->setMerchantId('XXXXXXXXXXXXXXXXX');
$gateway->setSecretKey('XXXXXXXXXXXXXXXXX');
$gateway->setUrl('https://payment-webinit.simu.sips-atos.com');
$card = new \Omnipay\Sips\OffsiteCreditCard();
$card->setEmail('[email protected] ');
// Send purchase request
$request = $gateway->purchase(
[
'clientIp' => $request->getClientIp(),
'amount' => '10.00',
'currency' => 'EUR',
'returnUrl' => $this->generateUrl('completePurchaseRoute', [], UrlGenerator::ABSOLUTE_URL),
'notifyUrl' => $this->generateUrl('completePurchaseRoute', [], UrlGenerator::ABSOLUTE_URL),
'cancelUrl' => $this->generateUrl('cancelRoute', [], UrlGenerator::ABSOLUTE_URL),
'card' => $card
]
);
$response = $request->send();
if ($response->isRedirect()) {
$response->redirect(); // this will automatically forward the customer
}
$gateway = \Omnipay\Omnipay::create('SipsPayPage');
$gateway->setMerchantId('XXXXXXXXXXXXXXXXX');
$gateway->setSecretKey('XXXXXXXXXXXXXXXXX');
$gateway->setUrl('https://payment-webinit.simu.sips-atos.com');
// Send completePurchase request
$request = $gateway->completePurchase();
$response = $request->send();
if ($response->isSuccessful()) {
// DO your store logic.
$bankTransactionRef = $response->getTransactionReference();
$websiteOrderId = $response->getTransactionId();
} elseif ($response->isPending()) {
// Do temporary things until we get a success/failed tranaction response.
} else {
echo $response->getMessage();
}