> ## Documentation Index
> Fetch the complete documentation index at: https://flutterwaveinc.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Nigeria Account Charge

> Learn how to collect payment directly from your Nigerian customer’s bank accounts.

<Info>
  We recommend checking out the [introductory
  section](/payment-api/introduction) to understand the basics of direct
  charge first. This guide assumes you've read that.
</Info>

Direct debit is different from [bank transfers](/payment-api/bank-transfer). In direct debit, the customer enters their account details and authorizing info on your page; in bank transfers, you give them account details, and they make a transfer to you.

<Info>
  ## Supported Banks

  Direct bank account debit is currently only supported for the following banks:

  | Supported banks     | Bank Code |
  | ------------------- | --------- |
  | Access Bank         | 044       |
  | Guaranty Trust Bank | 058       |
  | First Bank          | 011       |
  | Sterling Bank       | 232       |
  | UBA                 | 033       |
  | Zenith Bank         | 057       |
</Info>

## Bank Transfer Process

Charging a Nigerian bank account involves three main steps:

1. **Initiate the payment**: You send the payment details to the bank account [charge endpoint](/api-reference/charges#bank-accounts-ng).
2. **Authorize the charge**: The customer authorizes the payment with their bank. The means of authorization will depend on the bank.
3. **Verify the payment**: As a failsafe, you'll call our API to verify that the payment was successful before giving value (via the [verify transaction endpoint](/api-reference/transactions/verify-a-transaction)).

<img src="https://mintcdn.com/flutterwaveinc/8LJ4mpYLmd_SNb9Z/images/mono.png?fit=max&auto=format&n=8LJ4mpYLmd_SNb9Z&q=85&s=e3011c49d17f30b1966d6e1204d4cc54" alt="mono" width="5760" height="11490" data-path="images/mono.png" />

### Step 1: Initiating the Payment

First, you'll need the customer's bank account details:

* You will need their `account_number`.
* You will need their `account_bank` (also referred to as the bank code; you can get this code with our [get banks endpoint](/api-reference/banks/get-all-banks)).
* You'll need to specify the following bank details `amount`, `currency`, `email`, `fullname`, and a unique `tx_ref`. You can also specify more details, such as the customer's `phone_number` and custom `meta` information. See the [reference documentation](/api-reference/charges#bank-accounts-ng) for details.

<Note>
  The currency you specify must match the account's currency. This is
  currently restricted to `NGN` accounts.
</Note>

Send these payment details to the [charge NG bank accounts endpoint](/api-reference/charges#bank-accounts-ng). Here are some examples of using our SDKs:

<CodeGroup>
  ```javascript Node.js theme={null}
  // Install with: npm i flutterwave-node-v3

  const Flutterwave = require('flutterwave-node-v3');
  const flw = new Flutterwave(process.env.FLW_PUBLIC_KEY, process.env.FLW_SECRET_KEY);

  const payload = {
  amount: 7500,
  currency: 'NGN',
  email: 'developers@flutterwavego.com',
  fullname: 'Flutterwave Developers',
  phone_number: '+2349012345678',
  tx_ref: 'UNIQUE_TRANSACTION_REFERENCE'
  }
  await flw.Charge.ng(payload);

  ```

  ```php PHP theme={null}
  // Installation: composer require flutterwavedev/flutterwave-v3

  use Flutterwave\Util\Currency;

  $data = [
      "amount" => 7500,
      "currency" => Currency::NGN,
      "tx_ref" => "UNIQUE_TRANSACTION_REFERENCE",
      "redirectUrl" => "https://example_company.com/success",
      "additionalData" => [
          "account_details" => [
              "account_bank" => "044",
              "account_number" => "0690000034",
              "country" => "NG"
          ]
      ],
  ];

  $accountpayment = \Flutterwave\Flutterwave::create("account");
  $customerObj = $accountpayment->customer->create([
      "email" => "developers@flutterwavego.com",
      "full_name" => "Flutterwave Developers",
      "phone" => "+2349012345678"
  ]);

  $data['customer'] = $customerObj;
  $payload  = $accountpayment->payload->create($data);
  $result = $accountpayment->initiate($payload);
  ```

  ```ruby Ruby theme={null}
  # Install with: gem install flutterwave_sdk

  require './flutterwave_sdk'

  flw = Flutterwave.new(ENV["FLW_PUBLIC_KEY"], ENV["FLW_SECRET_KEY"], ENV["FLW_ENCRYPTION_KEY"])
  account_payment = AccountPayment.new(flw)
  payload = {
      "account_bank": "044",
      "account_number": "0690000037",
      "amount": "7500",
      "currency": "NGN",
      "email": "developers@flutterwavego.com",
      "fullname": "Flutterwave Developers",
      "phone_number": "+2349012345678",
      "tx_ref": "UNIQUE_TRANSACTION_REFERENCE",
      "redirect_url": "https://example_company.com/success"
  }
  # Automatically uses the right endpoint based on the currency
  response = account_payment.initiate_charge(payload)
  ```

  ```json cURL theme={null}
  curl --request POST \
     --url https://api.flutterwave.com/v3/charges?type=debit_ng_account \
     --header 'Authorization: Bearer FLW_SECRET_KEY' \
     --header 'content-type: application/json' \
     --data '{
       "amount": 7500,
       "currency": "NGN",
       "email": "developers@flutterwavego.com",
       "fullname": "Flutterwave Developers",
       "phone_number": "+2349012345678",
       "tx_ref": "UNIQUE_TRANSACTION_REFERENCE"
  }'
  ```
</CodeGroup>

### Step 2: Handling the Response

If the request goes well, you'll get a successful response that gives you the details of the created transaction and information on how to authorize it.

```json Redirect theme={null}
// Typically used by FirstBank and GTB
{
	"status": "success",
	"message": "Charge initiated",
	"data": {
		"id": 862960580,
		"tx_ref": "UNIQUE_TRANSACTION_REFERENCE",
		"flw_ref": "MPOG80201678720780553218",
		"device_fingerprint": "N/A",
		"amount": 7500,
		"charged_amount": 7500,
		"app_fee": 105,
		"merchant_fee": 0,
		"processor_response": "Pending validation",
		"auth_model": "INTERNET_BANKING",
		"currency": "NGN",
		"ip": "N/A",
		"narration": "Flutterwave Developers",
		"status": "pending",
		"auth_url": "https://api.ravepay.co/flwv3-pug/getpaid/api/short-url/SCN0eHPMN-",
		"payment_type": "account",
		"fraud_status": "ok",
		"created_at": "2023-03-13T15:19:40.000Z",
		"account_id": 35308,
		"customer": {
			"id": 407680026,
			"phone_number": "2349012345678",
			"name": "Flutterwave Developers",
			"email": "developers@flutterwavego.com",
			"created_at": "2022-08-11T15:32:30.000Z"
		},
		"meta": {
			"authorization": {
				"mode": "redirect",
				"redirect": "https://api.ravepay.co/flwv3-pug/getpaid/api/short-url/SCN0eHPMN-",
				"validate_instructions": ""
			}
		}
	}
}
```

Here are some key details to note in the response:

* `status` is `"success"`, meaning that the charge was initiated successfully.

* `data.status` is `"pending"`, meaning that the customer needs to authorize the transaction with their bank.

* `meta.authorization` contains the important details to authorize the payment:

* The `mode` is `"redirect"`, which means the customer should be redirected to their bank for authorization.

* You'll have a `redirect` field, which is where you should redirect your customer to.

### Step 3: Authorizing the Transaction

To authorize the payment, you need to redirect the customer to the URL in the `redirect` field:

<CodeGroup>
  ```javascript Node.js theme={null}
  if (transaction.meta.authorization.mode == 'redirect') {
  	return res.redirect(transaction.meta.authorization.redirect);
  }
  ```

  ```php PHP theme={null}
  if ($transaction["meta"]["authorization"]["mode"] == "redirect") {
    return redirect($transaction["meta"]["authorization"]["redirect"]);
  }
  ```

  ```ruby Ruby theme={null}
  if transaction["meta"]["authorization"]["mode"] == "redirect"
    return redirect to: transaction["meta"]["authorization"]["redirect"]
  end
  ```
</CodeGroup>

## Wehooks

When the customer makes the payment, we'll send you a webhook notification. Here's what the payload looks like:

```json theme={null}
{
	"event": "charge.completed",
	"data": {
		"id": 862960580,
		"tx_ref": "UNIQUE_TRANSACTION_REFERENCE",
		"flw_ref": "MPOG80201678720780553218",
		"device_fingerprint": "N/A",
		"amount": 7500,
		"currency": "NGN",
		"charged_amount": 7500,
		"app_fee": 105,
		"merchant_fee": 0,
		"processor_response": "Approved by Financial Institution",
		"auth_model": "INTERNET_BANKING",
		"ip": "N/A",
		"narration": "Flutterwave Developers",
		"status": "successful",
		"payment_type": "account",
		"created_at": "2023-03-13T15:19:40.000Z",
		"account_id": 35308,
		"customer": {
			"id": 407680026,
			"name": "Flutterwave Developers",
			"phone_number": "2349012345678",
			"email": "developers@flutterwavego.com",
			"created_at": "2022-08-11T15:32:30.000Z"
		},
		"account": {
			"account_name": "undefined undefined"
		}
	}
}
```

Now, your webhook endpoint can handle the event and complete the customer's order. For help setting up webhooks, see our [guide on webhooks](/webhooks).

In your webhook handler, you can then verify the payment and credit your customers with whatever they paid for. See our guide to [transaction verification](/transaction-verification) for details.
