PHP code example of yzh52521 / think-omnipay

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

    

yzh52521 / think-omnipay example snippets


...
'gateways' => [
    'paypal' => [
        'driver'  => 'PayPal_Express',
        'options' => [
            'username'  => 'coolusername',
            'password'  => 'strongpassword',
            'signature' => '',
            'solutionType' => '',
            'landingPage'    => '',
            'headerImageUrl' => '',
            'brandName' =>  'Your app name',
            'testMode' => true
        ]
    ],
]
...

$cardInput = [
	'number'      => '4444333322221111',
	'firstName'   => 'MR. WALTER WHITE',
	'expiryMonth' => '03',
	'expiryYear'  => '16',
	'cvv'         => '333',
];

$card = \ThinkOmnipay\Facade::creditCard($cardInput);

$response = \ThinkOmnipay\Facade::purchase([
	'amount'    => '100.00',
	'returnUrl' => 'http://bobjones.com/payment/return',
	'cancelUrl' => 'http://bobjones.com/payment/cancel',
	'card'      => $cardInput
])->send();

dd($response->getMessage());

\ThinkOmnipay\Facade::setGateway('paypal');

$response = \ThinkOmnipay\Facade::purchase([
	'amount' => '100.00',
	'card'   => $cardInput
])->send();

dd($response->getMessage());

$gateway = \ThinkOmnipay\Facade::gateway('paypal');