Subiendo proyecto completo sin restricciones de git ignore

This commit is contained in:
Jose Sanchez
2023-08-17 11:44:02 -04:00
parent a0d4f5ba3b
commit 20f1c60600
19921 changed files with 2509159 additions and 45 deletions

View File

@@ -0,0 +1,15 @@
<template>
<p class="demo">
{{ msg }}
</p>
</template>
<script>
export default {
data () {
return {
msg: 'Hello this is <Foo-Bar>'
}
}
}
</script>

View File

@@ -0,0 +1,3 @@
<template>
<p class="demo">This is another component</p>
</template>

View File

@@ -0,0 +1,15 @@
<template>
<p class="demo">
{{ msg }}
</p>
</template>
<script>
export default {
data() {
return {
msg: 'Hello this is <demo-component>'
}
}
}
</script>

View File

@@ -0,0 +1,191 @@
const {description} = require('../../package')
module.exports = {
/**
* Refhttps://v1.vuepress.vuejs.org/config/#title
*/
title: 'Laravel Flutterwave 🦄🦄',
/**
* Refhttps://v1.vuepress.vuejs.org/config/#description
*/
description: 'A flutterwave laravel package to integrate with Laravel APIs seamlessly',
/**
* Extra tags to be injected to the page HTML `<head>`
*
* refhttps://v1.vuepress.vuejs.org/config/#head
*/
head: [
['link', {rel: 'icon', href: `https://flutterwave.com/images/FLW-icon.png`}],
['meta', {name: 'theme-color', content: '#3eaf7c'}],
['meta', {name: 'apple-mobile-web-app-capable', content: 'yes'}],
['meta', {name: 'twitter:card', content: 'summary_large_image'}],
['meta', {name: 'twitter:url', content: 'https://laravelrave.netlify.app/'}],
[
'meta',
{
name: 'twitter:image:src',
content: 'https://flutterwave.com/images/graph/home.png'
}
],
['meta', {name: 'twitter:site', content: '@mrflamez_'}],
['meta', {name: 'twitter:creator', content: '@mrflamez_'}],
['meta', {name: 'og:type', content: 'website'}],
['meta', {name: 'og:url', content: 'https://laravelrave.netlify.app/'}],
['meta', {name: 'og:locale', content: 'en_US'}],
[
'meta',
{
name: 'og:image',
content: 'https://flutterwave.com/images/graph/home.png'
}
],
['meta', {name: 'og:locale', content: 'en_US'}],
[
'meta',
{
name: 'keywords',
content:
'online payments Nigeria, pay online in Nigeria, payment platforms in Nigeria, payment gateways in Nigeria, top 10 online payment processing platforms, top online payment gateways in Nigeria, best online payment gateways in Nigeria, online payment gateways in nigeria for e-commerce, payment platforms in Nigeria, Nigeria online payment platforms, laravel payment package, flutterwave laravel'
}
],
[
'meta',
{
name: 'description',
content: 'A flutterwave laravel package to integrate with Laravel APIs seamlessly'
}
],
[
'meta',
{
name: 'twitter:title',
content: 'Laravel Flutterwave 🦄🦄 | Integrate Flutterwave APIs seamlessly'
}
],
[
'meta',
{
name: 'twitter:description',
content: 'A flutterwave laravel package to integrate with Laravel APIs seamlessly'
}
],
[
'meta',
{
name: 'og:site_name',
content: 'Laravel Flutterwave 🦄🦄 | Integrate Flutterwave APIs seamlessly'
}
],
[
'meta',
{
name: 'og:title',
content: 'Laravel Flutterwave 🦄🦄 | Integrate Flutterwave APIs seamlessly'
}
],
[
'meta',
{
name: 'og:description',
content: 'A flutterwave laravel package to integrate with Laravel APIs seamlessly'
}
],
['meta', {name: 'apple-mobile-web-app-status-bar-style', content: 'black'}]
],
nav: [
{text: 'Home', link: '/'},
{
text: 'Installation',
link: '/getting-started/installation.html'
},
{
text: 'Payment Implementation',
link: '/getting-started/payment-implementation.html'
}
],
/**
* Theme configuration, here is the default theme configuration for VuePress.
*
* refhttps://v1.vuepress.vuejs.org/theme/default-theme-config.html
*/
themeConfig: {
// Assumes GitHub. Can also be a full GitLab url.
repo: 'kingflamez/laravelrave',
docsRepo: 'kingflamez/laravelrave',
docsDir: 'docs',
// defaults to false, set to true to enable
editLinks: true,
// custom text for edit link. Defaults to "Edit this page"
editLinkText: 'Help us improve this page!',
nav: [
{text: 'Home', link: '/'},
{
text: 'Installation',
link: '/getting-started/installation.html'
},
{
text: 'Payment Implementation',
link: '/getting-started/payment-implementation.html'
}
],
lastUpdated: true,
sidebar: [
{
title: 'Getting Started',
children: ['/getting-started/installation.html', '/getting-started/payment-implementation.html']
},
{
title: ' Verification/Notification',
children: ['/verification/introduction.html', '/verification/webhook.html', '/verification/callback.html']
},
{
title: 'Payments using APIs',
children: [
'/payments/introduction.html',
'/payments/ach-payments.html',
'/payments/ngn-bank-transfer.html',
'/payments/gh-mobile-money.html',
'/payments/rw-mobile-money.html',
'/payments/ug-mobile-money.html',
'/payments/zambia-mobile-money.html',
'/payments/mpesa-mobile-money.html',
'/payments/voucher-payments.html',
'/payments/francophone-mobile-money.html'
]
},
{
title: 'Transfers',
children: [
'/transfers/introduction.html',
'/transfers/initiate-transfers.html',
'/transfers/retry-transfer.html',
'/transfers/bulk-transfer.html',
'/transfers/fees.html',
'/transfers/fetch-transfers.html',
'/transfers/fetch-a-transfer.html',
'/transfers/retry-transfer-status.html',
'/transfers/transfer-rates.html'
]
},
{
title: 'Beneficiaries',
children: ['/beneficiaries/create-beneficiary.html', '/beneficiaries/list-beneficiaries.html', '/beneficiaries/fetch-beneficiary.html', '/beneficiaries/delete-beneficiary.html']
},
{
title: 'Banks',
children: ['/banks/list-banks.html', '/banks/bank-branches.html']
}
],
displayAllHeaders: true
},
markdown: {
lineNumbers: true
},
/**
* Apply pluginsrefhttps://v1.vuepress.vuejs.org/zh/plugin/
*/
plugins: ['@vuepress/plugin-back-to-top', '@vuepress/plugin-medium-zoom']
}

View File

@@ -0,0 +1,14 @@
/**
* Client app enhancement file.
*
* https://v1.vuepress.vuejs.org/guide/basic-config.html#app-level-enhancements
*/
export default ({
Vue, // the version of Vue being used in the VuePress app
options, // the options for the root Vue instance
router, // the router instance for the app
siteData // site metadata
}) => {
// ...apply enhancements for the site.
}

View File

@@ -0,0 +1,15 @@
/**
* Custom Styles here.
*
* refhttps://v1.vuepress.vuejs.org/config/#index-styl
*/
.home .hero img
max-width 450px!important
width 100%
.sidebar-group a.sidebar-link
font-weight: bold;
.sidebar-sub-headers a.sidebar-link
font-weight: normal;

View File

@@ -0,0 +1,10 @@
/**
* Custom palette here.
*
* refhttps://v1.vuepress.vuejs.org/zh/config/#palette-styl
*/
$accentColor = #F5A623
$textColor = #2c3e50
$borderColor = #eaecef
$codeBgColor = #282c34

View File

@@ -0,0 +1,15 @@
# Get Bank Branches
This helps you get the bank branches, pass the id of the bank. Click [here](/banks/list-banks) to get bank ids
## Sample
```php
<?php
$bankId = 191;
$branches = Flutterwave::banks()->branches($bankId);
dd($branches);
```

View File

@@ -0,0 +1,69 @@
# List Banks
This helps you fetch banks with their code
## Get Nigerian Banks
```php
<?php
$banks = Flutterwave::banks()->nigeria();
dd($banks);
```
## Get Ghanaian Banks
```php
<?php
$banks = Flutterwave::banks()->ghana();
dd($banks);
```
## Get Kenyan Banks
```php
<?php
$banks = Flutterwave::banks()->kenya();
dd($banks);
```
## Get Ugandan Banks
```php
<?php
$banks = Flutterwave::banks()->uganda();
dd($banks);
```
## Get South African Banks
```php
<?php
$banks = Flutterwave::banks()->southAfrica();
dd($banks);
```
## Get Tanzanian Banks
```php
<?php
$banks = Flutterwave::banks()->tanzania();
dd($banks);
```

View File

@@ -0,0 +1,22 @@
# Create a beneficiary
> Create a transfer beneficiary
```php
<?php
$data = [
'account_number' => '0690000034',
'account_bank' => '044'
];
$beneficiary = Flutterwave::beneficiaries()->create($data);
dd($beneficiary);
```
## Parameters
| Parameter | Required | Description |
| --------- | -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| account_number | True | The beneficiary's bank account number. When testing on staging, you can find a list of all the available test bank accounts [here](https://developer.flutterwave.com/docs/test-bank-accounts). |
| account_bank | True | This is the beneficiarys bank code, you can use the [List of Banks](/banks/list-banks) to retrieve a bank code. |

View File

@@ -0,0 +1,13 @@
# Delete a beneficiary
> Delete a transfer beneficiary.
```php
<?php
$beneficiaryId = 12596;
$beneficiary = Flutterwave::beneficiaries()->destroy($beneficiaryId);
dd($beneficiary);
```

View File

@@ -0,0 +1,13 @@
# Fetch a beneficiary
> Get a single transfer beneficiary details.
```php
<?php
$beneficiaryId = 12596;
$beneficiary = Flutterwave::beneficiaries()->fetch($beneficiaryId);
dd($beneficiary);
```

View File

@@ -0,0 +1,24 @@
# List all beneficiaries
> Fetch all beneficiaries on your account.
```php
<?php
$data = [
'page' => 1
];
// $data is optional
$beneficiaries = Flutterwave::beneficiaries()->fetchAll($data);
dd($beneficiaries);
```
## Parameters
| Parameter | Required | Description |
| --------- | -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| page | False | This allows you fetch from a specific page e.g. setting page to 1 fetches the first page. |
| status | False | This allows you fetch only transfers with a specific status e.g. fetch all successful transactions. Possible values are failed, successful |

View File

@@ -0,0 +1,15 @@
---
sidebar: auto
---
# Config
## foo
- Type: `string`
- Default: `/`
## bar
- Type: `string`
- Default: `/`

View File

@@ -0,0 +1,64 @@
# Installation
This will guide you in installing the package
## Prerequisite
[PHP](https://php.net) 7.2+, [Laravel](https://laravel.com) and [Composer](https://getcomposer.org) are required.
To get the latest version of Flutterwave, simply use composer
```bash
composer require kingflamez/laravelrave
```
For **`Laravel => 5.5`**, skip this step and go to [**`configuration`**](#configuration)
Once Flutterwave is installed, you need to register the service provider. Open up `config/app.php` and add the following to the `providers` key.
```php
'providers' => [
/*
* Package Service Providers...
*/
...
KingFlamez\Rave\RaveServiceProvider::class,
...
]
```
Also add this to the `aliases`
```php
'aliases' => [
...
'Rave' => KingFlamez\Rave\Facades\Rave::class,
...
]
```
## Configuration
Publish the configuration file using this command:
```bash
php artisan vendor:publish --provider="KingFlamez\Rave\RaveServiceProvider"
```
A configuration-file named **`flutterwave.php`** will be placed in your **`config`** directory
## Usage
Open your .env file and add your public key, secret key, environment variable and logo url like so:
Get your keys form [here](https://dashboard.flutterwave.com/dashboard/settings/apis)
```php
FLW_PUBLIC_KEY=FLWPUBK-xxxxxxxxxxxxxxxxxxxxx-X
FLW_SECRET_KEY=FLWSECK-xxxxxxxxxxxxxxxxxxxxx-X
FLW_SECRET_HASH='My_lovelysite123'
```
* **FLW_PUBLIC_KEY -** This is the api public key gotten from your dashboard (compulsory)
* **FLW_SECRET_KEY -** This is the api secret key gotten from your dashboard (compulsory)
* **FLW_SECRET_HASH -** This is the secret hash for your webhook

View File

@@ -0,0 +1,169 @@
# Payment Modal Implementation
Initiating Flutterwave Payment Modal is simple using this package:
## 1. Setup Routes
```php
// The page that displays the payment form
Route::get('/', function () {
return view('welcome');
});
// The route that the button calls to initialize payment
Route::post('/pay', [FlutterwaveController::class, 'initialize'])->name('pay');
// The callback url after a payment
Route::get('/rave/callback', [FlutterwaveController::class, 'callback'])->name('callback');
```
## 2. Setup the Payment Page
A sample payment button will look like so:
> welcome.blade.php
```html
<h3>Buy Movie Tickets N500.00</h3>
<form method="POST" action="{{ route('pay') }}" id="paymentForm">
{{ csrf_field() }}
<input name="name" placeholder="Name" />
<input name="email" type="email" placeholder="Your Email" />
<input name="phone" type="tel" placeholder="Phone number" />
<input type="submit" value="Buy" />
</form>
```
## 3. Setup your Controller
> Setup your controller to handle the routes. I created the `FlutterwaveController`. Use the `Rave` as `Flutterwave`
> facade.
### Example
```php
<?php
namespace App\Http\Controllers;
use KingFlamez\Rave\Facades\Rave as Flutterwave;
class FlutterwaveController extends Controller
{
/**
* Initialize Rave payment process
* @return void
*/
public function initialize()
{
//This generates a payment reference
$reference = Flutterwave::generateReference();
// Enter the details of the payment
$data = [
'payment_options' => 'card,banktransfer',
'amount' => 500,
'email' => request()->email,
'tx_ref' => $reference,
'currency' => "NGN",
'redirect_url' => route('callback'),
'customer' => [
'email' => request()->email,
"phonenumber" => request()->phone,
"name" => request()->name
],
"customizations" => [
"title" => 'Movie Ticket',
"description" => "20th October"
]
];
$payment = Flutterwave::initializePayment($data);
if ($payment['status'] !== 'success') {
// notify something went wrong
return;
}
return redirect($payment['data']['link']);
}
/**
* Obtain Rave callback information
* @return void
*/
public function callback()
{
$transactionID = Flutterwave::getTransactionIDFromCallback();
$data = Flutterwave::verifyTransaction($transactionID);
dd($data);
// Get the transaction from your DB using the transaction reference (txref)
// Check if you have previously given value for the transaction. If you have, redirect to your successpage else, continue
// Confirm that the $data['data']['status'] is 'successful'
// Confirm that the currency on your db transaction is equal to the returned currency
// Confirm that the db transaction amount is equal to the returned amount
// Update the db transaction record (including parameters that didn't exist before the transaction is completed. for audit purpose)
// Give value for the transaction
// Update the transaction to note that you have given value for the transaction
// You can also redirect to your success page from here
}
}
```
Once the initialize is called, you get redirected to a flutterwave payment page
![Payment Modal](https://files.readme.io/3fb8aa3-Screenshot_2020-04-23_at_9.26.00_AM.png)
> After a successful payment, the user is redirected to the call back page
### Payment Parameters
| Parameter | Required | Description |
| --------------- | -------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| tx_ref | True | Your transaction reference. This MUST be unique for every transaction |
| amount | True | Amount to charge the customer. |
| currency | False | currency to charge in. Defaults to NGN |
| integrity_hash | False | This is a sha256 hash of your FlutterwaveCheckout values, it is used for passing secured values to the payment gateway. |
| payment_options | True | This specifies the payment options to be displayed e.g - card, mobilemoney, ussd and so on. |
| payment_plan | False | This is the payment plan ID used for Recurring billing |
| redirect_url | True | URL to redirect to when a transaction is completed. This is useful for 3DSecure payments so we can redirect your customer back to a custom page you want to show them. |
| customer | True | This is an object that can contains your customer details: e.g - 'customer': `[ 'email' => 'example@example.com', 'phonenumber' => '08012345678', 'name' => 'Takeshi Kovacs' ]` |
| subaccounts | False | This is an array of objects containing the subaccount IDs to split the payment into. Check our Split Payment page for more info |
| meta | False | This is an object that helps you include additional payment information to your request e.g `[ 'consumer_id' => 23, 'consumer_mac' => '92a3-912ba-1192a']` |
| customizations | True | This is an object that contains title, logo, and description you want to display on the modal e.g `[ 'title' => 'Pied Piper Payments' 'description' => 'Middleout isn't free. Pay the price', 'logo' => 'https://assets.piedpiper.com/logo.png' ]` |
| subaccounts | False | This is an array of objects containing the subaccount IDs to split the payment into. Check our Split Payment page for more info |
| meta | False | This is an object that helps you include additional payment information to your request e.g `[ 'consumer_id' => 23, 'consumer_mac' => '92a3-912ba-1192a' ]` |
| customizations | True | This is an object that contains title, logo, and description you want to display on the modal e.g `[ 'title' => 'Pied Piper Payments', 'description' => 'Middleout isn't free. Pay the price', 'logo' => 'https://assets.piedpiper.com/logo.png' ]` |
#### Available payment options
To use custom options for your payment modal, you need to go to your [accounts](https://dashboard.flutterwave.com/dashboard/settings/accounts) page and uncheck `Enable Dashboard Payment Options`
Here are all the possible values for payment options available on Flutterwave:
- account
- card
- banktransfer
- mpesa
- mobilemoneyrwanda
- mobilemoneyzambia
- qr
- mobilemoneyuganda
- ussd
- credit
- barter
- mobilemoneyghana
- payattitude
- mobilemoneyfranco
- paga
- 1voucher
- mobilemoneytanzania
### Alternate Confirmation
Apart from callback, you can also use Webhook to receive notifications for your transactions. Click [here](/verification/webhook.html) to set it up

View File

@@ -0,0 +1,15 @@
---
home: true
heroImage: https://flutterwave.com/images/graph/home.png
tagline: A Laravel package that makes it easy to use Flutterwave APIs
actionText: Get Started →
actionLink: /getting-started/installation.html
# features:
# - title: Feature 1 Title
# details: Feature 1 Description
# - title: Feature 2 Title
# details: Feature 2 Description
# - title: Feature 3 Title
# details: Feature 3 Description
footer: Made by Oluwole Adebiyi (Kingflamez) with ❤️
---

View File

@@ -0,0 +1,40 @@
# Charge via ACH payment
This helps you to accept South African ACH charges from your customers
```php
<?php
$reference = Flutterwave::generateReference();
$data = [
'amount' => 100,
'email' => 'wole@email.co',
'currency' => 'ZAR',
'tx_ref' => $reference,
];
$response = Flutterwave::payments()->ach($data);
if ($response['status'] === 'success') {
# code...
}
```
## Parameters
| Parameter | Required | Description |
| ------------------ | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| amount | True | This is the amount to be charged. Expected value is ZAR |
| currency | True | ZAR or USD |
| email | True | This is the email address of the customer. |
| tx_ref | True | This is a unique reference, unique to the particular transaction being carried out. It is generated when it is not provided by the merchant for every transaction. |
| fullname | False | This is the customers full name. It should include first and last name of the customer. |
| phone_number | False | This is the phone number linked to the customer's mobile money account. |
| client_ip | False | IP - Internet Protocol. This represents the current IP address of the customer carrying out the transaction |
| device_fingerprint | False | This is the fingerprint for the device being used. It can be generated using a library on whatever platform is being used. |
| meta | False | This is used to include additional payment information` |
| subaccounts | False | This is an array of objects containing the subaccount IDs to split the payment into. Check our Split Payment page for more info |
| meta | False | This is an object that helps you include additional payment information to your request e.g ['consumer_id'=>23, 'consumer_mac'=>'92a3-912ba-1192a'] |
| redirect_url | False | This is a url you provide, we redirect to it after the customer completes payment and append the response to it as query parameters. |
| country | False | Pass your country as US for US ACH payments and ZA for SA ACH payments. |

View File

@@ -0,0 +1,54 @@
# Charge via Francophone mobile money
This document describes how to collect payments via Francophone mobile money.
```php
<?php
$tx_ref = Flutterwave::generateReference();
$data = [
'amount' => 300,
'currency' => 'XAF',
'phone_number'=> '237******20',
'email' => 'wole@email.co',
'tx_ref' => $tx_ref
];
$charge = Flutterwave::payments()->momoFranc($data);
if ($charge['status'] === 'success') {
$data = Flutterwave::verifyTransaction($charge['data']['id']);
return dd($data);
// Get the transaction from your DB using the transaction reference (txref)
// Check if you have previously given value for the transaction. If you have, redirect to your successpage else, continue
// Confirm that the $data['data']['status'] is 'successful'
// Confirm that the currency on your db transaction is equal to the returned currency
// Confirm that the db transaction amount is equal to the returned amount
// Update the db transaction record (including parameters that didn't exist before the transaction is completed. for audit purpose)
// Give value for the transaction
// Update the transaction to note that you have given value for the transaction
// You can also redirect to your success page from here
}
```
## Parameters
| Parameter | Required | Description |
| ------------------ | -------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| amount | True | This is the amount to be charged. Expected value is ZMW |
| currency | True | This is the specified currency to charge in. (expected value: XAF or XOF) ZMW |
| email | True | This is the email address of the customer. |
| phone_number | True | This is the phone number linked to the customer's mobile money account |
| tx_ref | True | This is a unique reference, unique to the particular transaction being carried out. It is generated when it is not provided by the merchant for every transaction. |
| network | True | This is the customer's mobile money network. possible values are `MTN` `ZAMTEL` |
| country | False | Unique ref for the mobilemoney transaction to be provided by the merchant. |
| voucher | False | This is the voucher code generated by the customer. It is meant to be passed in the initial charge request. (only for Vodafone cash) provider |
| fullname | False | This is the customers full name. It should include first and last name of the customer. |
| phone_number | False | This is the phone number linked to the customer's mobile money account. |
| redirect_url | False | URL to redirect to when a transaction is completed. |
| client_ip | False | IP - Internet Protocol. This represents the current IP address of the customer carrying out the transaction |
| device_fingerprint | False | This is the fingerprint for the device being used. It can be generated using a library on whatever platform is being used. |
| meta | False | This is used to include additional payment information` |
| subaccounts | False | This is an array of objects containing the subaccount IDs to split the payment into. Check our Split Payment page for more info. eg `[ ["id" => "RS_D87A9EE339AE28BFA2AE86041C6DE70E"]]` |
| meta | False | This is an object that helps you include additional payment information to your request e.g ['consumer_id'=>23, 'consumer_mac'=>'92a3-912ba-1192a'] |

View File

@@ -0,0 +1,42 @@
# Charge via Ghana mobile money
This document describes how to collect payments via Ghana mobile money.
```php
<?php
$reference = Flutterwave::generateReference();
$data = [
'amount' => 100,
'email' => 'wole@email.co',
'redirect_url' => route('callback'),
'tx_ref' => $reference,
'phone_number' => '054709929220',
'network' => 'MTN'
];
$charge = Flutterwave::payments()->momoGH($data);
if ($charge['status'] === 'success') {
// Redirect to the charge url
return redirect($charge['data']['redirect']);
}
```
## Parameters
| Parameter | Required | Description |
| ------------------ | -------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| amount | True | This is the amount to be charged. Expected value is GHS |
| email | True | This is the email address of the customer. |
| tx_ref | True | This is a unique reference, unique to the particular transaction being carried out. It is generated when it is not provided by the merchant for every transaction. |
| phone_number | True | This is the phone number linked to the customer's mobile money account. |
| network | True | This is the customer's mobile money network provider (possible values: MTN, VODAFONE, TIGO) |
| fullname | False | This is the customers full name. It should include first and last name of the customer. |
| redirect_url | False | URL to redirect to when a transaction is completed. |
| client_ip | False | IP - Internet Protocol. This represents the current IP address of the customer carrying out the transaction |
| device_fingerprint | False | This is the fingerprint for the device being used. It can be generated using a library on whatever platform is being used. |
| meta | False | This is used to include additional payment information` |
| subaccounts | False | This is an array of objects containing the subaccount IDs to split the payment into. Check our Split Payment page for more info. eg `[ ["id" => "RS_D87A9EE339AE28BFA2AE86041C6DE70E"]]` |
| meta | False | This is an object that helps you include additional payment information to your request e.g ['consumer_id'=>23, 'consumer_mac'=>'92a3-912ba-1192a'] |

View File

@@ -0,0 +1,3 @@
# Introduction
This is needed for merchants that do not want to use Flutterwave Payment Modal, and want to implement the APIs directly

View File

@@ -0,0 +1,49 @@
# Charge via Mpesa
This document describes how to collect payments via Mpesa.
```php
<?php
$tx_ref = Flutterwave::generateReference();
$data = [
'amount' => 1500,
'email' => 'wole@email.co',
'phone_number' => '054709929220',
'tx_ref' => $tx_ref
];
$charge = Flutterwave::payments()->mpesa($data);
if ($charge['status'] === 'success') {
# code...
// Redirect to the charge url
$data = Flutterwave::verifyTransaction($charge['data']['id']);
return dd($data);
// Get the transaction from your DB using the transaction reference (txref)
// Check if you have previously given value for the transaction. If you have, redirect to your successpage else, continue
// Confirm that the $data['data']['status'] is 'successful'
// Confirm that the currency on your db transaction is equal to the returned currency
// Confirm that the db transaction amount is equal to the returned amount
// Update the db transaction record (including parameters that didn't exist before the transaction is completed. for audit purpose)
// Give value for the transaction
// Update the transaction to note that you have given value for the transaction
// You can also redirect to your success page from here
}
```
## Parameters
| Parameter | Required | Description |
| ------------------ | -------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| amount | True | This is the amount to be charged. Expected value is ZMW |
| email | True | This is the email address of the customer. |
| tx_ref | True | This is a unique reference, unique to the particular transaction being carried out. It is generated when it is not provided by the merchant for every transaction. |
| fullname | False | This is the customers full name. It should include first and last name of the customer. |
| phone_number | True | This is the phone number linked to the customer's mobile money account. |
| client_ip | False | IP - Internet Protocol. This represents the current IP address of the customer carrying out the transaction |
| device_fingerprint | False | This is the fingerprint for the device being used. It can be generated using a library on whatever platform is being used. |
| meta | False | This is used to include additional payment information` |
| subaccounts | False | This is an array of objects containing the subaccount IDs to split the payment into. Check our Split Payment page for more info. eg `[ ["id" => "RS_D87A9EE339AE28BFA2AE86041C6DE70E"]]` |
| meta | False | This is an object that helps you include additional payment information to your request e.g ['consumer_id'=>23, 'consumer_mac'=>'92a3-912ba-1192a'] |

View File

@@ -0,0 +1,38 @@
# Charge via NGN bank transfer (One time Payment)
This allows your customer to pay via a NIP (NIBBS Instant Payment) transfer.
```php
<?php
$reference = Flutterwave::generateReference();
$data = [
'amount' => 100,
'email' => 'wole@email.co',
'tx_ref' => $reference,
'narration' => 'Dstv - Bill Payment'
];
$bankDetails = Flutterwave::payments()->nigeriaBankTransfer($data);
if ($bankDetails['status'] === 'success') {
# show bank details to user
}
```
## Parameters
| Parameter | Required | Description |
| ------------------ | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| amount | True | This is the amount to be charged. Expected value is NGN |
| email | True | This is the email address of the customer. |
| tx_ref | True | This is a unique reference, unique to the particular transaction being carried out. It is generated when it is not provided by the merchant for every transaction. |
| fullname | False | This is the customers full name. It should include first and last name of the customer. |
| phone_number | False | This is the phone number linked to the customer. |
| client_ip | False | IP - Internet Protocol. This represents the current IP address of the customer carrying out the transaction |
| device_fingerprint | False | This is the fingerprint for the device being used. It can be generated using a library on whatever platform is being used. |
| meta | False | This is used to include additional payment information` |
| subaccounts | False | This is an array of objects containing the subaccount IDs to split the payment into. Check our Split Payment page for more info. eg ```[ ["id" => "RS_D87A9EE339AE28BFA2AE86041C6DE70E"]]```|
|meta | False | This is an object that helps you include additional payment information to your request e.g ['consumer_id'=>23, 'consumer_mac'=>'92a3-912ba-1192a']|

View File

@@ -0,0 +1,91 @@
# Payment Modal
## 1. Initiating a Payment
```php
<?php
//This generates a payment reference
$reference = Flutterwave::generateReference();
// Enter the details of the payment
$data = [
'payment_options' => 'card,banktransfer',
'amount' => 500,
'email' => request()->email,
'tx_ref' => $reference,
'currency' => "NGN",
'redirect_url' => route('callback'),
'customer' => [
'email' => request()->email,
"phonenumber" => request()->phone,
"name" => request()->name
],
"customizations" => [
"title" => 'Movie Ticket',
"description" => "20th October"
]
];
$payment = Flutterwave::initializePayment($data);
if (!$payment) {
// notify something went wrong
return;
}
return redirect($payment['link']);
```
### Payment Parameters
| Parameter | Required | Description |
| --------------- | -------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| tx_ref | True | Your transaction reference. This MUST be unique for every transaction |
| amount | True | Amount to charge the customer. |
| currency | False | currency to charge in. Defaults to NGN |
| integrity_hash | False | This is a sha256 hash of your FlutterwaveCheckout values, it is used for passing secured values to the payment gateway. |
| payment_options | True | This specifies the payment options to be displayed e.g - card, mobilemoney, ussd and so on. |
| payment_plan | False | This is the payment plan ID used for Recurring billing |
| redirect_url | True | URL to redirect to when a transaction is completed. This is useful for 3DSecure payments so we can redirect your customer back to a custom page you want to show them. |
| customer | True | This is an object that can contains your customer details: e.g - 'customer': `[ 'email' => 'example@example.com', 'phonenumber' => '08012345678', 'name' => 'Takeshi Kovacs' ]` |
| subaccounts | False | This is an array of objects containing the subaccount IDs to split the payment into. Check our Split Payment page for more info |
| meta | False | This is an object that helps you include additional payment information to your request e.g `[ 'consumer_id' => 23, 'consumer_mac' => '92a3-912ba-1192a']` |
| customizations | True | This is an object that contains title, logo, and description you want to display on the modal e.g `[ 'title' => 'Pied Piper Payments' 'description' => 'Middleout isn't free. Pay the price', 'logo' => 'https://assets.piedpiper.com/logo.png' ]` |
| subaccounts | False | This is an array of objects containing the subaccount IDs to split the payment into. Check our Split Payment page for more info |
| meta | False | This is an object that helps you include additional payment information to your request e.g `[ 'consumer_id' => 23, 'consumer_mac' => '92a3-912ba-1192a' ]` |
| customizations | True | This is an object that contains title, logo, and description you want to display on the modal e.g `[ 'title' => 'Pied Piper Payments', 'description' => 'Middleout isn't free. Pay the price', 'logo' => 'https://assets.piedpiper.com/logo.png' ]` |
#### Available payment options
To use custom options for your payment modal, you need to go to your [accounts](https://dashboard.flutterwave.com/dashboard/settings/accounts) page and uncheck `Enable Dashboard Payment Options`
Here are all the possible values for payment options available on Flutterwave:
- account
- card
- banktransfer
- mpesa
- mobilemoneyrwanda
- mobilemoneyzambia
- qr
- mobilemoneyuganda
- ussd
- credit
- barter
- mobilemoneyghana
- payattitude
- mobilemoneyfranco
- paga
- 1voucher
- mobilemoneytanzania
## 2. Verifying a Payment:
```php
<?php
$data = Flutterwave::verifyTransaction(request()->transaction_id);
```

View File

@@ -0,0 +1,44 @@
# Charge via Rwanda mobile money
This document describes how to collect payments via Rwanda mobile money.
```php
<?php
$tx_ref = Flutterwave::generateReference();
$order_id = Flutterwave::generateReference('momo');
$data = [
'amount' => 100,
'email' => 'wole@email.co',
'redirect_url' => route('callback'),
'phone_number' => '054709929220',
'tx_ref' => $tx_ref,
'order_id' => $order_id
];
$charge = Flutterwave::payments()->momoRW($data);
if ($charge['status'] === 'success') {
# code...
// Redirect to the charge url
return redirect($charge['data']['redirect']);
}
```
## Parameters
| Parameter | Required | Description |
| ------------------ | -------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| amount | True | This is the amount to be charged. Expected value is RWF |
| email | True | This is the email address of the customer. |
| tx_ref | True | This is a unique reference, unique to the particular transaction being carried out. It is generated when it is not provided by the merchant for every transaction. |
| order_id | True | Unique ref for the mobilemoney transaction to be provided by the merchant. |
| fullname | False | This is the customers full name. It should include first and last name of the customer. |
| phone_number | False | This is the phone number linked to the customer's mobile money account. |
| redirect_url | False | URL to redirect to when a transaction is completed. |
| client_ip | False | IP - Internet Protocol. This represents the current IP address of the customer carrying out the transaction |
| device_fingerprint | False | This is the fingerprint for the device being used. It can be generated using a library on whatever platform is being used. |
| meta | False | This is used to include additional payment information` |
| subaccounts | False | This is an array of objects containing the subaccount IDs to split the payment into. Check our Split Payment page for more info. eg `[ ["id" => "RS_D87A9EE339AE28BFA2AE86041C6DE70E"]]` |
| meta | False | This is an object that helps you include additional payment information to your request e.g ['consumer_id'=>23, 'consumer_mac'=>'92a3-912ba-1192a'] |

View File

@@ -0,0 +1,46 @@
# Charge via Uganda mobile money
This document describes how to collect payments via Uganda mobile money.
```php
<?php
$tx_ref = Flutterwave::generateReference();
$order_id = Flutterwave::generateReference('momo');
$data = [
'amount' => 100,
'email' => 'wole@email.co',
'redirect_url' => route('callback'),
'phone_number' => '054709929220',
'tx_ref' => $tx_ref,
'order_id' => $order_id
];
$charge = Flutterwave::payments()->momoUG($data);
if ($charge['status'] === 'success') {
# code...
// Redirect to the charge url
return redirect($charge['data']['redirect']);
}
```
## Parameters
| Parameter | Required | Description |
| ------------------ | -------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| amount | True | This is the amount to be charged. Expected value is RWF |
| email | True | This is the email address of the customer. |
| tx_ref | True | This is a unique reference, unique to the particular transaction being carried out. It is generated when it is not provided by the merchant for every transaction. |
| order_id | False | Unique ref for the mobilemoney transaction to be provided by the merchant. |
| voucher | False | This is the voucher code generated by the customer. It is meant to be passed in the initial charge request. (only for Vodafone cash) provider |
| network | False | This is the customer's mobile money network provider |
| fullname | False | This is the customers full name. It should include first and last name of the customer. |
| phone_number | False | This is the phone number linked to the customer's mobile money account. |
| redirect_url | False | URL to redirect to when a transaction is completed. |
| client_ip | False | IP - Internet Protocol. This represents the current IP address of the customer carrying out the transaction |
| device_fingerprint | False | This is the fingerprint for the device being used. It can be generated using a library on whatever platform is being used. |
| meta | False | This is used to include additional payment information` |
| subaccounts | False | This is an array of objects containing the subaccount IDs to split the payment into. Check our Split Payment page for more info. eg `[ ["id" => "RS_D87A9EE339AE28BFA2AE86041C6DE70E"]]` |
| meta | False | This is an object that helps you include additional payment information to your request e.g ['consumer_id'=>23, 'consumer_mac'=>'92a3-912ba-1192a'] |

View File

@@ -0,0 +1,51 @@
# Charge via Voucher payment
This page describes how to collect ZAR payments offline using Vouchers
```php
<?php
$reference = Flutterwave::generateReference();
$data = [
'amount' => 100,
'email' => 'wole@email.co',
'tx_ref' => $reference,
'pin' => '19203804939000',
];
$response = Flutterwave::payments()->voucher($data);
if ($response['status'] === 'success') {
# code...
$data = Flutterwave::verifyTransaction($response['data']['id']);
return dd($data);
// Get the transaction from your DB using the transaction reference (txref)
// Check if you have previously given value for the transaction. If you have, redirect to your successpage else, continue
// Confirm that the $data['data']['status'] is 'successful'
// Confirm that the currency on your db transaction is equal to the returned currency
// Confirm that the db transaction amount is equal to the returned amount
// Update the db transaction record (including parameters that didn't exist before the transaction is completed. for audit purpose)
// Give value for the transaction
// Update the transaction to note that you have given value for the transaction
// You can also redirect to your success page from here
}
```
## Parameters
| Parameter | Required | Description |
| ------------------ | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| amount | True | This is the amount to be charged. Expected value is ZAR |
| email | True | This is the email address of the customer. |
| tx_ref | True | This is a unique reference, unique to the particular transaction being carried out. It is generated when it is not provided by the merchant for every transaction. |
| pin | True | This is the voucher pin given to the user after redemption at the agent location. They would provide this to you as the voucher code. |
| fullname | False | This is the customers full name. It should include first and last name of the customer. |
| phone_number | False | This is the phone number linked to the customer's mobile money account. |
| client_ip | False | IP - Internet Protocol. This represents the current IP address of the customer carrying out the transaction |
| device_fingerprint | False | This is the fingerprint for the device being used. It can be generated using a library on whatever platform is being used. |
| meta | False | This is used to include additional payment information` |
| subaccounts | False | This is an array of objects containing the subaccount IDs to split the payment into. Check our Split Payment page for more info |
| meta | False | This is an object that helps you include additional payment information to your request e.g ['consumer_id'=>23, 'consumer_mac'=>'92a3-912ba-1192a'] |
| redirect_url | False | This is a url you provide, we redirect to it after the customer completes payment and append the response to it as query parameters. |
| country | False | Pass your country as US for US ACH payments and ZA for SA ACH payments. |

View File

@@ -0,0 +1,47 @@
# Charge via Zambia mobile money
This document describes how to collect payments via Zambia mobile money.
```php
<?php
$tx_ref = Flutterwave::generateReference();
$order_id = Flutterwave::generateReference('momo');
$data = [
'amount' => 100,
'email' => 'wole@email.co',
'redirect_url' => route('callback'),
'phone_number' => '054709929220',
'tx_ref' => $tx_ref,
'network' => 'MTN',
'order_id' => $order_id
];
$charge = Flutterwave::payments()->momoZambia($data);
if ($charge['status'] === 'success') {
# code...
// Redirect to the charge url
return redirect($charge['data']['redirect']);
}
```
## Parameters
| Parameter | Required | Description |
| ------------------ | -------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| amount | True | This is the amount to be charged. Expected value is ZMW |
| email | True | This is the email address of the customer. |
| tx_ref | True | This is a unique reference, unique to the particular transaction being carried out. It is generated when it is not provided by the merchant for every transaction. |
| network | True | This is the customer's mobile money network. possible values are `MTN ` `ZAMTEL` |
| order_id | False | Unique ref for the mobilemoney transaction to be provided by the merchant. |
| voucher | False | This is the voucher code generated by the customer. It is meant to be passed in the initial charge request. (only for Vodafone cash) provider |
| fullname | False | This is the customers full name. It should include first and last name of the customer. |
| phone_number | False | This is the phone number linked to the customer's mobile money account. |
| redirect_url | False | URL to redirect to when a transaction is completed. |
| client_ip | False | IP - Internet Protocol. This represents the current IP address of the customer carrying out the transaction |
| device_fingerprint | False | This is the fingerprint for the device being used. It can be generated using a library on whatever platform is being used. |
| meta | False | This is used to include additional payment information` |
| subaccounts | False | This is an array of objects containing the subaccount IDs to split the payment into. Check our Split Payment page for more info. eg `[ ["id" => "RS_D87A9EE339AE28BFA2AE86041C6DE70E"]]` |
| meta | False | This is an object that helps you include additional payment information to your request e.g ['consumer_id'=>23, 'consumer_mac'=>'92a3-912ba-1192a'] |

View File

@@ -0,0 +1,42 @@
# Bulk Transfer
This document shows you how to initiate a bulk transfer.
```php
<?php
$data = [
"title" => "akhlm pstmn blktrnfr xx03",
"bulk_data" => [
[
"bank_code" => "044",
"account_number" => "0690000032",
"amount" => 45000,
"currency" => "NGN",
"narration" => "akhlm blktrnsfr",
"reference" => "akhlm-blktrnsfr-xx03"
],
[
"bank_code" => "044",
"account_number" => "0690000034",
"amount" => 5000,
"currency" => "NGN",
"narration" => "akhlm blktrnsfr",
"reference" => "akhlm-blktrnsfr-xy03"
]
]
];
$transfer = Flutterwave::transfers()->bulk($data);
dd($transfer);
```
Please setup a [webhook](/verification/webhook) to get status on your transfers. When you initiate a transfer you get a queuing status, once the transfer is successful or failed, we hit your webhook to alert you, you can update the status of the transfer from there
## Parameters
| Parameter | Required | Description |
| --------- | -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| bulk_data | True | An array of objects containing the transfer charge data. This array contains the same payload you would passed to create [a single transfer](/transfers/initiate-transfers) with multiple different values. |
| title | False | Title of the bulk transfer |

View File

@@ -0,0 +1,26 @@
# Transfer Fees
Get applicable transfer fee.
```php
<?php
$data = [
'amount' => '500',
'currency' => 'USD'
];
$transfer = Flutterwave::transfers()->fees($data);
dd($transfer);
```
## Parameters
| Parameter | Required | Description |
| --------- | -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| amount | True | This is the transfer amount to be fetched. |
| currency | False | Pass this to specify the exact currency you want to fetch the fees for. Example: USD, NGN, etc |
| type | False | This is the type of transfer you want to get the fee for. Usual values are `mobilemoney` or `account` |

View File

@@ -0,0 +1,12 @@
# Get a transfer
Fetch a single transfer on your account
```php
<?php
$transferId = 187092;
$transfer = Flutterwave::transfers()->fetch($transferId);
dd($transfer);
```

View File

@@ -0,0 +1,25 @@
# Get all transfers
Fetch all transfers on your account.
```php
<?php
$data = [
'page' => 1,
'status' => 'SUCCESSFUL'
];
// $data is optional
$transfers = Flutterwave::transfers()->fetchAll($data);
dd($transfers);
```
## Parameters
| Parameter | Required | Description |
| --------- | -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| page | False | This allows you fetch from a specific page e.g. setting page to 1 fetches the first page. |
| status | False | This allows you fetch only transfers with a specific status e.g. fetch all successful transactions. Possible values are failed, successful |

View File

@@ -0,0 +1,434 @@
# Initiate Transfer
This will show you how to initiate a transfer.
```php
<?php
$reference = Flutterwave::generateReference();
$data = [
'account_bank'=> '044',
'account_number'=> '0690000040',
'amount' => 5500,
'narration' => 'Payment for goods purchased',
'currency' => 'NGN',
'reference' => $reference
];
$transfer = Flutterwave::transfers()->initiate($data);
dd($transfer);
```
Please setup a [webhook](/verification/webhook) to get status on your transfers. When you initiate a transfer you get a queuing status, once the transfer is successful or failed, we hit your webhook to alert you, you can update the status of the transfer from there.
> You can also setup a cron job that checks all pending transfers status in your db and updates them accordingly
```php
$transferId = 187092; // get transfer ID from your DB
$transfer = Flutterwave::transfers()->fetch($transferId);
if($transfer['data']['status'] === 'SUCCESSFUL') {
// update transfer status to successful in your db
} else if ($transfer['data']['status'] === 'FAILED') {
// update transfer status to failed in your db
// revert customer balance back
} else if ($transfer['data']['status'] === 'PENDING') {
// update transfer status to pending in your db
}
```
## Parameters
| Parameter | Required | Description |
| ----------------------- | -------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| account_bank | True | This is the recipient bank code. You can see a list of all the available banks and their codes [here](/banks/list-banks). |
| account_number | True | This is the recipient account number. When testing on staging, you can find a list of test bank accounts [here](https://developer.flutterwave.com/docs/test-bank-accounts).. |
| amount | True | This is the amount to transfer to the recipient. |
| currency | True | This can be `NGN`, `GHS`, `KES`, `UGX`, `TZS`, `USD` or `ZAR`. |
| narration | False | This is the narration for the transfer e.g. payments for x services provided |
| beneficiary_name | False | This is the name of the beneficiary.. |
| destination_branch_code | False | This code uniquely identifies bank branches for disbursements into Ghana, Uganda and Tanzania. It is returned in the call to fetch bank branches here: [Click Here](/banks/bank-branches). It is only REQUIRED for GHS, UGX and TZS bank transfers. |
| beneficiary | False | This is the beneficiary's id. It allows you to initiate a transfer to an existing beneficiary. You can pass this in place of `account_bank` & `account_number`. It is returned in the call to fetch a beneficiary as `data['id']`. [Click here to create a beneficiary](/beneficiaries/create-beneficiary) |
| reference | False | This is a merchant's unique reference for the transfer, it can be used to query for the status of the transfer. |
| debit_currency | False | You can pass this when you want to debit a currency balance and send money in another currency. |
| meta | False | This is an object that helps you include additional payment information to your request e.g ['consumer_id'=>23, 'consumer_mac'=>'92a3-912ba-1192a'] |
## Transfer to Nigerian bank accounts
```php
<?php
$reference = Flutterwave::generateReference();
$data = [
"account_bank"=>"044",
"account_number"=>"0690000040",
"amount"=>5500,
"narration"=>"Akhlm Pstmn Trnsfr xx007",
"currency"=>"NGN",
"debit_currency"=>"NGN"
'reference' => $reference
];
$transfer = Flutterwave::transfers()->initiate($data);
dd($transfer);
// {
// "status": "success",
// "message": "Transfer Queued Successfully",
// "data": {
// "id": 26251,
// "account_number": "0690000040",
// "bank_code": "044",
// "full_name": "Ekene Eze",
// "created_at": "2020-01-20T16:09:34.000Z",
// "currency": "NGN",
// "debit_currency": "NGN",
// "amount": 5500,
// "fee": 45,
// "status": "NEW",
// "reference": "akhlm-pstmnpyt-rfxx007_PMCKDU_1",
// "meta": null,
// "narration": "Akhlm Pstmn Trnsfr xx007",
// "complete_message": "",
// "requires_approval": 0,
// "is_approved": 1,
// "bank_name": "ACCESS BANK NIGERIA"
// }
// }
```
## International Transfers (Other countries)
```php
<?php
$data = [
"amount" => 50,
"narration" => "Test Int'l bank transfers",
"currency" => "USD",
"reference" => "new-intl-test-transfer",
"beneficiary_name" => "Mark Cuban ",
"meta" => [
[
"AccountNumber" => "091820932BH",
"RoutingNumber" => "0000002993",
"SwiftCode" => "ABJG190",
"BankName" => "BARCLAYS BANK (U) LIMITED",
"BeneficiaryName" => "Mark Cuban",
"BeneficiaryAddress" => "HANNINGTON ROAD, KAMPALA UGANDA",
"BeneficiaryCountry" => "OT"
]
]
];
$transfer = Flutterwave::transfers()->initiate($data);
dd($transfer);
```
## International Transfers (EUR & GBP)
```php
<?php
$data = [
"amount" => 50,
"narration" => "Test EU Int'l bank transfers",
"currency" => "EUR",
"reference" => "new-intl-eu-test-transfer",
"beneficiary_name" => "John Twain",
"meta" => [
[
"AccountNumber" => "DA091983888373BGH",
"RoutingNumber" => "BECFDE7HKKX",
"SwiftCode" => "BECFDE7HKKX",
"BankName" => "LLOYDS BANK",
"BeneficiaryName" => "John Twain",
"BeneficiaryCountry" => "DE",
"PostalCode" => "80489",
"StreetNumber" => "31",
"StreetName" => "Handelsbank Elsenheimer Str.",
"City" => "München"
]
]
];
$transfer = Flutterwave::transfers()->initiate($data);
dd($transfer);
```
## Transfer to Ghana bank account
```php
<?php
$data = [
"account_bank" => "GH280100",
"account_number" => "0031625807099",
"amount" => 50,
"narration" => "Test GHS bank transfers",
"currency" => "GHS",
"reference" => "new-GHS-test-transfer1",
"callback_url" => "https://webhook.site/b3e505b0-fe02-430e-a538-22bbbce8ce0d",
"destination_branch_code" => "GH280103",
"beneficiary_name" => "Kwame Adew"
];
$transfer = Flutterwave::transfers()->initiate($data);
dd($transfer);
```
## International transfers (US)
```php
<?php
$data = [
"amount" => 50,
"narration" => "Test Int'l bank transfers",
"currency" => "USD",
"reference" => "new-intl-test-transfer1",
"beneficiary_name" => "Mark Cuban ",
"meta" => [
[
"AccountNumber" => "09182972BH",
"RoutingNumber" => "0000000002993",
"SwiftCode" => "ABJG190",
"BankName" => "BANK OF AMERICA, N.A., SAN FRANCISCO, CA",
"BeneficiaryName" => "Mark Cuban",
"BeneficiaryAddress" => "San Francisco, 4 Newton",
"BeneficiaryCountry" => "US"
]
]
];
$transfer = Flutterwave::transfers()->initiate($data);
dd($transfer);
```
## Mpesa Mobile Money Transfer
```php
<?php
$data = [
"account_bank" => "MPS",
"account_number" => "2540782773934",
"amount" => 50,
"narration" => "New transfer",
"currency" => "KES",
"reference" => "mk-902837-jk",
"beneficiary_name" => "Kwame Adew"
];
$transfer = Flutterwave::transfers()->initiate($data);
dd($transfer);
```
## Ghana Mobile Money Transfer
```php
<?php
$data = [
"account_bank" => "MTN",
"account_number" => "233542773934",
"amount" => 50,
"narration" => "New GHS momo transfer",
"currency" => "GHS",
"reference" => "mk-902837-jk",
"beneficiary_name" => "Kwame Adew"
];
$transfer = Flutterwave::transfers()->initiate($data);
dd($transfer);
```
## Uganda Mobile Money Transfer
```php
<?php
$data = [
"account_bank" => "MPS",
"account_number" => "233542773934",
"amount" => 50,
"narration" => "New UGX momo transfer",
"currency" => "UGX",
"reference" => "mk-902837-jk",
"beneficiary_name" => "Kwame Adew"
];
$transfer = Flutterwave::transfers()->initiate($data);
dd($transfer);
```
## Rwanda Mobile Money Transfer
```php
<?php
$data = [
"account_bank" => "MPS",
"account_number" => "233542773934",
"amount" => 50,
"narration" => "New RWF momo transfer",
"currency" => "RWF",
"reference" => "mk-902837-jk",
"beneficiary_name" => "Kwame Adew"
];
$transfer = Flutterwave::transfers()->initiate($data);
dd($transfer);
```
## Francophone Mobile Money Transfer
```php
<?php
$data = [
"account_bank" => "FMM",
"account_number" => "233542773934",
"amount" => 50,
"narration" => "New franco momo transfer",
"currency" => "XAF",
"reference" => "mk-902837-jk",
"beneficiary_name" => "Kwame Adew"
];
$transfer = Flutterwave::transfers()->initiate($data);
dd($transfer);
```
## Transfer to a FLW account
```php
<?php
$data = [
"account_bank" => "flutterwave",
"account_number" => "00118468",
"amount" => 5500,
"narration" => "payment for x service provided",
"currency" => "NGN",
"reference" => "mk-902837-jk",
"debit_currency" => "NGN"
];
$transfer = Flutterwave::transfers()->initiate($data);
dd($transfer);
```
## Transfer USD to Nigerian DOM Accounts
```php
<?php
$data = [
"account_number" => "0690000036",
"account_bank" => "044",
"narration" => "Nada",
"amount" => 50,
"reference" => "khlm-dom-065",
"currency" => "USD",
"debit_currency" => "USD",
"beneficiary_name" => "Michale Lester",
"meta" => [
[
"first_name" => "Michale",
"last_name" => "Lester",
"email" => "dump@kizito",
"beneficiary_country" => "NG",
"mobile_number" => "+2348131133933",
"sender" => "Statik Selektah",
"merchant_name" => "Spotify"
]
]
];
$transfer = Flutterwave::transfers()->initiate($data);
dd($transfer);
```
## Transfer to SA Bank Account
```php
<?php
$data = [
"account_bank" => "FNB",
"account_number" => "0031625807099",
"amount" => 500,
"narration" => "Withdraw Fiat",
"currency" => "ZAR",
"reference" => "496_PMCKDU_1",
"debit_currency":"USD",
"callback_url" => "http://localhost:3000/deposits/banks/flutterwave_callback",
"meta" => [
[
"first_name" => "Michale",
"last_name" => "Lester",
"email" => "dump@kizito",
"mobile_number" => "+2348131133933"
]
]
];
$transfer = Flutterwave::transfers()->initiate($data);
dd($transfer);
```
## Transfer to Barter account
```php
<?php
$data = [
"account_number" => "+2348xxxxxxxx8",
"account_bank" => "barter",
"narration" => "Test",
"amount" => 20,
"reference" => "barter-transfer-2",
"currency" => "NGN",
"beneficiary_name" => "Ifunanya Ikemma"
];
$transfer = Flutterwave::transfers()->initiate($data);
dd($transfer);
```

View File

@@ -0,0 +1,15 @@
# Introduction
Transfers are used to send money to bank accounts.
## How transfers work
When a transfer is initiated, it comes with a status `NEW` indicating that the transfer has been queued for processing, and you would need to use the transfer ID to call the Fetch a Transfer endpoint to retrieve the updated status of the transfer.
## What happens when a transfer is completed?
When a transfer is completed we would push a notification to you via your Webhook. You can use the information we sent to you to confirm the status of the transfer.
If a transfer is already being processed and it fails during processing, we would also push a hook notification to you on your specified hook URL.
Click [here](/verification/webhook) to setup the webhook

View File

@@ -0,0 +1,13 @@
# Fetch transfer retry status
Fetch transfer retry attempts for a single transfer on your account.
```php
<?php
$retryId = 187092;
$retries = Flutterwave::transfers()->fetchRetries($retryId);
dd($retries);
```

View File

@@ -0,0 +1,13 @@
# Retry Transfer
This helps you retry a previously failed transfer.
```php
<?php
$transferId = 187092;
$transfer = Flutterwave::transfers()->retry($transferId);
dd($transfer);
```

View File

@@ -0,0 +1,66 @@
# Check transfer rates
This endpoint helps you understand transfer rates when making international transfers
```php
<?php
$data = [
'amount' => 1000,
'destination_currency' => 'USD',
'source_currency' => 'NGN'
];
$transfer = Flutterwave::transfers()->getTransferRate($data);
dd($transfer);
```
## Parameters
| Parameter | Required | Description |
| --------- | -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| amount | True | This is the amount to transfer to the recipient. |
| destination_currency | True | This is the wallet / currency you are making a transfer to. |
| source_currency | True | This is the wallet / currency to be debited for the transfer. |
::: warning This endpoint helps you calculate rates when making international transfers
John owes Paul $1000.
John only has money in his Flutterwave NGN wallet.
So he wants to send $1000 to Paul's but he wants Flutterwave to debit his NGN wallet for it.
But first, John would like to know exactly how much in Naira is $1000.
So he makes a request to this endpoint, with this object :
```php
$data = [
'amount' => 1000,
'destination_currency' => 'USD',
'source_currency' => 'NGN'
];
```
Which basically means "How much will it cost me to send $1000 from my NGN wallet to Paul?" Here's the response:
```php
[
"status" => "success",
"message" => "Transfer amount fetched",
"data" => [
"rate" => 415.264373,
"source" => [
"currency" => "NGN",
"amount" => 415264.373
],
"destination" => [
"currency" => "USD",
"amount" => 1000
]
]
]
```
The response tells John that "If you are sending $1000 from your NGN wallet to Paul, it will cost you NGN415,264.373"
This is one of the use cases for this endpoint. To help you understand the transfer rates when you are sending money across different currencies.
DISCLAIMER: This endpoint should NOT be used to determine FX rates from the central bank. Refer [here](https://www.abokifx.com/) for rates.
:::

View File

@@ -0,0 +1,134 @@
# Callbacks
If the `redirect_url` is added to your payment data, Flutterwave redirects there after every payment request
## 1. Setup your callback route
```php
// The callback url after a payment
Route::get('/rave/callback', [FlutterwaveController::class, 'callback'])->name('callback');
```
## 2. Setup your Controller
> Setup your controller to handle the routes. I created the `FlutterwaveController`. Use the `Flutterwave`
> facade.
```php
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use KingFlamez\Rave\Facades\Rave as Flutterwave;
class FlutterwaveController extends Controller
{
/**
* Obtain Flutterwave callback information
* @return void
*/
public function callback()
{
$transactionID = Flutterwave::getTransactionIDFromCallback();
$data = Flutterwave::verifyTransaction($transactionID);
dd($data);
// Get the transaction from your DB using the transaction reference (txref)
// Check if you have previously given value for the transaction. If you have, redirect to your successpage else, continue
// Confirm that the $data['data']['status'] is 'successful'
// Confirm that the currency on your db transaction is equal to the returned currency
// Confirm that the db transaction amount is equal to the returned amount
// Update the db transaction record (including parameters that didn't exist before the transaction is completed. for audit purpose)
// Give value for the transaction
// Update the transaction to note that you have given value for the transaction
// You can also redirect to your success page from here
}
}
```
## 3. Make sure to add `'redirect_url' => route('callback'),` to all your payment requests that will use the callback
eg
```php
<?php
namespace App\Http\Controllers;
use KingFlamez\Rave\Facades\Rave as Flutterwave;
class FlutterwaveController extends Controller
{
/**
* Initialize Rave payment process
* @return void
*/
public function initialize()
{
//This generates a payment reference
$reference = Flutterwave::generateReference();
// Enter the details of the payment
$data = [
'payment_options' => 'card,banktransfer',
'amount' => 500,
'email' => request()->email,
'tx_ref' => $reference,
'currency' => "NGN",
'redirect_url' => route('callback'),
'customer' => [
'email' => request()->email,
"phonenumber" => request()->phone,
"name" => request()->name
],
"customizations" => [
"title" => 'Movie Ticket',
"description" => "20th October"
]
];
$payment = Flutterwave::initializePayment($data);
if (!$payment) {
// notify something went wrong
return;
}
return redirect($payment['link']);
}
/**
* Obtain Rave callback information
* @return void
*/
public function callback()
{
$transactionID = Flutterwave::getTransactionIDFromCallback();
$data = Flutterwave::verifyTransaction($transactionID);
dd($data);
// Get the transaction from your DB using the transaction reference (txref)
// Check if you have previously given value for the transaction. If you have, redirect to your successpage else, continue
// Confirm that the $data['data']['status'] is 'successful'
// Confirm that the currency on your db transaction is equal to the returned currency
// Confirm that the db transaction amount is equal to the returned amount
// Update the db transaction record (including parameters that didn't exist before the transaction is completed. for audit purpose)
// Give value for the transaction
// Update the transaction to note that you have given value for the transaction
// You can also redirect to your success page from here
}
}
```

View File

@@ -0,0 +1,9 @@
# Payment Verification
When a user is done with payment, Flutterwave would redirect to your redirect url if present or hit your webhook url:
Please make sure one of this is available as it is important to verify all transactions before giving value to it
## [Webhook Notification](/verification/webhook.html)
## [Callback Notification](/verification/callback.html)

View File

@@ -0,0 +1,179 @@
# Webhooks
Click [here](https://developer.flutterwave.com/reference#webhook) to learn more about webhooks
For every transaction, Flutterwave will send a post request of the transaction to you, follow these steps to set it up
## 1. Setup your webhook routes
```php
Route::post('/webhook/flutterwave', [FlutterwaveController::class, 'webhook'])->name('webhook');
```
## 2. Add your webhook secret hash to your `.env`
```bash
FLW_PUBLIC_KEY=FLWPUBK-xxxxxxxxxxxxxxxxxxxxx-X
FLW_SECRET_KEY=FLWSECK-xxxxxxxxxxxxxxxxxxxxx-X
FLW_SECRET_HASH='MY_POTTY_PATTY'
```
## 3. Setup the webhook in your Flutterwave Dashboard
<img src="https://files.readme.io/6fc5add-Screenshot_2018-01-19_11.45.24.png" style="margin: 0 auto;" >
<p style="text-align: center">Login to you Flutterwave dashboard then click on settings , on the setting page navigate to webhooks to add a webhook.</p>
<img src="https://files.readme.io/fd1589b-webhook.png" style="margin: 0 auto;" >
<p style="text-align: center">Once on the webhook page, click the input text to add your webhook url and your secret hash and use the save action button to save it.</p>
## 4. Grant CSRF Access to Flutterwave Webhook
Go to `app/Http/Middleware/VerifyCsrfToken.php` and add your webhook url to the `$except` array
```php
protected $except = [
'/webhook/flutterwave',
];
```
### 4. Setup your Controller
> Setup your controller to handle the routes. I created the `FlutterwaveController`. Use the `Flutterwave`
> facade.
```php
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use KingFlamez\Rave\Facades\Rave as Flutterwave;
class FlutterwaveController extends Controller
{
/**
* Receives Flutterwave webhook
* @return void
*/
public function webhook(Request $request)
{
//This verifies the webhook is sent from Flutterwave
$verified = Flutterwave::verifyWebhook();
// if it is a charge event, verify and confirm it is a successful transaction
if ($verified && $request->event == 'charge.completed' && $request->data->status == 'successful') {
$verificationData = Flutterwave::verifyPayment($request->data['id']);
if ($verificationData['status'] === 'success') {
// process for successful charge
}
}
// if it is a transfer event, verify and confirm it is a successful transfer
if ($verified && $request->event == 'transfer.completed') {
$transfer = Flutterwave::transfers()->fetch($request->data['id']);
if($transfer['data']['status'] === 'SUCCESSFUL') {
// update transfer status to successful in your db
} else if ($transfer['data']['status'] === 'FAILED') {
// update transfer status to failed in your db
// revert customer balance back
} else if ($transfer['data']['status'] === 'PENDING') {
// update transfer status to pending in your db
}
}
}
}
```
## Webhook Samples
### Successful Payment
```json
{
"event": "charge.completed",
"data": {
"id": 285959875,
"tx_ref": "Links-616626414629",
"flw_ref": "PeterEkene/FLW270177170",
"device_fingerprint": "a42937f4a73ce8bb8b8df14e63a2df31",
"amount": 100,
"currency": "NGN",
"charged_amount": 100,
"app_fee": 1.4,
"merchant_fee": 0,
"processor_response": "Approved by Financial Institution",
"auth_model": "PIN",
"ip": "197.210.64.96",
"narration": "CARD Transaction ",
"status": "successful",
"payment_type": "card",
"created_at": "2020-07-06T19:17:04.000Z",
"account_id": 17321,
"customer": {
"id": 215604089,
"name": "Yemi Desola",
"phone_number": null,
"email": "user@gmail.com",
"created_at": "2020-07-06T19:17:04.000Z"
},
"card": {
"first_6digits": "123456",
"last_4digits": "7889",
"issuer": "VERVE FIRST CITY MONUMENT BANK PLC",
"country": "NG",
"type": "VERVE",
"expiry": "02/23"
}
}
}
```
### Successful Transfers
```json
{
"event": "transfer.completed",
"event.type": "Transfer",
"data": {
"id": 33286,
"account_number": "0690000033",
"bank_name": "ACCESS BANK NIGERIA",
"bank_code": "044",
"fullname": "Bale Gary",
"created_at": "2020-04-14T16:39:17.000Z",
"currency": "NGN",
"debit_currency": "NGN",
"amount": 30020,
"fee": 26.875,
"status": "SUCCESSFUL",
"reference": "a0a827b1eca65311_PMCKDU_5",
"meta": null,
"narration": "lolololo",
"approver": null,
"complete_message": "Successful",
"requires_approval": 0,
"is_approved": 1
}
}
```
## Best practices
If your webhook script performs complex logic, or makes network calls, it's possible that the script would time out before Flutterwave sees its complete execution. For that reason, you might want to have your webhook endpoint immediately acknowledge receipt by returning a 2xx HTTP status code, and then perform the rest of its duties.
Webhook endpoints might occasionally receive the same event more than once. We advise you to guard against duplicated event receipts by making your event processing [idempotent](https://en.wikipedia.org/wiki/Idempotence). One way I do this is making the reference unique, so once it has hit the server more than once, it won't record for subsequent events