-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
35 lines (29 loc) · 760 Bytes
/
index.php
File metadata and controls
35 lines (29 loc) · 760 Bytes
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
<?php
include './vendor/autoload.php';
use \FedaPay\FedaPay;
use \FedaPay\Transaction;
FedaPay::setApiKey("sk_xxxxx");
FedaPay::setEnvironment('sandbox');
/**
* Create a transaction
*/
$transaction = Transaction::create([
"description" => "Transaction for john.doe@example.com",
"amount" => 1,
"currency" => ["iso" => "XOF"],
"customer" => [
"firstname" => "John",
"lastname" => "Doe",
"email" => "john.doe@example.com"
]
]);
/**
* Send a mobile money request
*/
$transaction->sendNow('mtn', ['phone_number' => ['number' => '66994148', "country" => "bj"]]);
/**
* Or generate a payment link to let the customer choose its payment mode
*
* $token = $transaction->generateToken();
* // to paymen page at $token->url
*/