PHP code example of chrisidakwo / flutterwave-php
1. Go to this page and download the library: Download chrisidakwo/flutterwave-php 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/ */
chrisidakwo / flutterwave-php example snippets
use ChrisIdakwo\Flutterwave\Rave;
$secretKey = 'FLW-SECRET-KEY';
$baseUrl = 'https://baseurl.com/v3';
$rave = new Rave($secretKey, $baseUrl);
// To generate a payment link
$requestData = []; // See https://developer.flutterwave.com/docs/flutterwave-standard
$paymentLink = $rave->standardPayment($requestData)['data']['link'];
// To verify a transaction
$transactionID = '123456';
$transaction = $rave->verifyTransaction($transactionID);
$amount = 34000;
$customerEmail = '[email protected]';
$isVerified = $transaction->amount === $amount && $transaction->currency === 'NGN'
&& $transaction->customer->email === $customerEmail;
// Refund a transaction
$transactionID = '9408294';
$amount = 300;
$refund = $rave->refundTransaction($transactionID, $amount);
bash
composer
bash
vendor/bin/php-cs-fixer fix