How to create a recurring payment in Flutterwave API with PHP

On the previous article relate to this topic: How to integrate Flutterwave v3 Payment Gateway in PHP this is the second part of the article where we continue from where we stop there.

In this section we were able to create a recurring payment with the same API

Leggo

token.php

<?php 
$data = [
    'token' => 'flw-t1nf-0f7efa041fcc65af48cec24d6be3cec1-m03k',
    'currency' => 'NGN',
    'country' => 'NG',
    'amount' => 700,
    'tx_ref' => time(),
    'email' => 'seunexseun@gmail.com'
];

    //* Ca;; f;iterwave emdpoint
    $curl = curl_init();

    curl_setopt_array($curl, array(
    CURLOPT_URL => 'https://api.flutterwave.com/v3/tokenized-charges',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_ENCODING => '',
    CURLOPT_MAXREDIRS => 10,
    CURLOPT_TIMEOUT => 0,
    CURLOPT_FOLLOWLOCATION => true,
    CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
    CURLOPT_CUSTOMREQUEST => 'POST',
    CURLOPT_POSTFIELDS => json_encode($data),
    CURLOPT_HTTPHEADER => array(
        'Authorization: Bearer FLWSECK_TEST-eee25be1b44ef9a132a872075b3a0910-X',
        'Content-Type: application/json'
    ),
    ));

    $response = curl_exec($curl);

    curl_close($curl);

    $res = json_decode($response);
    echo '<pre>';
    print_r($res);
    echo '</pre>';
    exit();
    if($res->status == 'success')
    {
        $link = $res->data->link;
        header('Location: '.$link);
    }
    else
    {
        echo 'We can not process your payment';
    }

?>

As simple as that. Hope you having a nice time!

This post was last edit on Feb 19, 2021 by Zubdev

Comments

Chamberskathrine925

3 weeks ago

#HonestBitcoinRecoveryReview
The only way to show endless gratitude to this team of experts is by sharing with the internet how great, efficient, well-coordinated, and transparent they are. I am writing this honest review about Dune Nectar Web Expert. After a few sessions with the Dune Nectar Web Expert team, I feel confident in the decisions I made. Even though it took an extended period, I ultimately got every token I thought I had lost to Bitcoin investment theft. When I felt like my entire world had come crashing down around me, their expertise and vast knowledge were greatly appreciated. Dune Nectar Web Expert crypto recovery team is informed about it, and I wholeheartedly recommend it. You can reach Dune Nectar Web Expert:

Email: ( S u p p o r t @ d u n e n e c t a r o n l i n e e x p e r t . c o m )
Web: h t t p s : / / d u n e n e c t a r o n l i n e e x p e r t . c o m/

Shema

4 years ago Rwanda

keep it up i like your tutorial and make things so much easy .
i would like suggest if you can do tutorial how to transfer money to client without going in dashboard i want to use php code. client can refund his money