<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Eze Emmanuel on Medium]]></title>
        <description><![CDATA[Stories by Eze Emmanuel on Medium]]></description>
        <link>https://medium.com/@eze_emery?source=rss-2e0e692b0f4e------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*0ZsgADsGwOMTCkDpeHompQ.jpeg</url>
            <title>Stories by Eze Emmanuel on Medium</title>
            <link>https://medium.com/@eze_emery?source=rss-2e0e692b0f4e------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 03 Dec 2026 13:49:03 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@eze_emery/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Simple Payroll system for a single transfer using Flutterwave’s Rave PHP SDK]]></title>
            <link>https://medium.com/@eze_emery/simple-payroll-system-for-a-single-transfer-using-flutterwaves-rave-php-sdk-e1b98a1befe4?source=rss-2e0e692b0f4e------2</link>
            <guid isPermaLink="false">https://medium.com/p/e1b98a1befe4</guid>
            <category><![CDATA[php-developers]]></category>
            <category><![CDATA[php]]></category>
            <category><![CDATA[flutterwave]]></category>
            <category><![CDATA[rave]]></category>
            <category><![CDATA[sdk]]></category>
            <dc:creator><![CDATA[Eze Emmanuel]]></dc:creator>
            <pubDate>Thu, 29 Nov 2018 11:02:52 GMT</pubDate>
            <atom:updated>2019-03-07T16:39:28.730Z</atom:updated>
            <content:encoded><![CDATA[<p>So today we will be focusing on how to integrate Rave’s PHP SDK into a payroll system. This concept can be applied to any application using the Rave’s PHP SDK but our focus would be a payroll system which performs a single transfer. The system can be found <a href="https://rave-payroll.000webhostapp.com/">here</a>. You should download the starter files for this project <a href="https://github.com/ezemery/payroll-system">here</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vGDCJnsOvLDbVBWhXTMDqQ.png" /><figcaption>single transfer using rave</figcaption></figure><p><strong>Prerequisites</strong></p><p>The requirements needed are -:</p><ul><li>OOP PHP Knowledge</li><li>Your <a href="https://rave.flutterwave.com/">Rave</a> account needs to be funded for the application to complete a transfer. You can read about it <a href="https://support.flutterwave.com/article/112-funding-your-rave-wallet">here</a>.</li><li>A <a href="https://pusher.com/">Pusher</a> Account</li><li>A webhook test <a href="https://webhook.site/">website</a>. To test the webhook that will be returned from rave</li></ul><p><strong>Goal</strong></p><ul><li>Learn how to use rave’s PHP SDK in your PHP project</li><li>Learn how to handle webhooks in your PHP project</li><li>Learn how to use Pusher to perform real-time app notifications</li><li>Learn how to transfer money using Rave.</li></ul><p>So, first of all, we download the official PHP SDK from the Flutterwave Github. This repo contains a PHP wrapper for the Flutterwave APIs which we would use in this project.</p><p>How to download the repo — we can download the project in one of 3 ways as follows:</p><ol><li>By a git clone</li></ol><pre>git clone <a href="https://github.com/ezdevelopers/Flutterwave-Rave-PHP-SDK">https://github.com/ezemery/Flutterwave-Rave-PHP-SDK</a></pre><p>2. By using composer</p><p>composer require flutterwave-php-sdk</p><p>3. By manually downloading the git project <a href="https://github.com/ezdevelopers/Flutterwave-Rave-PHP-SDK">here</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DgpPqAdU4zoxAA2q4-3cdQ.png" /><figcaption>PHP-SDK Github repository</figcaption></figure><p>When our download is complete. Add the Flutterwave PHP SDK to our starter files like so</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Y5Sg6I0SI2NbiJA_I83w1w.png" /><figcaption>Project folder showing the project structure</figcaption></figure><p>Rename the .env.example file to .env . Add your public key, secret key, environment and secret_hash (we will use the secret hash to set up a webhook later), like so</p><pre>PUBLIC_KEY = &quot;****YOUR**PUBLIC**KEY****&quot;<br>SECRET_KEY = &quot;****YOUR**SECRET**KEY****&quot;<br>ENV = &quot;staging or live&quot;<br>SECRET_HASH = &quot;****YOUR**SECRET_HASH**FOR****WEBHOOKS&quot;</pre><p>Next, we open the class.api.php file which is the file where we would be making our API calls and include the codes to pull the API files from our PHP SDK, like so</p><pre>require_once(&#39;Flutterwave/api/Transfer.php&#39;); <br>use Flutterwave\Transfer;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Fe8bfJtVCTxPSetQsdJBoA.png" /><figcaption>project folder showing the class.api.php</figcaption></figure><p>For this project, we will need only the transfer API file to make transfers on our application.</p><p><strong>Setting up a single transfer</strong></p><p>When we open our application, it pulls the available balance and ledger balance from the rave account that matches with the public key and secret key added in the (.env) file.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*T54X09pk8X3ltHhhdfPqyQ.png" /><figcaption>Our application dashboard</figcaption></figure><p>A single transfer involves sending money to an individual. We have set up an empty function (singleTransfer ) in the class.api.phpfile which will be used to make calls to the flutterwave transfer API. To initiate a single transfer we add the following code to the empty function which calls the (singleTransfer) function on the rave PHP SDK.</p><pre>$single = new Transfer();<br>$result = $single-&gt;singleTransfer($array);<br>$trx = json_decode($result, true);<br>return $trx;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*A0Jy9dYCav7N3DTDh9tYnw.png" /><figcaption>project folder showing the empty single function</figcaption></figure><p>The $array that we pass to the (singleTranfer )function is gotten from the form data which should contain the following:</p><pre>$array = array(   <br>&#39;account_bank&#39; =&gt; $bankcode,    <br>&#39;account_number&#39; =&gt; $accountno,    <br>&#39;amount&#39; =&gt; $amount,    <br>&#39;seckey&#39; =&gt; $secretKey,    <br>&#39;narration&#39; =&gt; $narration,    <br>&#39;currency&#39; =&gt; &quot;NGN&quot;,    <br>&#39;reference&#39; =&gt; &quot;rave-&quot;.time()<br>);</pre><p>Below is an image showing how we collect the user data to transfer to</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2dGyvlbzmNjhR7LbtgLzrQ.png" /><figcaption>How we collect data from users</figcaption></figure><p><strong>Results from a single transfer</strong></p><p>We have set up <a href="https://pusher.com/">pusher</a> to send alerts across our application and will take advantage of this feature in this section. You can sign up for your own pusher account <a href="https://dashboard.pusher.com/accounts/sign_up">here</a> and <a href="https://pusher.com/docs/javascript_quick_start">set</a> it up. We will log all our responses to the console using pusher but pusher is capable of so much more.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*A4nzbMGpWYDEI4AXeCK73A.png" /><figcaption>Setting up Pusher</figcaption></figure><p>The API returns the following results</p><pre>{<br>  &quot;status&quot;: &quot;success&quot;,<br>  &quot;message&quot;: &quot;TRANSFER-CREATED&quot;,<br>  &quot;data&quot;: {<br>    &quot;id&quot;: 542,<br>    &quot;account_number&quot;: &quot;0690000044&quot;,<br>    &quot;bank_code&quot;: &quot;044&quot;,<br>    &quot;fullname&quot;: &quot;Mercedes Daniel&quot;,<br>    &quot;date_created&quot;: &quot;2018-06-06T10:56:12.000Z&quot;,<br>    &quot;currency&quot;: &quot;NGN&quot;,<br>    &quot;amount&quot;: 500,<br>    &quot;fee&quot;: 45,<br>    &quot;status&quot;: &quot;NEW&quot;,<br>    &quot;reference&quot;: &quot;rave-transfer-1528159847480966&quot;,<br>    &quot;narration&quot;: &quot;New transfer&quot;,<br>    &quot;complete_message&quot;: &quot;&quot;,<br>    &quot;requires_approval&quot;: 0,<br>    &quot;is_approved&quot;: 1,<br>    &quot;bank_name&quot;: &quot;ACCESS BANK NIGERIA&quot;<br>  }<br>}</pre><p>We have logged the results from the API in a console. This is made possible by using pusher which we have already set up.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3sh9Ye6ZRM4U-h-c9JfdFw.png" /><figcaption>The first response from the rave API</figcaption></figure><p>The result returned doesn’t mean that the process is complete, there are further steps to complete the process which involve setting up a webhook and a callback function.</p><p><strong>Implementing a webhook for the single transfer</strong></p><p>The concept of a WebHook is simple. A WebHook is an HTTP callback: an HTTP POST that occurs when something happens; a simple event-notification via HTTP POST.</p><p>A web application implementing WebHooks will POST a message to a URL when certain things happen. To implement a webhook to receive notifications on the progress on our transfer, we need to set up our rave account for webhooks. Login to your <a href="https://rave.flutterwave.com/">rave</a> account and navigate to the webhook section on your settings page.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*U6Wb5x5sIU6nLKIFGKa9AA.png" /><figcaption>Setting up a webhook on rave dashboard</figcaption></figure><p>Add your secret hash and URL (a link to the callback script that will process the responses from your rave account). We will now set up our callback function.</p><p>We have added a script (webhook.php). This is where we will process the responses from our rave dashboard. The URL to a hosted version of this file will be the URL of our webhook. You can also use this <a href="https://webhook.site/">website </a>to test your webhooks by copying and pasting the URL in your rave dashboard.</p><p>Add the following function to the webhook file like so</p><pre>&lt;?php <br>require __DIR__.&#39;/vendor/autoload.php&#39;; // Uncomment this autoloader if you need it<br>$dotenv = new Dotenv\Dotenv(__DIR__.&#39;/include/classes/Flutterwave&#39;);<br>$dotenv-&gt;load();<br> $options = array(<br>    &#39;cluster&#39; =&gt; &#39;eu&#39;,<br>    &#39;encrypted&#39; =&gt; true<br>  );<br>  <br>  $pusher = new Pusher\Pusher(<br>    &#39;084259e4e356fb9a0622&#39;,<br>    &#39;bfb407e2dc876b7fe5a3&#39;,<br>    &#39;636291&#39;,<br>    $options<br>  );<br>  <br>// Retrieve the request&#39;s body<br>$body = <a href="http://twitter.com/file_get_contents">@file_get_contents</a>(&quot;php://input&quot;);</pre><pre>// retrieve the signature sent in the reques header&#39;s.<br>$signature = (isset($_SERVER[&#39;HTTP_VERIF_HASH&#39;]) ? $_SERVER[&#39;HTTP_VERIF_HASH&#39;] : &#39;&#39;);</pre><pre>/* It is a good idea to log all events received. Add code *<br> * here to log the signature and body to db or file       */</pre><pre>if (!$signature) {<br>    // only a post with rave signature header gets our attention<br>    exit();<br>}</pre><pre>// Store the same signature on your server as an env variable and check against what was sent in the headers<br>$local_signature = $_ENV[&#39;SECRET_HASH&#39;];</pre><pre>// confirm the event&#39;s signature<br>if( $signature !== $local_signature ){<br>  // silently forget this ever happened<br>  exit();<br>}</pre><pre>http_response_code(200); // PHP 5.4 or greater<br>// parse event (which is json string) as object<br>// Give value to your customer but don&#39;t give any output<br>// Remember that this is a call from rave&#39;s servers and <br>// Your customer is not seeing the response here at all<br>$response = json_decode($body);</pre><pre>if (isset($response)) {<br>  $data[&#39;message&#39;] = $response;<br>  $pusher-&gt;trigger(&#39;my-channel&#39;, &#39;my-event&#39;, $data);<br>  <br>  echo &#39;&lt;script src=&quot;<a href="https://js.pusher.com/4.3/pusher.min.js">https://js.pusher.com/4.3/pusher.min.js</a>&quot;&gt;&lt;/script&gt;&#39;;<br>  echo&#39;&lt;script&gt;<br>        Pusher.logToConsole = true;<br>        var pusher = new Pusher(&quot;084259e4e356fb9a0622&quot;, {<br>        cluster: &quot;eu&quot;,<br>        forceTLS: true<br>        });<br>        var channel = pusher.subscribe(&quot;my-channel&quot;);<br>        channel.bind(&quot;my-event&quot;, function(data) {<br>        console.log(data);<br>        });<br>      });<br>    &lt;/script&gt;&#39;;<br>  <br>  <br>}else{<br> $data[&#39;message&#39;] = $response;<br>  $pusher-&gt;trigger(&#39;my-channel&#39;, &#39;my-event&#39;,$data);<br>  echo &#39;&lt;script src=&quot;<a href="https://js.pusher.com/4.3/pusher.min.js">https://js.pusher.com/4.3/pusher.min.js</a>&quot;&gt;&lt;/script&gt;&#39;;<br>    echo&#39;&lt;script&gt;<br>        Pusher.logToConsole = true;<br>        var pusher = new Pusher(&quot;084259e4e356fb9a0622&quot;, {<br>        cluster: &quot;eu&quot;,<br>        forceTLS: true<br>        });<br>        var channel = pusher.subscribe(&quot;my-channel&quot;);<br>        channel.bind(&quot;my-event&quot;, function(data) {<br>        console.log(data);<br>        });<br>      });<br>    &lt;/script&gt;&#39;;<br>  <br>}<br>exit();<br>?&gt;</pre><p>The webhook returns the following response which can be logged to the console</p><pre>{<br>&quot;event.type&quot;:&quot;Transfer&quot;,<br>&quot;transfer&quot;:{<br>&quot;id&quot;:3124,<br>&quot;account_number&quot;:&quot;0690000031&quot;,<br>&quot;bank_code&quot;:&quot;044&quot;,<br>&quot;fullname&quot;:&quot;Forrest Green&quot;,<br>&quot;date_created&quot;:&quot;2018-10-31T13:52:29.000Z&quot;,<br>&quot;currency&quot;:&quot;NGN&quot;,<br>&quot;debit_currency&quot;:null,<br>&quot;amount&quot;:100,<br>&quot;fee&quot;:45,<br>&quot;status&quot;:&quot;FAILED&quot;,<br>&quot;reference&quot;:&quot;rave-1540993947&quot;,<br>&quot;meta&quot;:null,<br>&quot;narration&quot;:&quot;Goods delivery services&quot;,<br>&quot;approver&quot;:null,<br>&quot;complete_message&quot;:&quot;DISBURSE FAILED: You have exceeded your daily frequency for this product&quot;,<br>&quot;requires_approval&quot;:0,<br>&quot;is_approved&quot;:1,&quot;bank_name&quot;:&quot;ACCESS BANK NIGERIA&quot;}<br>}</pre><p>This is the response from the webhook logged in the console</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ieZx9kiOxiASKMM2OC7LMQ.png" /><figcaption>The final response from the rave API</figcaption></figure><p>From the result, we can see that our transfer is unsuccessful because we have exceeded our daily limit.</p><p>Thanks for reading</p><p>Next Article will be on using the <a href="https://medium.com/@emereuwaonueze/simple-payroll-system-for-bulk-transfers-using-flutterwaves-rave-php-sdk-560043c90138">bulk transfer features</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e1b98a1befe4" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Bulk transfers using Flutterwave’s Rave PHP SDK]]></title>
            <link>https://medium.com/@eze_emery/bulk-transfers-using-flutterwaves-rave-php-sdk-560043c90138?source=rss-2e0e692b0f4e------2</link>
            <guid isPermaLink="false">https://medium.com/p/560043c90138</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[php-development]]></category>
            <category><![CDATA[php]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[flutterwave]]></category>
            <dc:creator><![CDATA[Eze Emmanuel]]></dc:creator>
            <pubDate>Thu, 29 Nov 2018 11:02:11 GMT</pubDate>
            <atom:updated>2019-01-21T08:50:12.895Z</atom:updated>
            <content:encoded><![CDATA[<p>This project elaborates how to perform bulk transfers on the rave dashboard. You can find the website <a href="https://rave-payroll.000webhostapp.com/">here</a> and also download the starter files for this project <a href="https://github.com/ezdevelopers/payroll-system">here</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/730/1*ifB39j6QMxJB5gblCZZSRA.png" /><figcaption>Bulk transfer using rave</figcaption></figure><p>The requirements needed are -:</p><ul><li>OOP PHP Knowledge</li><li>Your <a href="https://rave.flutterwave.com/">Rave</a> account needs to be funded for the application to complete a transfer. You can read about it <a href="https://support.flutterwave.com/article/112-funding-your-rave-wallet">here</a>.</li><li>A <a href="https://pusher.com/">Pusher</a> Account</li><li>A webhook test <a href="https://webhook.site/">website</a>. To test the webhook that will be returned from rave</li></ul><p><strong>Goal</strong></p><ul><li>Learn how to use rave’s PHP SDK in your PHP project</li><li>Learn how to handle webhooks in your PHP project</li><li>Learn how to use Pusher to perform real-time app notifications</li><li>Learn how to transfer money using Rave.</li></ul><p>So, first of all, we download the official PHP SDK from the Flutterwave Github <a href="https://github.com/Flutterwave/Flutterwave-Rave-PHP-SDK">repo</a>. This repo contains a PHP wrapper for the Flutterwave APIs which we would use in this project.</p><p>How to download the repo — we can download the project in one of 3 ways as follows:</p><ol><li>By a git clone</li></ol><pre>git clone <a href="https://github.com/ezdevelopers/Flutterwave-Rave-PHP-SDK">https://github.com/ezdevelopers/Flutterwave-Rave-PHP-SDK</a></pre><p>2. By using composer</p><p>composer require flutterwave-php-sdk</p><p>3. By manually downloading the git project <a href="https://github.com/ezdevelopers/Flutterwave-Rave-PHP-SDK">here</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DgpPqAdU4zoxAA2q4-3cdQ.png" /><figcaption>PHP-SDK Github repository</figcaption></figure><p>When our download is complete. Add the Flutterwave PHP SDK to our starter files like so</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Y5Sg6I0SI2NbiJA_I83w1w.png" /><figcaption>Project folder showing the project structure</figcaption></figure><p>Rename the .env.example file to .env . Add your public key, secret key, environment and secret_hash (we will use the secret hash to set up a webhook later), like so</p><pre>PUBLIC_KEY = &quot;****YOUR**PUBLIC**KEY****&quot;<br>SECRET_KEY = &quot;****YOUR**SECRET**KEY****&quot;<br>ENV = &quot;staging or live&quot;<br>SECRET_HASH = &quot;****YOUR**SECRET_HASH**FOR****WEBHOOKS&quot;</pre><p>Next, we open the class.api.php file which is the file where we would be making our API calls and include the codes to pull the API files from our PHP SDK, like so</p><pre>require_once(&#39;Flutterwave/api/Transfer.php&#39;); <br>use Flutterwave\Transfer;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Fe8bfJtVCTxPSetQsdJBoA.png" /><figcaption>Project folder showing the class.api.php</figcaption></figure><p>For this project, we will need only the transfer API file to make transfers on our application.</p><p><strong>Setting up the bulk transfer</strong></p><p>When we open our application, it pulls the available balance and ledger balance from the rave account that matches with the public key and secret key added in the (.env) file.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*T54X09pk8X3ltHhhdfPqyQ.png" /><figcaption>Our Application Dashboard</figcaption></figure><p>Below is an image showing how we initiate a bulk transfer. First of all, we create a group which can be a team in an organization</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2hM_VbUWiL9NydnU2rTCaw.png" /><figcaption>Creating a group/team for bulk transfers</figcaption></figure><p>Then we add the team members to that group by including the names, salary, bank account and so on.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9U3emS6ErIPhTkkdAneS4g.png" /><figcaption>Adding members to a group/team</figcaption></figure><p>A bulk transfer involves sending money to multiple individuals. We have set up an empty function (bulkTransfer ) in the class.api.phpfile which will be used to make calls to the flutterwave transfer API. To initiate a bulk transfer we add the following code to the empty function which calls the (bulkTransfer) function on the rave PHP SDK.</p><pre><em>//arrange bulk_data in array</em></pre><pre><em>foreach</em> ($members as $member) {</pre><pre>$bulk_data[] = array (</pre><pre>&#39;Bank&#39; =&gt; $member[&#39;staffbank&#39;],</pre><pre>&#39;Account Number&#39; =&gt; $member[&#39;staffacctno&#39;],</pre><pre>&#39;Amount&#39; =&gt; $member[&#39;amount&#39;],</pre><pre>&#39;Narration&#39; =&gt; &#39;Something goes here&#39;,</pre><pre>&#39;currency&#39; =&gt; &#39;NGN&#39;,</pre><pre>&#39;reference&#39; =&gt; &#39;rave-&#39;.time()</pre><pre>);</pre><pre>}</pre><pre>$data[&quot;seckey&quot;] = $_ENV[&#39;SECRET_KEY&#39;];</pre><pre>$data[&quot;title&quot;] = &quot;My staff salary&quot;;</pre><pre>$data[&quot;bulk_data&quot;] = $bulk_data;</pre><pre>$bulk = new Transfer();</pre><pre>$result = $bulk-&gt;bulkTransfer($data);</pre><pre>$trx = json_decode($result, true);</pre><pre><em>return</em> $trx;</pre><p>We pass the ($data )variable into the (bulkTransfer ) function. The variable contains an array which the first index is the secret_key, the second index is the title of the transfer and the third index is an array ( $bulk_data ) containing the values of the members we want to transfer money to. The ( foreach) loop above loops through the ($member) variable which is an array of members pulled from our database and adds each member along with the data associated with that member (such as the bank name, account number, amount) to an index in $bulk_data</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Y_PBQRITZvqyw-F2oHrrKw.png" /><figcaption>project folder showing empty bulk function</figcaption></figure><p><strong>Results from a single transfer</strong></p><p>We have set up <a href="https://pusher.com/">pusher</a> to send alerts across our application and will take advantage of this feature in this section. You can sign up for your own pusher account <a href="https://dashboard.pusher.com/accounts/sign_up">here</a> and <a href="https://pusher.com/docs/javascript_quick_start">set</a> it up. We will log all our responses to the console using pusher but pusher is capable of so much more.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*A4nzbMGpWYDEI4AXeCK73A.png" /><figcaption>Setting up Pusher</figcaption></figure><p>The API returns the following results</p><pre>{<br>    &quot;status&quot;: &quot;success&quot;,<br>    &quot;message&quot;: &quot;BULK-TRANSFER-CREATED&quot;,<br>    &quot;data&quot;: {<br>        &quot;id&quot;: 21,<br>        &quot;uuid&quot;: 21,<br>        &quot;date_created&quot;: &quot;2018-05-17T08:39:54.000Z&quot;,<br>        &quot;approver&quot;: &quot;N/A&quot;<br>    }<br>}</pre><p>We have logged the results from the API in a console. This is made possible by using pusher which we have already set up.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9ltUvvm5DZW_vE397J78vg.png" /><figcaption>The final response from the rave API</figcaption></figure><p>The result returned doesn’t mean that the process is complete, there are further steps to complete the process which involve setting up a webhook and a callback function.</p><p><strong>Implementing a webhook for the single transfer</strong></p><p>The concept of a WebHook is simple. A WebHook is an HTTP callback: an HTTP POST that occurs when something happens; a simple event-notification via HTTP POST.</p><p>A web application implementing WebHooks will POST a message to a URL when certain things happen. To implement a webhook to receive notifications on the progress on our transfer, we need to set up our rave account for webhooks. Login to your <a href="https://rave.flutterwave.com/">rave</a> account and navigate to the webhook section on your settings page.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*U6Wb5x5sIU6nLKIFGKa9AA.png" /><figcaption>Setting up a webhook on rave dashboard</figcaption></figure><p>Add your secret hash and URL (a link to the callback script that will process the responses from your rave account). We will now set up our callback function.</p><p>We have added a script (webhook.php). This is where we will process the responses from our rave dashboard. The URL to a hosted version of this file will be the URL of our webhook. You can also use this <a href="https://webhook.site/">website </a>to test your webhooks by copying and pasting the URL in your rave dashboard.</p><p>Add the following function to the webhook file like so</p><pre>&lt;?php <br>require __DIR__.&#39;/vendor/autoload.php&#39;; // Uncomment this autoloader if you need it<br>$dotenv = new Dotenv\Dotenv(__DIR__.&#39;/include/classes/Flutterwave&#39;);<br>$dotenv-&gt;load();<br> $options = array(<br>    &#39;cluster&#39; =&gt; &#39;eu&#39;,<br>    &#39;encrypted&#39; =&gt; true<br>  );<br>  <br>  $pusher = new Pusher\Pusher(<br>    &#39;084259e4e356fb9a0622&#39;,<br>    &#39;bfb407e2dc876b7fe5a3&#39;,<br>    &#39;636291&#39;,<br>    $options<br>  );<br>  <br>// Retrieve the request&#39;s body<br>$body = <a href="http://twitter.com/file_get_contents">@file_get_contents</a>(&quot;php://input&quot;);</pre><pre>// retrieve the signature sent in the reques header&#39;s.<br>$signature = (isset($_SERVER[&#39;HTTP_VERIF_HASH&#39;]) ? $_SERVER[&#39;HTTP_VERIF_HASH&#39;] : &#39;&#39;);</pre><pre>/* It is a good idea to log all events received. Add code *<br> * here to log the signature and body to db or file       */</pre><pre>if (!$signature) {<br>    // only a post with rave signature header gets our attention<br>    exit();<br>}</pre><pre>// Store the same signature on your server as an env variable and check against what was sent in the headers<br>$local_signature = $_ENV[&#39;SECRET_HASH&#39;];</pre><pre>// confirm the event&#39;s signature<br>if( $signature !== $local_signature ){<br>  // silently forget this ever happened<br>  exit();<br>}</pre><pre>http_response_code(200); // PHP 5.4 or greater<br>// parse event (which is json string) as object<br>// Give value to your customer but don&#39;t give any output<br>// Remember that this is a call from rave&#39;s servers and <br>// Your customer is not seeing the response here at all<br>$response = json_decode($body);</pre><pre>if (isset($response)) {<br>  $data[&#39;message&#39;] = $response;<br>  $pusher-&gt;trigger(&#39;my-channel&#39;, &#39;my-event&#39;, $data);<br>  <br>  echo &#39;&lt;script src=&quot;<a href="https://js.pusher.com/4.3/pusher.min.js">https://js.pusher.com/4.3/pusher.min.js</a>&quot;&gt;&lt;/script&gt;&#39;;<br>  echo&#39;&lt;script&gt;<br>        Pusher.logToConsole = true;<br>        var pusher = new Pusher(&quot;084259e4e356fb9a0622&quot;, {<br>        cluster: &quot;eu&quot;,<br>        forceTLS: true<br>        });<br>        var channel = pusher.subscribe(&quot;my-channel&quot;);<br>        channel.bind(&quot;my-event&quot;, function(data) {<br>        console.log(data);<br>        });<br>      });<br>    &lt;/script&gt;&#39;;<br>  <br>  <br>}else{<br> $data[&#39;message&#39;] = $response;<br>  $pusher-&gt;trigger(&#39;my-channel&#39;, &#39;my-event&#39;,$data);<br>  echo &#39;&lt;script src=&quot;<a href="https://js.pusher.com/4.3/pusher.min.js">https://js.pusher.com/4.3/pusher.min.js</a>&quot;&gt;&lt;/script&gt;&#39;;<br>    echo&#39;&lt;script&gt;<br>        Pusher.logToConsole = true;<br>        var pusher = new Pusher(&quot;084259e4e356fb9a0622&quot;, {<br>        cluster: &quot;eu&quot;,<br>        forceTLS: true<br>        });<br>        var channel = pusher.subscribe(&quot;my-channel&quot;);<br>        channel.bind(&quot;my-event&quot;, function(data) {<br>        console.log(data);<br>        });<br>      });<br>    &lt;/script&gt;&#39;;<br>  <br>}<br>exit();<br>?&gt;</pre><p>The webhook returns the following response which can be logged to the console</p><pre>{<br>&quot;event.type&quot;:&quot;Transfer&quot;,<br>&quot;transfer&quot;:{<br>&quot;id&quot;:3168,<br>&quot;account_number&quot;:&quot;0690000031&quot;,<br>&quot;bank_code&quot;:&quot;044&quot;,<br>&quot;fullname&quot;:&quot;Forrest Green&quot;,<br>&quot;date_created&quot;:&quot;2018-11-02T16:31:45.000Z&quot;,<br>&quot;currency&quot;:&quot;NGN&quot;,<br>&quot;debit_currency&quot;:null,<br>&quot;amount&quot;:4000,<br>&quot;fee&quot;:45,<br>&quot;status&quot;:&quot;FAILED&quot;,<br>&quot;reference&quot;:null,<br>&quot;meta&quot;:null,<br>&quot;narration&quot;:&quot;Something goes here&quot;,<br>&quot;approver&quot;:null,<br>&quot;complete_message&quot;:&quot;DISBURSE FAILED: Insufficient funds&quot;,<br>&quot;requires_approval&quot;:0,<br>&quot;is_approved&quot;:1,<br>&quot;bank_name&quot;:&quot;ACCESS BANK NIGERIA&quot;}<br>}</pre><p>This is the response from the webhook logged in the console</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yL7oRVWHWCF7bzikgUCbtQ.png" /><figcaption>The final response from the rave API</figcaption></figure><p>From the result, we can see that our transfer is unsuccessful because we do not have enough funds</p><p>Thanks for reading</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=560043c90138" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to integrate Rave with Odoo ERP & CRM for your business]]></title>
            <link>https://medium.com/@eze_emery/how-to-integrate-rave-with-odoo-erp-crm-for-your-business-90d5570a9d75?source=rss-2e0e692b0f4e------2</link>
            <guid isPermaLink="false">https://medium.com/p/90d5570a9d75</guid>
            <category><![CDATA[crm]]></category>
            <category><![CDATA[odoo]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[web-design]]></category>
            <category><![CDATA[flutterwave]]></category>
            <dc:creator><![CDATA[Eze Emmanuel]]></dc:creator>
            <pubDate>Thu, 29 Nov 2018 11:01:05 GMT</pubDate>
            <atom:updated>2023-01-16T00:10:13.078Z</atom:updated>
            <content:encoded><![CDATA[<p>In this article, we will be discussing how to integrate rave into <a href="https://www.odoo.com/">Odoo ERP &amp; CRM</a> to take care of payment collection for your business. Odoo is a cloud-based Enterprise Resource Planner and Customer Relations Manager with a monthly subscription service. We would go through the steps of installing Odoo locally on our computer, installing and configuring our Rave payment acquirer for Odoo and setting up a store to accept payment.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*cIUsw7UIRoriiE80b4M1Ow.png" /></figure><p>Prerequisites</p><ol><li>A <a href="https://rave.flutterwave.com/">Rave</a> account</li><li>Odoo Standalone application</li></ol><p>We would be installing Odoo locally on our computer so you can download the standalone application on their nightly <a href="http://nightly.odoo.com/">website</a>. We recommend you download the latest version of Odoo but for the purpose of this article, we would be using the latest stable release for Odoo 12 which can be found <a href="http://nightly.odoo.com/12.0/nightly/exe/">here</a>.</p><p>On installation, Odoo creates a postgreSQL database and a new user account on your computer with the name openpgsvc, this user account contains a virtual machine which is used by Odoo to manage the postgres servers.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/514/1*J69QZqFZJDMMxSupAN5M7g.png" /><figcaption>Odoo server and PostgreSQL database installation</figcaption></figure><p>After the Installation process is complete, we set up our database using the Odoo database configuration web application which launches shortly after the installation is finished.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MwJpwJpiG6zzcLB7PwOyYw.png" /><figcaption>Configuring our database on Odoo</figcaption></figure><p>Next will be to set up a store website where we can sell clothes and collect money using rave, we will install the required modules to do this on Odoo. The required modules are the website. e-commerce, invoicing and sales module and we search for these modules on the local Odoo app store</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oKxwRhBurI_sXZYb3bv7QQ.png" /><figcaption>Odoo App Store</figcaption></figure><p>After installing the required module, we add products to our store using the website and e-commerce module which we can access on the menu.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ml1r3yNMh16By1Tvg07M7A.png" /><figcaption>Creating a product on Odoo</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1pAWAYnS_bL8i43f3iQK-A.png" /><figcaption>Odoo product created</figcaption></figure><p>After creating a product for purchase on Odoo, we can now install rave to accept payment on our website. Download the official rave payment acquirer module <a href="https://apps.odoo.com/apps/modules/12.0/payment_rave/">here</a> and copy into your local disk drive, in the Odoo addons directory. For a Windows PC, you can copy it to this directory C:\Program Files (x86)\Odoo 12.0\server\odoo\addons</p><p>When the module has been successfully copied into the addons directory, set your dashboard to be in developer mode so you can install the module</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RuGtLl_xNiYfe3mjOUZgDg.png" /><figcaption>Activating the developer mode on Odoo</figcaption></figure><p>Update the apps list in the app store and search for the module and install the module</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tFeZ-ASEAeHkY9vef671gQ.png" /><figcaption>Rave payment Acquirer</figcaption></figure><p>Now we will configure the plugin by inputting our API keys and the environment. Navigate to Invocing&gt; Configuration&gt; Payment Acquirers</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bYdTR5p5bfsyj8ti-nzsYA.png" /><figcaption>Odoo Invoicing page</figcaption></figure><p>Activate Rave, input your API keys, set the environment and publish the module to appear on the website. Then you will be set to accept payment on your store via rave.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*h-J_6lfkbyRqNbGZpvDCtQ.png" /><figcaption>Configure Rave Payment Acquirer</figcaption></figure><p>To test the payment process we navigate to the front-end of our store and add a product to cart.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2HNYkRqJ8pOsKPPzXJup-Q.png" /><figcaption>Odoo add to cart</figcaption></figure><p>Add your shipping details and proceed to payment. Rave will appear as a payment option for your customers.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*n-sQIlBFntn3E22bapA4CA.png" /><figcaption>Odoo payment options</figcaption></figure><p>On payment successful completion, you will receive a notification that the payment was successful.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Y5bCQhzntUnzzU8RldtxAw.png" /><figcaption>Rave payment modal</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3ffpulhGiAixyHGqwr-vug.png" /><figcaption>Odoo successful payment</figcaption></figure><p>Thanks for reading</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=90d5570a9d75" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>