-
Notifications
You must be signed in to change notification settings - Fork 17
/
account.php
78 lines (64 loc) · 2.12 KB
/
account.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
<?php
require __DIR__."/../vendor/autoload.php";
require "../setup.php";
session_start();
use Flutterwave\Helper;
use Flutterwave\Payload;
use Flutterwave\Service;
\Flutterwave\Flutterwave::bootstrap();
try {
$data = [
"amount" => 2000,
"currency" => Flutterwave\Util\Currency::NGN,
"tx_ref" => uniqid().time(),
"additionalData" => [
"account_details" => [
"account_bank" => "044",
"account_number" => "0690000034",
"country" => "NG"
]
],
];
$accountpayment = \Flutterwave\Flutterwave::create("account");
$customerObj = $accountpayment->customer->create([
"full_name" => "Olaobaju Jesulayomi Abraham",
"email" => "vicomma@gmail.com",
"phone" => "+2349067985861"
]);
$data['customer'] = $customerObj;
$payload = $accountpayment->payload->create($data);
if(!empty($_REQUEST))
{
$request = $_REQUEST;
if(isset($request['view'])){
$json = json_encode($payload->toArray('account'));
$request_display = $json;
}
if(isset($request['make'])){
$result = $accountpayment->initiate($payload);
// $instruction = $result['instruction'];
// require __DIR__."/examples/view/form/pin.php";
}
}
} catch (Exception $e) {
$error = $e->getMessage();
}
?>
<link rel="stylesheet" href="./assets/css/index.css">
<div class="buttons">
<form method="get">
<h3> Account Payment Sample</h3>
<span class="error"><?= $error ?? "" ?></span>
<div class="request">
<?= $request_display ?? "" ?>
</div>
<div class="cta">
<button name="view" value="1">View Request</button>
<button class="make-payment" name="make" value="1">Make Account Payment</button>
</div>
</form>
</div>
<script src="https://code.jquery.com/jquery-3.4.1.slim.min.js"
integrity="sha384-J6qa4849blE2+poT4WnyKhv5vZF5SrPo0iEjwBvKU7imGFAV0wwj1yYfoRSJoZ+n"
crossorigin="anonymous"></script>
<script src="./assets/js/index.js"></script>