PHP code example of amostajo / laravel-shop-gateway-omnipay
1. Go to this page and download the library: Download amostajo/laravel-shop-gateway-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/ */
amostajo / laravel-shop-gateway-omnipay example snippets
// (1) - Set gateway
Shop::setGateway('omnipay');
Shop::gateway()->create('Stripe');
// (2) - Setting method / calling specific method
Shop::gateway()->omnipay->setSpecific();
// (1) - Set gateway
Shop::setGateway('omnipay');
Shop::gateway()->create('Stripe');
// (2) - Adding an option
Shop::gateway()->addOption('token', $stripetoken);
// (3) - Any operation that follows
Shop::checkout();
// (1) - Set gateway
Shop::setGateway('omnipay');
Shop::gateway()->create('PayPal_Express');
// (2) - Authentication
Shop::gateway()->omnipay->setUsername('...');
Shop::gateway()->omnipay->setPassword('...');
// (2) - Call checkout / OPTIONAL
Shop::checkout();
// (3) - Create order
$order = Shop::placeOrder();
// (4) - Review order and redirect to payment
if ($order->isPending) {
// PayPal URL to redirect to proceed with payment
$approvalUrl = Shop::gateway()->getApprovalUrl();
// Redirect to url
return redirect($approvalUrl);
}
// (5) - Callback
// You don't have to do anything.
// Laravel Shop will handle the callback and redirect the customer to the configured route.
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.