Payment Options - Only one visible in my LIVE

Hello,

Just integrated Flutterwave into my codeigniter 4 App successfully using the “Flutterwave Standard” option seccessfully.

However on my LIVE, am only getting only one PAYMENT OPTIONS and that is “CARD”.

In the dashboard, I have enabled all the payment options I need.

And when i read this line from the documentation
The payment_options field only works if you’ve unchecked Enable Dashboard Payment Options on your Account Settings.” is it is abit confusing.

Please advise.

I want to add that in my TEST local version, I only enabled card usage as option.

Let me hope that is not affecting the LIVE one.

Hi @Lwegaba_J_Bernald :wave:

Thank you for sharing this experience on the Forum,

In order for you to view all the available payment options on Live, you will need to navigate to your Flutterwave dashboard and switch to Live Mode, thereafter you can enable all payment methods from your settings menu.

Kindly note that the preferences you set on Test mode do not reflect on Live mode.

Hello Adekunle,

My account changed to LIVE MODE the time I verified all requirements.

And under Business Preferences I can see “payment option.”. The challenge i have is not in Flutterwave dashboard.

The problem is with the link I get in API only giving me one payment option yet I selected a couple of them. including card, ussd, mobilemoneyuganda,

So what am i doing wrong?

Hi @Lwegaba_J_Bernald

Kindly follow these steps;

  • Navigate to your dashboard and switch your account to Live Mode (from the bottom left corner of your screen).
  • Navigate to Settings => Business Preferences => Payment Methods.
  • Click on Enable all payment methods.
  • Navigate to Settings => API Keys.
  • Copy your Live API Keys and update the API Keys in your application with the Live API Keys.
  • using Flutterwave Standard, initiate a new charge (This time remove the “payment_options” parameter in your request payload)

After following the above steps, you will be able to view all the payment methods you enabled.

Still experiencing the problem.

  • Reset the API KEYS and entered new ones
  • Removed the payment_options field in both controller and view file.
  • I tried both enabling and disabling payment options in dashboard

Still experiencing issue.
However support is also helping me. I will wait for their feedback.

Thank you

I have the same challenge

Hi @Lwegaba_J_Bernald :wave:

I am glad you are getting adequate support on this issue,

However, another alternative to view your preferred payment options on the checkout modal is as follows;

  • Navigate to your dashboard and Disable all payment methods
    (Recall, if you are currently performing the transaction on Live mode, then you will have to perform this step on Live mode)
  • Update the “payment_options” parameter on your request payload by passing all your preferred payment options
    (i.e. "payment_options": "card, ussd, paypal, google pay, apple pay, eNaira" )

After following the above steps, you will be able to view all the selected payment methods you passed in the “payment_options” parameter.

Hello Adekunle,

I really do not know what am doing wrong. But I have failed to get other payment options rather than card.

I have also tried what you suggested above and all in vain.

And my card keeps saying its not 3D secure, so can’t make payments with it when trying on LIVE SITE. (Anyway that am coordinating with bank).

Am using codeigniter 4 and below is my Payment.php controller code as I shared on github.

<?php

namespace App\Controllers\Payments;

use CodeIgniter\Controller;

require_once ROOTPATH . "vendor/autoload.php";

use App\Controllers\BaseController;
use Flutterwave\EventHandlers\EventHandlerInterface;
use Flutterwave\Flutterwave;
use App\Models\SettingsModel;
use App\Models\TransactionsModel;

Flutterwave::bootstrap();



class Payments extends BaseController
{

    public $subscriptionModel;
    public function __construct()
    {
        parent::init();

        $this->transactionsModel                = new TransactionsModel();
		
		//Start Curl Services in codeigniter 4
        $this->client = \Config\Services::curlrequest();
        
        //Get required paramenters for the process & unique transaction token.
        $this->token = bin2hex(random_bytes(18));
		
        //Success link to connect to redirected Flutterwave link and help process results in your ci4 system.
        $this->success_url = base_url('clientarea/success/page/');

        //Flutterwave connection credentials
        $this->publicKey      = getenv('PUBLIC_KEY');
        $this->secretKey      = getenv('SECRET_KEY');
        $this->encryptionKey  = getenv('ENCRYPTION_KEY');
        $this->env            = getenv('ENV');
        $this->currency       = 'UGX';
        $this->prefix         = 'fw';
        $this->overrideRef    = false;
 
    }
	
	public function index()
	{
		//Displays the payment form with data to be submitted for payment.
		
		return view('pay/index', $this->data);
	}
 
   

/*** ====================================================================================================
 * FLUTTERWAVE 
 =======================================================================================================*/
    //Flutterwave payment
    public function flutterWave()
    {

        // Set the API endpoint URL
        $url = 'https://api.flutterwave.com/v3/payments';

        // Set the request headers
        $headers = [
            'Authorization' => 'Bearer ' . getenv('SECRET_KEY'),
            'Content-Type'  => 'application/json',
        ];

        // Set the request payload
        $payload = [
            'tx_ref'            => $this->token,
            'amount'            => $this->request->getPost('amount'),
            'currency'          => $this->currency,
            'redirect_url'      => $this->success_url,
            'customer'          => [
                'email'         => $this->request->getPost('email'),
                'firstname'     => $this->request->getPost('firstname'),
                'lastname'      => $this->request->getPost('lastname'),
                'phonenumber'   => $this->request->getPost('phonenumber'),
            ],
            'meta'              => [
                    'consumer_id'   => $this->tenantId->tenant_id,
            ],
            'customizations'     => [
                    'title'       => $this->request->getPost('title'),
                    'logo'        => $this->request->getPost('logo'),
                    'description' => $this->request->getPost('description'),
            ],
            'payment_plan'         => $this->user->subscription_period,
        ];

        //Saving Transaction Details in DB
        $fname = $this->request->getPost('firstname');
        $lname = $this->request->getPost('lastname');

        $transData = [
            'user_id'                       => $this->tenantId->user_id,
            'currency'                      => $this->currency,
            'payment_ref'             		=> $this->token,
            'amount'                        => $this->request->getPost('amount'),
            'payment_gateway'               => 'Flutterwave',
            'customer_name'                 => $fname.' '.$lname,
            'customer_email'                => $this->request->getPost('email'),
            'customer_phone'                => $this->request->getPost('phonenumber'),
            'description'                   => $this->request->getPost('description'),
            'invoice_id'                    => $invoice->id, //This is option as per your App setting
            'status'                        => 'pending',
        ];
        $this->transactionsModel->save($transData);

        // Convert the payload to JSON
        $jsonPayload = json_encode($payload);

        try {
            // Make a POST request to the API endpoint
            $response = $this->client->request('POST', $url, [
                'headers' => $headers,
                'body' => $jsonPayload
            ]);

            // Get the response body as JSON
            $responseJson = json_decode($response->getBody(), true);
            //var_dump($responseJson);
            
            // If the payment was successfully initialized, redirect the user to the payment page
            if (isset($responseJson['status']) && $responseJson['status'] == 'success') {
                return redirect()->to($responseJson['data']['link']);
            }
            

        } catch (\Exception $e) {
            // Handle any errors that occur during the request
            echo $e->getCode() . ' ' . $e->getMessage();
        }

    }

    //update Transaction Table after Flutterwave payments
    public function successLink()
    {
        //Details coming from payment Flutterwave payment Link
        $transactionId = $this->request->getGet('transaction_id');
        $status = $this->request->getGet('status');
        $tx_ref = $this->request->getGet('tx_ref');

		//Get Transactions ID to help update record in Db.
        $transactionDetails = $this->transactionsModel->where('payment_ref', $tx_ref)->first($tx_ref);
        //var_dump($transactionDetails);


        //Updating the Transactions Table with transaction Id, status, tx_ref
        $tData = [
            'transaction_id'        => $transactionId,
            'status'                => $status,
            'payment_ref'     		=> $tx_ref
        ];
        $forInvoice = $this->transactionsModel->update($transactionDetails['id'], $tData);
		
		//Display Transaction details into success page
		$this->data['details'] = $this->transactionsModel->getUserPaymentDetails($transactionDetails['id'])

        if($forInvoice)
		{
                // Send a success response back to Flutterwave
                if($this->request->isAJAX())
                {
                    $response = [
                            //'success' => true,
                            'status' => 'success',
                            'msg' =>'Payment was successful',	   
                    ];
                    return $this->response->setJSON($response);
                }else{
                    $this->session->setFlashdata('success', 'Payment was successful', 3);
                    return redirect()->to('clientarea/success/page'); 
                }
        }

        return view('pay/success_page', $this->data);
    }

}

Here is screenshot to confirm the account is in LIVE mode.

Hi @Lwegaba_J_Bernald

please kindly add “payment_options” to your payload here and add the payment options you wish to make collections with as the value.

more information on payment options can be found here

hi @Abraham_Olaobaju,
Thank you for the response. In my actual code i did add payment_options as advise earlier by @Adekunle

Here is the full payload

// Set the request payload
        $payload = [
            'tx_ref'            => $this->token,
            'amount'            => $this->request->getPost('amount'),
            'currency'          => $this->currency,
            'redirect_url'      => $this->success_url,
            'customer'          => [
                'email'         => $this->request->getPost('email'),
                'firstname'     => $this->request->getPost('firstname'),
                'lastname'      => $this->request->getPost('lastname'),
                'phonenumber'   => $this->request->getPost('phonenumber'),
            ],
            'meta'              => [
                    'consumer_id'   => $this->tenantId->tenant_id,
            ],
            'customizations'     => [
                    'title'       => $this->request->getPost('title'),
                    'logo'        => $this->request->getPost('logo'),
                    'description' => $this->request->getPost('description'),
            ],
            'payment_plan'         => $this->user->subscription_period,
            'payment_options'      =>$this->request->getPost('payment_options')
        ];

And this is addition in the view file

<input type="hidden" name="payment_options" value="card, account, ussd, mobilemoneyuganda, mpesa, paypal"/>

Then the link processing code is here that actually gives me the Flutterwave payment page.

// Convert the payload to JSON
        $jsonPayload = json_encode($payload);

        try {
            // Make a POST request to the API endpoint
            $response = $this->client->request('POST', $url, [
                'headers' => $headers,
                'body' => $jsonPayload
            ]);

            // Get the response body as JSON
            $responseJson = json_decode($response->getBody(), true);
            //var_dump($responseJson);
            
            // If the payment was successfully initialized, redirect the user to the payment page
            if (isset($responseJson['status']) && $responseJson['status'] == 'success') {
                return redirect()->to($responseJson['data']['link']);
            }
            

        } catch (\Exception $e) {
            // Handle any errors that occur during the request
            echo $e->getCode() . ' ' . $e->getMessage();
        }

Please advise if there is something am missing.

Should the PAYMENT OPTIONS be active in dashboard?

Hi @Lwegaba_J_Bernald when specifying ‘payment_options’ in your payload. it should not be active on your dashboard.

I have disabled all payment options as per screenshot here

Advise on next course of action please @Abraham_Olaobaju

Thanks

Hi @Lwegaba_J_Bernald :wave:

Kindly confirm the currency you want to charge in. (what was passed for the “currency” parameter)

The next step after this would be to test it out by sending a request and confirm if the payment methods you specified in the “payment_options” parameter are being displayed on the payment modal.

However, if the payment options you passed are not displayed, kindly share your Flutterwave account name and your merchant ID.

hi @Adekunle ,

my currency is UGX (Uganda Shillings).

$this->currency       = 'UGX';

Hi @Lwegaba_J_Bernald :wave:

Kindly note that Flutterwave only supports Card and Uganda mobilemoney as the payment methods for UGX Collections.

Therefore, you can either update the “payment_options” parameter on your request payload by passing both payment options (i.e. "payment_options": "card, mobilemoneyuganda" ), or you omit the “payment_options” parameter on your request payload and you should get only the available payment methods for UGX collections.

Hi @Adekunle am also facing the same issue as @Lwegaba_J_Bernald of having card as the only payment method in live I did all what you had justed to him but still the issue still persists I even removed card from payment options but still I get card.

Hi @Kaka_Isaac

please kindly confirm the currency you want to charge in.

I want to charge in ugx