Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature90/payouts intergration #246

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file not shown.
119 changes: 119 additions & 0 deletions submissions/Payouts_integration/integration_docx.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Chimoney Payouts Integration Guide</title>
</head>
<body>
<div class="title" align="center">
<p><u><b>Chimoney Payouts Integration Guide</p>
<p>Benefits of Chimoney Payouts:</p></u></b>
</div>
<div class="desc">
<p>Efficiency: Streamline payout processes for businesses and platforms.</p>
<p>Global Reach: Enable cross-border transactions with ease.</p>
<p>Developer-Friendly: Simple API integration for seamless implementation.</p>
<p>Secure Transactions: Ensure the security of financial transactions.</p>
<p>Versatility: Applicable across various industries and use cases.</p>

<p><b>Use Cases:</b></p>

<p>E-commerce Platforms: Swiftly pay vendors and affiliates globally.</p>
<p>Gig Economy Apps: Facilitate quick and secure payments to freelancers.</p>
<p>Financial Apps: Enable seamless money transfers between users.</p>
<p>Marketplaces: Efficiently distribute funds to sellers or service providers.</p>
<p>Crowdfunding Platforms: Disburse funds to project backers with ease.</p>
<p>Remittances: Facilitate cross-border money transfers for users.</p>
<p>Subscription Services: Automate recurring payments for subscribers.</p>
<p>Employee Payments: Streamline payroll processes for businesses.</p>
<p>Digital Services: Pay content creators, influencers, or contributors effortlessly.</p>
<p>Non-profit Organisations: Distribute funds to beneficiaries or support initiatives.</p>

<p><b>Finished product: </p></b>
<a href="https://rb.gy/y5awd"> currency converter using chimoney</a>

<p> Integration Steps (Using javascript and html as an Example): </p>


<p><b>Step 1: Obtain API Key</b></p>
<p>Register on Chimoney and obtain your API key in the developers portal </p>
<p>Follow this tutorial on how to get the get started with chimoney api and developer portal</p>
<p>For this tutorial we will be using the convert local currency amount to USD endpoint this is the url for that https://api.chimoney.io/v0.2/payouts/mobile-money
</p>

<p><b>Step 2: user interface</p></b>

We will create a small interface for easier integration with our api key the interface will provide a way for us to pass the two parameters that is the amount and the country code that are required for the endpoint.

<img src="./interface.png" alt="currency converter interface ">

<xmp>
<body>
<div class="title">
<h2>Get usd amount in Local</h2>
</div>
<div class="country">
sample country codes
<ul>
<li>Kenya code : KES</li>
<li>Nigeria code: NG</li>
<li>Ghana code: GHN</li>
</ul>
</div>
<div class="form">
<label>Country symbol</label>
<input type="text" id="symbol"> <br/> <br/> //input tags
<label>Amount </label>
<input type="text" id="amount"><br/><br/> //input tags
</div>
<div class="button">
<button onclick="convert()">Convert</button> //calls the convert function
</div>
<div id="result"></div>
</body>
</xmp>

The major parts of this code is this line <xmp><button onclick="convert()"></xmp>Convert</button>
Which on click calls the convert method which is where we have our api function



<p><b>Step 3: Initialize Chimoney</p></b>

<p></p>Let's now dive into the real part we will be using javascript for this and use the fetch in built method
<p></p>function convert () { //function triggered on click the
<p></p>const countrySymbol = document.getElementById('symbol').value; // this are to passed as parameter to the endpoint and the are keyed in by the user
<p></p>const amountInUSD = document.getElementById('amount').value;

<p>const options = { // fetch method takes to params that is the options and url so lets define the options
<p>method: 'GET', // this is the method used get method retrieves data
<p>headers: { // takes in our api key as application json
<p>accept: 'application-json',
<p>'X-API-KEY': "f53b14db7658d93aeb2f8589838b87e01d730d82b9c73e9878065452902790b7" //for best practices save your api key in the .env file
<p>}
<p>};
<p>const apiUrl = 'https://api.chimoney.io/v0.2/info/usd-amount-in-local?destinationCurrency=USD&amountInUSD=1' //pass the url to the endpoint where data is to bne fetched
<p>fetch(apiUrl, options) //as we said earlier fetch takes two params pass them here, you can also use the axios method.it's also safe to test your codes in the sandbox/postman before coding it
<p>.then(response => response.json())
<p>.then(response => { document.getElementById('result').innerText = `Result: ${JSON.stringify(response)}`; ///we stringify the response we get so that it becomes user friendly then we render it under the result div
<p>})
<p>.catch(err => console.error(err));//if the response is not of status 200 a descriptive error will be returned
<p>}


<p><b>Step 4: Make a conversion</b>
<p>Click on the covert button and the result will be displayed

<p><b>Step 5: Handle Errors</b>

<p>Implement error handling to manage API responses:
<p>javascript
<p>.catch(err => console.error(err)); //this will make it easier to debug your code

<p><b>Demo Project:</b>

<p>link to GitHub repository containing the demo project showcasing the integration steps and a working example.
<a href="https://github.com/Davidongora/currency_converter">Github link</a> <p>
</div>
</body>
</html>
Binary file added submissions/Payouts_integration/interface.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.