-
Notifications
You must be signed in to change notification settings - Fork 20
Direct Charge
Abraham Olaobaju edited this page Aug 22, 2023
·
18 revisions
The charge APIs help you to collect payments using different payment methods.
Direct card charge allows you to charge both local cards (issued in your country of operation) and international cards. This is useful if your customers are predominantly credit/debit card users, and you'd prefer for them to manage payments via your app.
use Flutterwave\Util\Currency;
$data = [
"amount" => 2000,
"currency" => Currency::NGN,
"tx_ref" => "TEST-".uniqid().time(),
"redirectUrl" => "https://www.example.com",
"additionalData" => [
"subaccounts" => [
["id" => "RSA_345983858845935893"]
],
"meta" => [
"unique_id" => uniqid().uniqid()
],
"preauthorize" => false,
"payment_plan" => null,
"card_details" => [
"card_number" => "5531886652142950",
"cvv" => "564",
"expiry_month" => "09",
"expiry_year" => "32"
]
],
];
$cardpayment = \Flutterwave\Flutterwave::create("card");
$customerObj = $cardpayment->customer->create([
"full_name" => "Olaobaju Abraham",
"email" => "[email protected]",
"phone" => "+234900154861"
]);
$data['customer'] = $customerObj;
$payload = $cardpayment->payload->create($data);
$result = $cardpayment->initiate($payload);
print_r($result);
Direct charge via bank transfer allows you to generate account details (account number and bank) on demand to receive payments from customers via bank transfer.
$data = [
"amount" => 2000,
"currency" => Currency::NGN,
"tx_ref" => uniqid().time(),
"redirectUrl" => "https://google.com"
];
$btpayment = Flutterwave::create("bank-transfer");
$customerObj = $btpayment->customer->create([
"full_name" => "Olaobaju Jesulayomi Abraham",
"email" => "[email protected]",
"phone" => "+2349067985011"
]);
$data['customer'] = $customerObj;
$payload = $btpayment->payload->create($data);
$result = $btpayment->initiate($payload);
print_r($result);