ambroisemaupate/omnipay-sips2

Omnipay gateway for Worldline Sips PayPage POST API (Atos Sips 2.0)

1.0.2 2018-01-26 10:23 UTC

This package is auto-updated.

Last update: 2024-10-28 07:15:57 UTC


README

This gateway implements Sips PayPage POST API only.

Gateway parameters

Gateway is provided default Sogenactif (Société Générale) testing credentials.

Be careful, in test mode, transactionReference parameter is mandatory.

Usage

First step: offsite payment

$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('test@test.com');

// 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
}

Second step: manual and automatic response

$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();
}