1. Go to this page and download the library: Download adnane-ka/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/ */
adnane-ka / omnipay-paddle example snippets
use Omnipay\Omnipay;
$gateway = Omnipay::create('Paddle');
$gateway->setApiKey('YOUR_API_KEY');
$gateway->setTestMode(true);
$response = $gateway->purchase([
'amount' => 5.00 * 100, // in cents
'checkoutUrl' => 'http://localhost:8000/checkout.php', // where you'll display the overlay / inline checkout
'returnUrl' => 'http://localhost:8000/complete.php', // where you'll be proccessing the payment
'currency' => 'USD'
])->send();
if ($response->isRedirect()) {
// The transaction is created as a draft and you're ready to be redirected to checkout
$response->redirect();
} else {
// An error occured
echo $response->getMessage();
}
$response = $gateway->completePurchase([
'transactionId' => $_GET['transactionId'] // sent in request or retrieved from backend
])->send();
if($response->isSuccessful()){
// Payment was successful and charge was captured
// $response->getData()
echo $response->getTransactionReference(); // payment reference
}else{
// Charge was not captured and payment failed
echo $response->getMessage();
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.