PHP code example of armyan / omnipay-paddle
1. Go to this page and download the library: Download armyan/omnipay-paddle 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/ */
armyan / omnipay-paddle example snippets
use Omnipay\Omnipay;
$gateway = Omnipay::create('Paddle');
$gateway->setVendorId(env('VENDOR_KEY'));
$gateway->setEnvironment(env('VENDOR_ENV'));
$gateway->setProduct(1159); // Product/Subscription ID from Paddle
$gateway->setTransactionId(XXXX); // Transaction ID from your system
$purchase = $gateway->purchase()->send();
$purchase->redirect();
$gateway = Omnipay::create('Paddle');
$gateway->setVendorId(env('VENDOR_KEY'));
$purchase = $gateway->completePurchase()->send();
// Do the rest with $purchase and response with 'OK'
if ($purchase->isSuccessful()) {
// Your logic
}
return new Response('OK');