xorik/omnipay-paymaster

Implement paymaster for the omnipay (Russian payment system)

dev-master 2017-02-24 14:39 UTC

This package is not auto-updated.

Last update: 2024-05-15 17:53:22 UTC


README

Payment

$gateway = \Omnipay\Omnipay::create('Paymaster');
$gateway->initialize([
    'merchant_id' => 'YOUR_MERCHANT_ID',
    'secret_key' => 'YOUR_SECRET_KEY',
    'hashing_algorithm' => 'sha256' // Default value
]);
$response = $gateway->purchase([
    'currency' => 'RUB',
    'amount' => '1.00',
    'transactionId' => '123',
    'description' => 'Оплата заказа №123'
])->send();

if ($response->isRedirect()) {
    // Return this response to the user
    $response->getRedirectResponse();
}

Callback

Put this on your callback controller

$gateway = \Omnipay\Omnipay::create('Paymaster');
$gateway->initialize([
    'secret_key' => 'YOUR_SECRET_KEY',
]);

$response = $gateway->completePurchase($_POST)->send();

if ($response->isSuccessful()) {
    // Your order ID
    echo $response->getTransactionId();
    // Transaction ID
    echo $response->getTransactionReference();
}