PHP code example of dansmaculotte / laravel-omnipay

1. Go to this page and download the library: Download dansmaculotte/laravel-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/ */

    

dansmaculotte / laravel-omnipay example snippets


php artisan vendor:publish --provider="DansMaCulotte\Omnipay\OmnipayServiceProvider"

$params = [
    'amount' => $order->amount,
    'issuer' => $issuerId,
    'description' => $order->description,
    'returnUrl' => URL::action('PurchaseController@return', [$order->id]),
];
$response = Omnipay::purchase($params)->send();

if ($response->isRedirect()) {
    // redirect to offsite payment gateway
    return $response->getRedirectResponse();
}

if ($response->isSuccessful() === false) {
    // payment failed: display message to customer
    echo $response->getMessage();
}

// payment was successful: update database
print_r($response);

OmnipayFacade::setDefaultGateway('Stripe');

Omnipay::withGateway('Dummy')->purchase($params)->send();