Giter VIP home page Giter VIP logo

furahitechpay's Introduction

FurahitechPay

This is a collection of different payment API's, this API supports Stripe, Tigo Pesa and M-Pesa payments for now. For M-Pesa payments we have used wazoHub as our aggregator.

Releases

Features

  • Small library
  • Supports Stripe,M-Pesa and Tigo Pesa payments
  • Select only supported mobile network operators on mobile payments
  • Automatically monitor for the callback on the server side (M-Pesa payments)
  • Operate on both LIVE and SANBOX environments.
  • Check payment status from the Tigo Secure page
  • Payment instant callback from your back end
  • Elegant UI

Installation

This API depends on server side logic which helps to log partial payments to a JSON file waiting for a callback from M-Pesa servers and payment authorisation from Tigo Pesa servers.

Server side installation

This API work with FurahitechPayments-Server repo, what you have to do is:-

  • Clone this repository and upload /server directory to your server
  • Submit your callback URL to WazoHub as:-
 <exampledomain.com>/v1/vodacom/callback

Client Side installation (Android)

Add this to your dependencies (Check for the latest release):

implementation 'com.github.kileha3:FurahitechPay:1.0'

Create a payment request

 PaymentDataRequest request = new PaymentDataRequest();
 request.setAmount(50000);
 request.setEmailAddress("[email protected]");
 request.setFirstName("John");
 request.setLastName("Doe");
 request.setDescription("Lorem Ipsum is simply dummy text of the printing and typesetting industry");
 request.setProductId("2");
 request.setProductName("Lorem Ipsum");
 request.setGatewayType(Furahitech.GateWay.MNO);
 request.useLiveApi(true);
 request.setDataReceiver("");
 request.setOneSignalApiKey("");
 request.setOneSignalAppId("");

Card / Mobile payment request type

 //Mobile payment
 request.setGatewayType(Furahitech.GateWay.MNO);
 
 //Card payment
 request.setGatewayType(Furahitech.GateWay.CARD);
 

Send payment request

 FurahitechPay.getInstance()
    .with(this)
    .setBaseUrl("")
    .setPaymentDataRequest(request)
    .setStripePublishableKey("")
    .setPaymentResultListener(this)
    .setSupportedGateway(Furahitech.GateWay.TIGOPESA)
 

Make sure your Activity or Fragment implements PaymentResultListener

 public class MainActivity extends AppCompatActivity implements PaymentResultListener
 

Override respective methods to listen for the payment status

 
 @Override
 public void onPaymentCompleted(PaymentResult paymentResult) {
    
 }
     

Acknowledge to your back-end that you have received payment status

FurahitechPay.getInstance().acknowledgePaymentResult(paymentResult);
     

In case you don't fully support all mobile payments just pass supported ones.

...
//Remove the one you don't support from the param list
.setSupportedGateway(TIGOPESA,MPESA)
...

For SANDBOX development environment

... 
//Default value is FALSE - which means SANDBOX
request.useLiveApi(true);
...

If you want to send payment result automatically to your remote server make sure to include its URL on request. Your receiving end must be of type POST

... 
 request.setDataReceiver("");
...

POST data which will be sent to your remote URL

{
  "status":true ,
  "productName":"Example Product Name",
  "productId":"12",
  "message":"Unfortunately, your payment was not successfully processed by FurahitechPay<\/b>",
  "transactionRef":"xujJvV7jjHYYV9E79",
  "timeStamp":1537975151,
  "amount":"50000",
  "clientEmail":"[email protected]",
  "clientName":"John Doe"
}

/* status":true = SUCESS */

Contributing

  • Do you have a new feature in mind?
  • Do you know how to improve existing docs or code?
  • Have you found a bug?

Feel free to fork this project and send pull request, your contribution will be highly appreciated.Be ready to discuss your code and design logics

License

Copyright (c) 2018 Lukundo Kileha

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sub license, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANT ABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

furahitechpay's People

Contributors

kileha3 avatar

Stargazers

Jordan Kalebu avatar Yudatadei avatar  avatar

Watchers

Ramadhani Khamisi avatar  avatar

Forkers

swaiba43 tzcodes

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.