<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Takunda Madechangu</title>
    <description>The latest articles on DEV Community by Takunda Madechangu (@takunda).</description>
    <link>https://dev.to/takunda</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F173133%2Fb5ef074a-2e96-4e0a-9093-9a570b29f752.jpeg</url>
      <title>DEV Community: Takunda Madechangu</title>
      <link>https://dev.to/takunda</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/takunda"/>
    <language>en</language>
    <item>
      <title>Paynow Integration Part 5 - Checking for payments Introduction</title>
      <dc:creator>Takunda Madechangu</dc:creator>
      <pubDate>Sun, 24 Sep 2023 05:58:33 +0000</pubDate>
      <link>https://dev.to/takunda/paynow-integration-part-5-checking-for-payments-introduction-4f03</link>
      <guid>https://dev.to/takunda/paynow-integration-part-5-checking-for-payments-introduction-4f03</guid>
      <description>&lt;p&gt;Once you have requested for a transaction to take place the next steps includes&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Checking transaction status&lt;/li&gt;
&lt;li&gt;Giving a service or a product to the client&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9oek9qxavyzu43xf0zih.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9oek9qxavyzu43xf0zih.png" alt="Paynow checking all methods" width="800" height="827"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;For checking transaction you can either use&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Polling&lt;/li&gt;
&lt;li&gt;Webhooks&lt;/li&gt;
&lt;li&gt;Hybrid&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Method 1: Polling
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fk81izupa3p00ofpnfldu.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fk81izupa3p00ofpnfldu.png" alt="Paynow payment checking using polling" width="800" height="356"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In the polling method we are checking the status of the transaction at regular intervals.&lt;/p&gt;

&lt;p&gt;For example we could check the transaction status every 10 or 15 seconds. If the transaction was successful or unsuccessful we take the appropriate action.&lt;/p&gt;

&lt;h3&gt;
  
  
  Advantages
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;It provides precise control over when data is retrieved or actions are taken.&lt;/li&gt;
&lt;li&gt;Easier to implement compared to event-driven approaches.&lt;/li&gt;
&lt;li&gt;Helps ensure predictable system behavior as data is collected at fixed intervals.&lt;/li&gt;
&lt;li&gt;Suitable for devices and systems that do not support interrupts or events for example phones, gadgets that cant serve webhook endpoints on the internet.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Disadvantages
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Consumes system resources and can lead to inefficiency, especially with frequent polling.&lt;/li&gt;
&lt;li&gt;May introduce latency or delays in response time, as data is collected only at specified intervals.&lt;/li&gt;
&lt;li&gt;In cases where data rarely changes, continuous polling can waste resources. Imagine spamming Paynow every second with "Whats the status of my transaction?" .....thats annoying&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Method 2: Webhooks
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmgfzgo25xs0cwduoxqsk.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmgfzgo25xs0cwduoxqsk.png" alt="Paynow payment checking using webhooks" width="686" height="312"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In the webhooks method, Paynow gives us real-time updates or notifications.&lt;/p&gt;

&lt;p&gt;These updates or notification contains the status of our transaction.&lt;/p&gt;

&lt;p&gt;Its like ordering junk food at your favorate restaurant, you are given an order number and told to wait for order. 5 minutes later you are told......"Order #202 is ready!"&lt;/p&gt;

&lt;h3&gt;
  
  
  Advantages
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Provides instant updates when events occur, reducing latency.&lt;/li&gt;
&lt;li&gt;Only triggers when events happen, minimizing unnecessary requests or data transfer. No more spamming "Whats the status of my transaction?"&lt;/li&gt;
&lt;li&gt;Well-suited for handling a large volume of events or notifications.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Disadvantages
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Implementation can be more complex than polling, requiring webhook endpoints and event handling logic.&lt;/li&gt;
&lt;li&gt;Requires careful handling to prevent potential security risks, such as unauthorized access or abuse. Imagine a malicious user updating their transaction request to get free stuff&lt;/li&gt;
&lt;li&gt;Dependent on the stability and availability of the webhook provider's infrastructure.&lt;/li&gt;
&lt;li&gt;Handling and troubleshooting failed webhook deliveries can be challenging.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Method 3: Hybrid
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6e4xz2prkvujm6tzpc09.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6e4xz2prkvujm6tzpc09.png" alt="Paynow payment using hybrid method" width="800" height="366"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In the hybrid approach we use both polling and webhooks inorder to achieve the best of both world. Of course the has its short-comings.&lt;/p&gt;

&lt;p&gt;For example after submitting a transaction we can quickly check for its status using polling. If it succeeds quickly we move on. If it takes time to complete we leave it to the webhook to handle that&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="cm"&gt;/**
 *
 * order.js
 *
 * **/&lt;/span&gt;

&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;update_transaction&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;trans_id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="c1"&gt;// Update transaction&lt;/span&gt;
  &lt;span class="c1"&gt;// Send a message to the frontend using websockets&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;checkout&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;user_id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;order&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="c1"&gt;// create a payment order and send to paynow&lt;/span&gt;
  &lt;span class="c1"&gt;// Check the status using polling&lt;/span&gt;
  &lt;span class="c1"&gt;// If anything changes call update_transaction&lt;/span&gt;
  &lt;span class="c1"&gt;// After a minute or two exit the function&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="cm"&gt;/**
 *
 * orders.routes.js
 *
 * **/&lt;/span&gt;

&lt;span class="nx"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;post&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;/payment-updates&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;req&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="c1"&gt;// Confirm if its paynow&lt;/span&gt;
  &lt;span class="c1"&gt;// Retrieve transaction id&lt;/span&gt;
  &lt;span class="c1"&gt;// Call update_transaction&lt;/span&gt;
&lt;span class="p"&gt;})&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Another way could be to using polling to add an extra layer of confirmation after recieving a successful transaction update from a webhook.&lt;/p&gt;

&lt;p&gt;I am making this up. Use whatever works with you.&lt;/p&gt;

&lt;p&gt;Thats it guys, in the next tutorials&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--lR0XP0ma--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://media.makeameme.org/created/and-thats-the-83902ebdaf.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--lR0XP0ma--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://media.makeameme.org/created/and-thats-the-83902ebdaf.jpg" alt="A joke" width="600" height="543"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>payments</category>
      <category>paynow</category>
    </item>
    <item>
      <title>How to debug Flutter apps over Wi-Fi(without root)</title>
      <dc:creator>Takunda Madechangu</dc:creator>
      <pubDate>Sun, 17 Oct 2021 11:17:04 +0000</pubDate>
      <link>https://dev.to/takunda/how-to-debug-flutter-apps-over-wi-fiwithout-root-3601</link>
      <guid>https://dev.to/takunda/how-to-debug-flutter-apps-over-wi-fiwithout-root-3601</guid>
      <description>&lt;p&gt;Let's just say you want to debug your Flutter app on android device, you use a USB cable right?&lt;/p&gt;

&lt;p&gt;Yes but using a USB cable has its downsides&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;If your charging port is loose for some reason, then a slight move will disconnect your app ☹️&lt;/li&gt;
&lt;li&gt;On MacOS is displays a certain annoying "Please install SmartSwitch or some app" message&lt;/li&gt;
&lt;li&gt;Lack of flexibility&lt;/li&gt;
&lt;li&gt;Among other annoyances&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So lets try debugging over wifi&lt;/p&gt;

&lt;h3&gt;
  
  
  Debugging over wifi
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fynyuhxpgnl1xs4qjn2yk.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fynyuhxpgnl1xs4qjn2yk.png" alt="Debugging over wifi" width="800" height="443"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Requirements
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;Your phone 📱&lt;/li&gt;
&lt;li&gt;Your machine 👨🏽‍💻&lt;/li&gt;
&lt;li&gt;A USB cable. 〜&lt;/li&gt;
&lt;li&gt;Your machine and phone should be connected to the same wifi.&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  Steps
&lt;/h4&gt;

&lt;p&gt;&lt;strong&gt;Step 1&lt;/strong&gt;&lt;br&gt;
Connect your device to your machine using USB&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 2&lt;/strong&gt;&lt;br&gt;
Open terminal and type the following&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;adb kill-server
&lt;span class="nv"&gt;$ &lt;/span&gt;adb tcpip 5555
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This will kill current adb server and create another server which listens on all interfaces.&lt;/p&gt;

&lt;p&gt;If it says something like this&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;* daemon not running; starting now at tcp:5037
* daemon started successfully
restarting in TCP mode port: 5555
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Remove phone from mobile device and go to the next step&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 3&lt;/strong&gt;&lt;br&gt;
Get you device's wifi IP address. To do this:&lt;/p&gt;

&lt;p&gt;Go to&lt;br&gt;
Settings &amp;gt; Connections &amp;gt; Click Wifi Name &amp;gt; View properties(Which has the IP)&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Or&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Settings &amp;gt; About Phone &amp;gt; Status &amp;gt; IP Address(Which has IP)&lt;/p&gt;

&lt;p&gt;Your ip should be something like &lt;code&gt;192.168.100.X&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 4&lt;/strong&gt;&lt;br&gt;
Inside your terminal type&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;adb connect YOUR_IP:5555
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And if it says something like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;connected to 192.168.100.X:5555
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You are good to go&lt;/p&gt;

&lt;h3&gt;
  
  
  Safety Concerns
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjxd3j4ksnpbf72c1pymy.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjxd3j4ksnpbf72c1pymy.png" alt="Wifi hacks" width="800" height="375"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;While this method offers convenience and flexibility, it might not be safe to do it on a public wifi or a wifi that you don't trust. After all someone might be listening in for open ports just to do something crazy, So be careful...&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fukqlaznz0gmujtr5j1yz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fukqlaznz0gmujtr5j1yz.png" alt="Outro Meme" width="800" height="786"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>flutter</category>
      <category>mobile</category>
      <category>tutorial</category>
      <category>android</category>
    </item>
    <item>
      <title>How to be great at anything by Mark Manson</title>
      <dc:creator>Takunda Madechangu</dc:creator>
      <pubDate>Sat, 10 Jul 2021 19:58:42 +0000</pubDate>
      <link>https://dev.to/takunda/how-to-be-great-at-anything-by-mark-manson-4e2j</link>
      <guid>https://dev.to/takunda/how-to-be-great-at-anything-by-mark-manson-4e2j</guid>
      <description>&lt;p&gt;This is pretty much the only way to becoming a screaming success.&lt;br&gt;
Everyone wants to be good at something, but few people realize that becoming really good at something, or mastering any skill, is no walk in the park.&lt;/p&gt;

&lt;p&gt;They’re simple, but they’re not easy. Here’s a summary:&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 1: The 20/80 Principle
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhxbsvioas5dp91k32nu6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhxbsvioas5dp91k32nu6.png" alt="Alt Text" width="800" height="470"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The 80/20 Principle states that 80% of the output or results will come from 20% of the input or action. For example, in time management, businesses often found that 20% of their time created 80% of their productivity, and that 20% of their employees created 80% of the value.&lt;/p&gt;

&lt;p&gt;So the key here is founding where the 80/20 is that is what is the 20% thats going to create 80% of the results.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 2: Get Feedback
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fo3wpjr9sny63av6up0mc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fo3wpjr9sny63av6up0mc.png" alt="image" width="800" height="800"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Nailing anything in life requires a lot of trial and error and getting feedback from people. Coaches. Tutors. Teachers. The guy across the fence. You won’t know if you’re any good at something unless someone besides yourself tells you.&lt;/p&gt;

&lt;p&gt;You need feedback so you can improve or make adjustments.&lt;br&gt;
You should recieve feedback and you should listen!, Beware of the ego! Listen to criticism&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 3: Practice
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9s07sg2bshjfzjiltxmx.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9s07sg2bshjfzjiltxmx.jpg" alt="AKG8223570" width="231" height="344"&gt;&lt;/a&gt;&lt;br&gt;
When you look at the people who have mastered anything throughout history, the most glaringly obvious commonality is that they simply worked their asses off more than most people, and for longer than most people. Practice literally makes perfect.&lt;/p&gt;

&lt;p&gt;Remember there are no shortcuts. PUT IN THE WORK, REITERATE/IMPROVE, FAIL AND MOVE....&lt;/p&gt;

&lt;p&gt;Dont be fooled by overnight success stories.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>motivation</category>
    </item>
    <item>
      <title>Is your Paynow integration failing? Here is what to do...</title>
      <dc:creator>Takunda Madechangu</dc:creator>
      <pubDate>Tue, 06 Jul 2021 17:22:57 +0000</pubDate>
      <link>https://dev.to/takunda/is-your-paynow-integration-failing-here-is-what-to-do-365d</link>
      <guid>https://dev.to/takunda/is-your-paynow-integration-failing-here-is-what-to-do-365d</guid>
      <description>&lt;p&gt;You have just made your first Paynow integration but you are not receiving that Paynow Popup. &lt;/p&gt;

&lt;p&gt;You start debugging using &lt;code&gt;print_r, echo, dd&lt;/code&gt; and &lt;code&gt;print&lt;/code&gt; statements only to discover this message:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;The integration ID specified is currently in test mode. The authemail used must belong to the company in control of the integration ID.&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  So how do we fix this
&lt;/h2&gt;

&lt;p&gt;You have to do the following steps&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Make a test transaction.&lt;/li&gt;
&lt;li&gt;Request to be set live.&lt;/li&gt;
&lt;li&gt;Wait for Paynow response.&lt;/li&gt;
&lt;li&gt;Start accepting live payments.&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  1. Make a test transaction.
&lt;/h3&gt;

&lt;p&gt;Paynow has test numbers which you can use to make fake transactions:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;Success – 0771111111&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Paynow will send a SUCCESS status update message 5 seconds after the transaction is initiated.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;Delayed Success – 0772222222&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Paynow will send a SUCCESS status update message 30 seconds after the transaction is initiated. This simulates the user taking a longer than normal amount of time to authorize the transaction from their handset&lt;/p&gt;

&lt;p&gt;&lt;code&gt;User Cancelled – 0773333333&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Paynow will send a FAILED status update message 30 seconds after the transaction is initiated. This simulates the user cancelling the mobile money transaction.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;Insufficient Balance – 0774444444&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Paynow will immediately fail the transaction during initiation and return an “Insufficient balance” error message.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;For number&lt;/strong&gt; use one of the number mentioned above e.g &lt;code&gt;0771111111&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;For authemail&lt;/strong&gt; use the email that you used to register for Paynow e.g &lt;code&gt;joshua@example.com&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Now make a test transaction&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;For PHP users:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="nv"&gt;$payment&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nv"&gt;$paynow&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;createPayment&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'Order #123'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'joshua@example.com'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="mf"&gt;...&lt;/span&gt;
&lt;span class="mf"&gt;...&lt;/span&gt;
&lt;span class="mf"&gt;...&lt;/span&gt;

&lt;span class="nv"&gt;$response&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nv"&gt;$paynow&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;sendMobile&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$payment&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"0771111111"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"ecocash"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For Python generals:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;payment&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;paynow&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;create_payment&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;Order #123&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;joshua@example.com&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="bp"&gt;...&lt;/span&gt;
&lt;span class="bp"&gt;...&lt;/span&gt;
&lt;span class="bp"&gt;...&lt;/span&gt;
&lt;span class="n"&gt;response&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;paynow&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;send_mobile&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;payment&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;0771111111&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;ecocash&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You will get this message in your email:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Paynow Reference: XXXXXXXX
Status: Paid (TESTING: Faked Success)
Customer Email: joshua@example.com
Customer Name: Test Customer
Customer Phone: 263772222222
Amount: $200.00
Reference: Order #123
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Once you have done  this then you can request it to be set live&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Request to be set live
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Log in to Paynow (paynow.co.zw)&lt;/li&gt;
&lt;li&gt;Go to &lt;code&gt;Recieve Payments&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Click &lt;code&gt;Other Ways To Get Paid&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Scroll down an click &lt;code&gt;Create/Manage Shopping Carts&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Scroll down again and click &lt;code&gt;Advanced Integration&lt;/code&gt;(If you don't have an integration) or click a &lt;code&gt;Pencil&lt;/code&gt; icon on your right.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fa5xkeiezfvokxrp6ou5l.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fa5xkeiezfvokxrp6ou5l.png" alt="Select your integration" width="800" height="244"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Now scroll down and click &lt;code&gt;Request to be Set Live&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fu3jmhsqhzchhnvueqzlo.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fu3jmhsqhzchhnvueqzlo.png" alt="Request to be Set Live" width="800" height="311"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  3. Wait for Paynow response.
&lt;/h3&gt;

&lt;p&gt;Now you wait&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0y2w4t3b06xkz2q8z7nv.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0y2w4t3b06xkz2q8z7nv.jpg" alt="You waiting for response" width="500" height="291"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The time it takes to get your response is not personal 😂😂😂 and it should not take more than 3 days.&lt;/p&gt;

&lt;p&gt;If it comes you will get &lt;em&gt;"You integration has been set to live"&lt;/em&gt; message or something within these lines or some error message,. Basically error message come because you have skipped something.&lt;/p&gt;

&lt;h3&gt;
  
  
  4. Start accepting live payments.
&lt;/h3&gt;

&lt;p&gt;Once live I love to test it again with small amounts just to make sure, You can test it on different platforms so you can get the feel of it.&lt;/p&gt;

&lt;p&gt;Ok until we meet next time...&lt;/p&gt;

&lt;p&gt;Image Credits:&lt;br&gt;
SecurionPay&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>payments</category>
      <category>php</category>
      <category>python</category>
    </item>
    <item>
      <title>Preventing Burnouts, The Condensed Version</title>
      <dc:creator>Takunda Madechangu</dc:creator>
      <pubDate>Mon, 28 Jun 2021 09:54:48 +0000</pubDate>
      <link>https://dev.to/takunda/preventing-burnouts-the-condensed-version-4b8a</link>
      <guid>https://dev.to/takunda/preventing-burnouts-the-condensed-version-4b8a</guid>
      <description>&lt;p&gt;&lt;strong&gt;Ladies and Gentlemen this is how you defeat burnouts&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Don't overspend your energy(mental, emotional, physical). Energy coming in should be more than energy going out.&lt;/li&gt;
&lt;li&gt;Accept your limits.&lt;/li&gt;
&lt;li&gt;Manage your tasks and time faithfully.&lt;/li&gt;
&lt;li&gt;Find balance, don't overdo things.&lt;/li&gt;
&lt;/ol&gt;

</description>
      <category>productivity</category>
      <category>programming</category>
      <category>burnout</category>
      <category>advice</category>
    </item>
    <item>
      <title>Paynow Integration Part 5: Checking for payments</title>
      <dc:creator>Takunda Madechangu</dc:creator>
      <pubDate>Mon, 22 Feb 2021 16:27:58 +0000</pubDate>
      <link>https://dev.to/takunda/paynow-integration-part-5-checking-for-payments-25a</link>
      <guid>https://dev.to/takunda/paynow-integration-part-5-checking-for-payments-25a</guid>
      <description>&lt;p&gt;Once you have requested for a transaction to take place the next steps includes&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Checking transaction status&lt;/li&gt;
&lt;li&gt;Taking the correct action(giving or denying access)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In this tutorial we check if Paynow transaction has succeeded they can the correct action.&lt;/p&gt;

&lt;h2&gt;
  
  
  Checking if transaction is taking place
&lt;/h2&gt;

&lt;p&gt;In the last part we send a transaction to Paynow and Paynow did send a dialog to our customer.&lt;/p&gt;

&lt;p&gt;So to check if that succeeded we use this code:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="k"&gt;if&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$response&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;success&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="c1"&gt;// Check if payment is successful&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If its &lt;code&gt;true&lt;/code&gt; then it mean the transaction is taking place!&lt;/p&gt;

&lt;h2&gt;
  
  
  Checking if transaction is successful
&lt;/h2&gt;

&lt;p&gt;Now lets check if the user paid&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="k"&gt;if&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$response&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;success&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nv"&gt;$pollUrl&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nv"&gt;$response&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;pollUrl&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;

    &lt;span class="c1"&gt;// Check the status of the transaction&lt;/span&gt;
    &lt;span class="nv"&gt;$status&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nv"&gt;$paynow&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;pollTransaction&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$pollUrl&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

    &lt;span class="k"&gt;if&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$status&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;paid&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="c1"&gt;// Yay! Transaction was paid for&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="c1"&gt;// No! It wasn't paid for&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;So the first thing is getting a poll URL&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="nv"&gt;$pollUrl&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nv"&gt;$response&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;pollUrl&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then use that URL to get the status of the payment&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="nv"&gt;$status&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nv"&gt;$paynow&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;pollTransaction&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$pollUrl&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then you check the status&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="k"&gt;if&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$status&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;paid&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="c1"&gt;// Some success code here&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="k"&gt;else&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="c1"&gt;// Some fail code here&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;This is theoretically correct but practically wrong because a real world mobile transaction can take from 8 seconds to 30 seconds.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The user has to put pin, verify if its correct then press accept, by then the code above who have announced it as a failed transaction.&lt;/p&gt;

&lt;p&gt;So we must give some kind of grace period to the transaction checking process. To do that we use a loop plus sleep function.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="nv"&gt;$timeout&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;9&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nv"&gt;$count&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;while&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;){&lt;/span&gt;
   &lt;span class="nb"&gt;sleep&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

   &lt;span class="c1"&gt;//Check if paid&lt;/span&gt;
   &lt;span class="k"&gt;if&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$status&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;paid&lt;/span&gt;&lt;span class="p"&gt;()){&lt;/span&gt;
         &lt;span class="c1"&gt;// Yay! Transaction was paid for&lt;/span&gt;
   &lt;span class="p"&gt;}&lt;/span&gt;

   &lt;span class="nv"&gt;$count&lt;/span&gt;&lt;span class="o"&gt;++&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

   &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$count&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="nv"&gt;$timeout&lt;/span&gt;&lt;span class="p"&gt;){&lt;/span&gt;
       &lt;span class="c1"&gt;// Timeout reached&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Complete Code
&lt;/h2&gt;

&lt;p&gt;So the whole code from part 1 to this part will look like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="cp"&gt;&amp;lt;?php&lt;/span&gt;


&lt;span class="nv"&gt;$phone&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nv"&gt;$_POST&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"phone_number"&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt; &lt;span class="c1"&gt;// Sanitize data&lt;/span&gt;
&lt;span class="nv"&gt;$platform&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;""&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="nv"&gt;$user_email&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;filter_var&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$_POST&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;'user_email'&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt; &lt;span class="no"&gt;FILTER_SANITIZE_EMAIL&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="nv"&gt;$invoice_name&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"Invoice "&lt;/span&gt; &lt;span class="mf"&gt;.&lt;/span&gt; &lt;span class="nb"&gt;time&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;

&lt;span class="nv"&gt;$cart_id&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nv"&gt;$_POST&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;'cart_id'&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt;   &lt;span class="c1"&gt;// Sanitize id&lt;/span&gt;
&lt;span class="nv"&gt;$products&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nv"&gt;$this&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;get_cart_products&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$cart_id&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;


&lt;span class="c1"&gt;// Initialize Paynow&lt;/span&gt;
&lt;span class="nv"&gt;$paynow&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Paynow\Payments\Paynow&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="s1"&gt;'INTEGRATION_ID'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="s1"&gt;'INTEGRATION_KEY'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="s1"&gt;'http://example.com/gateways/paynow/update'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="s1"&gt;'http://example.com/return?gateway=paynow'&lt;/span&gt;
&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="c1"&gt;// Create Payments&lt;/span&gt;
&lt;span class="nv"&gt;$invoice_name&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"Invoice "&lt;/span&gt; &lt;span class="mf"&gt;.&lt;/span&gt; &lt;span class="nb"&gt;time&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="nv"&gt;$payment&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nv"&gt;$paynow&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;createPayment&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$invoice_name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;$user_email&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="c1"&gt;// Add some products&lt;/span&gt;
&lt;span class="k"&gt;foreach&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$products&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="nv"&gt;$product&lt;/span&gt;&lt;span class="p"&gt;){&lt;/span&gt;
     &lt;span class="nv"&gt;$payment&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;add&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$product&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;$product&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;price&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c1"&gt;// Detect platform and send payment&lt;/span&gt;
&lt;span class="k"&gt;if&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;str_starts_with&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$phone&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'071'&lt;/span&gt;&lt;span class="p"&gt;)){&lt;/span&gt;
     &lt;span class="nv"&gt;$platform&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"onemoney"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="k"&gt;if&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;str_starts_with&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$phone&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'073'&lt;/span&gt;&lt;span class="p"&gt;)){&lt;/span&gt;
    &lt;span class="nv"&gt;$platform&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"telecash"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="k"&gt;else&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nv"&gt;$platform&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"ecocash"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nv"&gt;$response&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nv"&gt;$paynow&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;sendMobile&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$payment&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;$phone&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;$platform&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="c1"&gt;// Check transaction success&lt;/span&gt;
&lt;span class="k"&gt;if&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$response&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;success&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="c1"&gt;// Get transaction poll URL&lt;/span&gt;
    &lt;span class="nv"&gt;$pollUrl&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nv"&gt;$response&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;pollUrl&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;



     &lt;span class="nv"&gt;$timeout&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;9&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
     &lt;span class="nv"&gt;$count&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

     &lt;span class="k"&gt;while&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;){&lt;/span&gt;
         &lt;span class="nb"&gt;sleep&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
         &lt;span class="c1"&gt;// Get the status of the transaction&lt;/span&gt;
         &lt;span class="nv"&gt;$status&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nv"&gt;$paynow&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;pollTransaction&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$pollUrl&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;



         &lt;span class="c1"&gt;//Check if paid&lt;/span&gt;
         &lt;span class="k"&gt;if&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$status&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;paid&lt;/span&gt;&lt;span class="p"&gt;()){&lt;/span&gt;
           &lt;span class="c1"&gt;// Yay! Transaction was paid for&lt;/span&gt;
           &lt;span class="c1"&gt;// Save transactions to database and grant access&lt;/span&gt;
          &lt;span class="p"&gt;}&lt;/span&gt;

          &lt;span class="nv"&gt;$count&lt;/span&gt;&lt;span class="o"&gt;++&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

          &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$count&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="nv"&gt;$timeout&lt;/span&gt;&lt;span class="p"&gt;){&lt;/span&gt;
             &lt;span class="c1"&gt;// Timeout reached&lt;/span&gt;
           &lt;span class="p"&gt;}&lt;/span&gt;
      &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c1"&gt;// Transaction failed&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;So that's it guys, go ahead and get paid, enjoy the rest of the week.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Foe6jv0oiagy35e3vqti9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Foe6jv0oiagy35e3vqti9.png" alt="image" width="250" height="195"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>php</category>
      <category>webdev</category>
      <category>payments</category>
      <category>paynow</category>
    </item>
    <item>
      <title>PayNow Integration Part 4: Mobile Payments</title>
      <dc:creator>Takunda Madechangu</dc:creator>
      <pubDate>Thu, 18 Feb 2021 06:20:01 +0000</pubDate>
      <link>https://dev.to/takunda/paynow-integration-part-4-mobile-payments-4cia</link>
      <guid>https://dev.to/takunda/paynow-integration-part-4-mobile-payments-4cia</guid>
      <description>&lt;p&gt;So we finished the boring parts and today we are going to do the following&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt; Initialize Paynow
&lt;/li&gt;
&lt;li&gt; Adding Payment
&lt;/li&gt;
&lt;li&gt; Adding some products
&lt;/li&gt;
&lt;li&gt; Then sending payment to Paynow
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  1. Initialize Paynow    &lt;a&gt;&lt;/a&gt;
&lt;/h2&gt;

&lt;p&gt;Before you can do anything you have to include PayNow and initialize it first&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;// include paynow here
&lt;span class="cp"&gt;&amp;lt;?php&lt;/span&gt;
&lt;span class="nv"&gt;$paynow&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Paynow\Payments\Paynow&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="s1"&gt;'INTEGRATION_ID'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="s1"&gt;'INTEGRATION_KEY'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="s1"&gt;'http://example.com/gateways/paynow/update'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="s1"&gt;'http://example.com/return?gateway=paynow'&lt;/span&gt;
&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This creates a PayNow instance,  &lt;strong&gt;your keys should be correct&lt;/strong&gt; or it will raise &lt;code&gt;Integration Exception&lt;/code&gt; on checkout. Errors can be annoying.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Creating a payment   &lt;a&gt;&lt;/a&gt;
&lt;/h2&gt;

&lt;p&gt;The next stage involves adding a payment to the PayNow instance you have created:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="nv"&gt;$invoice_name&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"Invoice "&lt;/span&gt; &lt;span class="mf"&gt;.&lt;/span&gt; &lt;span class="nb"&gt;time&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="nv"&gt;$user_email&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;filter_var&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$_POST&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;'user_email'&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt; &lt;span class="no"&gt;FILTER_SANITIZE_EMAIL&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="nv"&gt;$payment&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nv"&gt;$paynow&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;createPayment&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$invoice_name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;$user_email&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This adds a payment to your instance you create in step 1. Once payment succeeds PayNow will send an email to the customer for transparence and reference purposes.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Add some products     &lt;a&gt;&lt;/a&gt;
&lt;/h2&gt;

&lt;p&gt;If you have one product you can add it like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="nv"&gt;$payment&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;add&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'Sadza and Beans'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mf"&gt;1.25&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you have more than one products then you can add them like this&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="nv"&gt;$products&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nc"&gt;Object1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nc"&gt;Object2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nc"&gt;Object3&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mf"&gt;....&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nc"&gt;Object10&lt;/span&gt; &lt;span class="p"&gt;];&lt;/span&gt;

&lt;span class="k"&gt;foreach&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$products&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="nv"&gt;$product&lt;/span&gt;&lt;span class="p"&gt;){&lt;/span&gt;
     &lt;span class="nv"&gt;$payment&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;add&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$product&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;$product&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;price&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If those products have quantities or amounts then it will be something like this&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="nv"&gt;$products&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nc"&gt;Object1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nc"&gt;Object2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nc"&gt;Object3&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mf"&gt;....&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nc"&gt;Object10&lt;/span&gt; &lt;span class="p"&gt;];&lt;/span&gt;
&lt;span class="nv"&gt;$total&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nv"&gt;$tax&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mf"&gt;0.01&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;foreach&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$products&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="nv"&gt;$product&lt;/span&gt;&lt;span class="p"&gt;){&lt;/span&gt;
     &lt;span class="nv"&gt;$total&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nv"&gt;$product&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;price&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="nv"&gt;$product&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;qty&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
     &lt;span class="nv"&gt;$tax_amount&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nv"&gt;$total&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="nv"&gt;$tax&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
     &lt;span class="nv"&gt;$total&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nv"&gt;$tax_amount&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nv"&gt;$total&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
     &lt;span class="nv"&gt;$payment&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;add&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$product&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;$product&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;price&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You could add things like coupons, discounts, promotions and what what but well I will leave that you.&lt;/p&gt;

&lt;h2&gt;
  
  
  Sending payment to PayNow    &lt;a&gt;&lt;/a&gt;
&lt;/h2&gt;

&lt;p&gt;After adding payment the next stage is sending the payment to payment to PayNow&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="nv"&gt;$response&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nv"&gt;$paynow&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;sendMobile&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$payment&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'077777777'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'ecocash'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here were requesting for a mobile transaction to occur between our Paynow account and 0777777777 's Ecocash.&lt;/p&gt;

&lt;p&gt;The number you get from user through forms or from database. The platform('ecocash') can be retrieved from user through forms or by auto detection&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="nv"&gt;$phone&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"07777777"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nv"&gt;$platform&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;""&lt;/span&gt;
&lt;span class="k"&gt;if&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;str_starts_with&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$phone&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'071'&lt;/span&gt;&lt;span class="p"&gt;)){&lt;/span&gt;
     &lt;span class="nv"&gt;$platform&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"onemoney"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="k"&gt;if&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;str_starts_with&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$phone&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'073'&lt;/span&gt;&lt;span class="p"&gt;)){&lt;/span&gt;
    &lt;span class="nv"&gt;$platform&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"telecash"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="k"&gt;else&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nv"&gt;$platform&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"ecocash"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c1"&gt;// Then &lt;/span&gt;
&lt;span class="nv"&gt;$response&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nv"&gt;$paynow&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;sendMobile&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$payment&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;$phone&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;$platform&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Your users will love this 😎😎😎&lt;/p&gt;

&lt;p&gt;So this part alone should send a message to your customer mobile asking for payment:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhcnkp25o3fdfrd2jgj7f.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhcnkp25o3fdfrd2jgj7f.jpg" alt="Alt Text" width="720" height="1280"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Of course there will be some small differences.&lt;/p&gt;

&lt;p&gt;Ok that's it for this one in the next tutorial we will talk about checking payments.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2nza4jbux3awqyf39sy2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2nza4jbux3awqyf39sy2.png" alt="image" width="272" height="185"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>php</category>
      <category>webdev</category>
      <category>payments</category>
      <category>paynow</category>
    </item>
    <item>
      <title>Paynow Integration Part 3: Installation</title>
      <dc:creator>Takunda Madechangu</dc:creator>
      <pubDate>Tue, 16 Feb 2021 13:39:18 +0000</pubDate>
      <link>https://dev.to/takunda/paynow-integration-part-3-installation-59cf</link>
      <guid>https://dev.to/takunda/paynow-integration-part-3-installation-59cf</guid>
      <description>&lt;p&gt;In the last tutorial we got keys from PayNow, in this one we will go through installation of Paynow SDK in PHP based projects.&lt;br&gt;
I will touch on these scenarios:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  Composer&lt;/li&gt;
&lt;li&gt;  Manual Installation&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Also make sure curl extension is enabled in your PHP&lt;/p&gt;
&lt;h2&gt;
  
  
  1. Composer
&lt;/h2&gt;

&lt;p&gt;Type the following command to install paynow php sdk&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;composer require paynow/php-sdk
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then include it in you project like this&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="cp"&gt;&amp;lt;?php&lt;/span&gt;
&lt;span class="k"&gt;require_once&lt;/span&gt; &lt;span class="s1"&gt;'path/to/vendor/autoload.php'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="c1"&gt;// your code here&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you are using Laravel include it like this&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="cp"&gt;&amp;lt;?php&lt;/span&gt;
&lt;span class="kn"&gt;use&lt;/span&gt; &lt;span class="nc"&gt;\Paynow\Payments\Paynow&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="c1"&gt;// your code here&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Thats it!&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Manual Installation
&lt;/h2&gt;

&lt;p&gt;If you don't have composer installed then &lt;a href="https://github.com/paynow/Paynow-PHP-SDK/archive/master.zip"&gt;Download Paynow Here&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Extract it into your project directory then type this into your code&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="cp"&gt;&amp;lt;?php&lt;/span&gt;
&lt;span class="k"&gt;require_once&lt;/span&gt; &lt;span class="s1"&gt;'path/to/library/autoloader.php'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="c1"&gt;// Do stuff&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Example: Manual Installation
&lt;/h3&gt;

&lt;p&gt;If your your folder structure is like this&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;- Paynow
- checkout.php
- success.php
- cart.php
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then you include Paynow like this(inside checkout.php)&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="cp"&gt;&amp;lt;?php&lt;/span&gt;
&lt;span class="k"&gt;require_once&lt;/span&gt; &lt;span class="s1"&gt;'./Paynow/autoloader.php'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And BAM you have access to PayNow!!!&lt;/p&gt;

&lt;p&gt;Congratulations we have finished the boring stages now we move to the interesting stuff&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkj7s46r45m1ytvqyp975.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkj7s46r45m1ytvqyp975.png" alt="image" width="800" height="800"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>PayNow Integration Part 2: Getting Keys</title>
      <dc:creator>Takunda Madechangu</dc:creator>
      <pubDate>Sun, 14 Feb 2021 09:23:54 +0000</pubDate>
      <link>https://dev.to/takunda/paynow-integrating-part-2-getting-keys-4pp9</link>
      <guid>https://dev.to/takunda/paynow-integrating-part-2-getting-keys-4pp9</guid>
      <description>&lt;p&gt;Gateways or APIs needs a way of identifying their users so they can know:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;who requested what &lt;/li&gt;
&lt;li&gt;what belongs to who&lt;/li&gt;
&lt;li&gt;who does what &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;To do that gateways use what are known as API keys/Integration keys. So in order to use an API or a payment gateway you must get those integration/API keys. &lt;/p&gt;

&lt;p&gt;So lets get Integration keys for PayNow&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 1: Creating an account
&lt;/h2&gt;

&lt;p&gt;Go to PayNow and click &lt;strong&gt;Signup&lt;/strong&gt;, you be presented with a &lt;em&gt;big long form&lt;/em&gt;. Enter your details silently 🤣🤣🤣&lt;/p&gt;

&lt;p&gt;Once you complete registration, you will be sent a link to finish off registration&lt;/p&gt;

&lt;p&gt;So check your email and open the message&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fnfmm1ft7qhwql0q1e8ie.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fnfmm1ft7qhwql0q1e8ie.png" alt="Alt Text" width="800" height="293"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Follow the link and log in&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 2: Setup payment bank account
&lt;/h2&gt;

&lt;p&gt;This stage is intuitive you simply select options and enter details where they are needed&lt;/p&gt;

&lt;h3&gt;
  
  
  i. Payment Methods
&lt;/h3&gt;

&lt;p&gt;Select the payment methods you want to accept&lt;br&gt;
&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fq3qyz7xofqewjzr2b29e.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fq3qyz7xofqewjzr2b29e.png" alt="Alt Text" width="800" height="406"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  ii. Bank Accounts
&lt;/h3&gt;

&lt;p&gt;Here you should enter your bank details. Please crosscheck you details before continuing. &lt;br&gt;
&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F7tt9mkxh4y7hjbs98uoh.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F7tt9mkxh4y7hjbs98uoh.png" alt="Alt Text" width="800" height="372"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  iii. Charges
&lt;/h3&gt;

&lt;p&gt;Here you select who absorbs the charges&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fsokue7paew30po0824p0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fsokue7paew30po0824p0.png" alt="Alt Text" width="800" height="314"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Once done click &lt;strong&gt;Finish&lt;/strong&gt; and you will be presented by this screen&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F94jyivkb86qky214ul29.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F94jyivkb86qky214ul29.png" alt="image" width="800" height="307"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Getting Keys
&lt;/h2&gt;

&lt;p&gt;Now click Receive &lt;strong&gt;Payments&lt;/strong&gt; on the navigation then click Other ways to get paid.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F4nnc5wqawqmj8j4ni9cg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F4nnc5wqawqmj8j4ni9cg.png" alt="image" width="524" height="296"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Scroll down to &lt;strong&gt;3rd Party Shopping Carts &amp;amp; Business Systems Integration&lt;/strong&gt; and click &lt;strong&gt;Create or Manage Shopping Carts&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fil9ned66hmc8wmva44g1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fil9ned66hmc8wmva44g1.png" alt="image" width="800" height="335"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Scroll down again to &lt;strong&gt;Advanced Integration&lt;/strong&gt; and click &lt;strong&gt;Create Advanced Integration&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;You will be presented with a form like that:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fonjh119au9mu3catrdj3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fonjh119au9mu3catrdj3.png" alt="image" width="800" height="436"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Enter details and click &lt;strong&gt;Save&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Behold!.....The Keys!!!. 🙌🙌🙌&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F1iaez6d9abkqiq7ovugt.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F1iaez6d9abkqiq7ovugt.png" alt="image" width="800" height="309"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;So you can view your Integration ID and Integration Key, you can also request account to be live mode and you can create another set of keys.&lt;/p&gt;

&lt;p&gt;So ladies and gentlemen this is how you get PayNow keys&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F1cvrunpr07e1jlrcyh8t.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F1cvrunpr07e1jlrcyh8t.png" alt="image" width="310" height="163"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>php</category>
      <category>paynow</category>
      <category>webdev</category>
      <category>payments</category>
    </item>
    <item>
      <title>PayNow Integration Part 1: Intro</title>
      <dc:creator>Takunda Madechangu</dc:creator>
      <pubDate>Sat, 13 Feb 2021 05:21:12 +0000</pubDate>
      <link>https://dev.to/takunda/integrating-paynow-gateway-part-1-intro-1e12</link>
      <guid>https://dev.to/takunda/integrating-paynow-gateway-part-1-intro-1e12</guid>
      <description>&lt;p&gt;Wassup everybody, how are you doing , in this coming series of tutorials I am going to teach you how to integrate PayNow into your web app or website.&lt;/p&gt;

&lt;h2&gt;
  
  
  Present Day
&lt;/h2&gt;

&lt;p&gt;In Zimbabwe its difficult to get access to a fully blown PayPal account likely due to sanctions (though PayPal denies the allegations) so you can only spend but you cannot receive. Which is a total rip off to entrepreneurs.....&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F9an8tqodfmye6pfhe3vc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F9an8tqodfmye6pfhe3vc.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  So what's PayNow
&lt;/h2&gt;

&lt;p&gt;PayNow is an online payment processing platform for Zimbabwe which allows you to make different kinds of payments from tax, fees, bills, subscriptions, donations, payouts etc. &lt;/p&gt;

&lt;p&gt;Its like the PayPal of Zimbabwe(laughs violently). It mainly driven on Zimbabwean currency(ZWL) and United States Dollar.&lt;/p&gt;

&lt;p&gt;Here are some of its features:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Accepts most popular electronic payment methods under a single contract.&lt;/li&gt;
&lt;li&gt;Fast Payments&lt;/li&gt;
&lt;li&gt;Its Secured&lt;/li&gt;
&lt;li&gt;Its Merchants are verified&lt;/li&gt;
&lt;li&gt;No Setup charges&lt;/li&gt;
&lt;li&gt;It has consumer protection&lt;/li&gt;
&lt;/ul&gt;

&lt;h1&gt;
  
  
  PayNow Payment Gateway
&lt;/h1&gt;

&lt;p&gt;PayNow also provides a payment gateway which you can use if you want to accept payments/get paid. The gateway accept the following payments:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Cards&lt;/li&gt;
&lt;li&gt;Mobile Payments&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You are about to say goodbye to no traffic ecommerce sites(laughs violently).&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F69usldf1xpw0ax81us7o.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F69usldf1xpw0ax81us7o.jpg" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In the coming tutorials I am going to show you how can set it up and start accepting payments in your app asap&lt;/p&gt;

&lt;p&gt;Enjoy your day&lt;/p&gt;

&lt;p&gt;Next: &lt;/p&gt;

&lt;p&gt;&lt;a href="https://dev.to/takunda/paynow-integrating-part-2-getting-keys-4pp9"&gt;PayNow Integration Part 2: Getting Integration Keys&lt;/a&gt;&lt;/p&gt;

</description>
      <category>php</category>
      <category>payments</category>
      <category>paynow</category>
      <category>webdev</category>
    </item>
    <item>
      <title>What is that made you divorce your first wife(React Native) for another wife(Flutter)?</title>
      <dc:creator>Takunda Madechangu</dc:creator>
      <pubDate>Thu, 24 Dec 2020 14:27:16 +0000</pubDate>
      <link>https://dev.to/takunda/what-is-that-made-you-divorce-your-first-wife-react-native-for-another-wife-flutter-4lkj</link>
      <guid>https://dev.to/takunda/what-is-that-made-you-divorce-your-first-wife-react-native-for-another-wife-flutter-4lkj</guid>
      <description>&lt;p&gt;What is it that turned off about about React Native?&lt;br&gt;
What is it that makes you choose poligamy(both Flutter and React Native)?&lt;br&gt;
What is it that makes you choose your first wife over the latter(Flutter)?&lt;/p&gt;

&lt;p&gt;Devs lets discuss.....&lt;/p&gt;

</description>
      <category>flutter</category>
      <category>reactnative</category>
      <category>mobile</category>
      <category>devops</category>
    </item>
    <item>
      <title>Creating Laravel Desktop Apps Part 1: Setup</title>
      <dc:creator>Takunda Madechangu</dc:creator>
      <pubDate>Mon, 19 Oct 2020 17:08:59 +0000</pubDate>
      <link>https://dev.to/takunda/creating-laravel-desktop-apps-part-1-setup-1le3</link>
      <guid>https://dev.to/takunda/creating-laravel-desktop-apps-part-1-setup-1le3</guid>
      <description>&lt;p&gt;Hello there? How are you? Ever wondered if it was possible to turn that lovely Laravel project of yours into a desktop app. Well this tutorial if for you.&lt;/p&gt;

&lt;p&gt;I will show you guys how to turn a Laravel app into a desktop app. Lets dive in...&lt;/p&gt;

&lt;h1&gt;
  
  
  Step 1: Download Laravel Electron
&lt;/h1&gt;

&lt;p&gt;If you want to turn Laravel into a Mac Desktop App, then type the following:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;git clone https://github.com/blackgeneration/Laravel-Electron-For-MAC-OS.git&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;If you want to turn laravel into a Windows Desktop App, the type the following:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;git clone https://github.com/laravelarticle/laravel-electron.git&lt;/code&gt;&lt;/p&gt;

&lt;h5&gt;
  
  
  Theses repos are almost the same except for a few differences(platform specific tweaks)
&lt;/h5&gt;

&lt;h1&gt;
  
  
  Step 2: Install Dependencies
&lt;/h1&gt;

&lt;p&gt;Navigate into the project (&lt;code&gt;cd folder_name&lt;/code&gt;) and install dependencies:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;npm install&lt;/code&gt; OR &lt;code&gt;yarn install&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;This will install all required dependencies...&lt;/p&gt;

&lt;h1&gt;
  
  
  Step 3: Run the project
&lt;/h1&gt;

&lt;p&gt;To run the project simple type:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;npm start&lt;/code&gt; OR &lt;code&gt;yarn start&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;For MAC OS users preface these commands with &lt;code&gt;sudo&lt;/code&gt; like this:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;sudo npm start&lt;/code&gt; OR &lt;code&gt;sudo yarn start&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;This should start your project successfully....&lt;/p&gt;

&lt;p&gt;You should see something like &lt;/p&gt;

&lt;p&gt;Laravel Version So and So&lt;br&gt;
PHP Version So and So&lt;/p&gt;

&lt;p&gt;:D&lt;/p&gt;

&lt;p&gt;By the way the Laravel version used is 6 and PHP version is 7.2&lt;/p&gt;

&lt;p&gt;Have fun!&lt;/p&gt;

</description>
      <category>laravel</category>
      <category>electron</category>
      <category>javascript</category>
      <category>php</category>
    </item>
  </channel>
</rss>
