All Projects → radiegtya → React Native Midtrans

radiegtya / React Native Midtrans

Midtrans Mobile SDK for React Native

Programming Languages

javascript
184084 projects - #8 most used programming language
java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to React Native Midtrans

Sdk Dotnet
.Net SDK for Authorize.Net API
Stars: ✭ 124 (+117.54%)
Mutual labels:  payment, payment-gateway, sdk
Sdk Php
PHP SDK for Authorize.Net API
Stars: ✭ 343 (+501.75%)
Mutual labels:  payment, payment-gateway
Payment
simple laravel payment package , supports multiple drivers
Stars: ✭ 328 (+475.44%)
Mutual labels:  payment, payment-gateway
Countly Sdk Ios
Countly Product Analytics iOS SDK with macOS, watchOS and tvOS support.
Stars: ✭ 585 (+926.32%)
Mutual labels:  sdk, mobile
In App Payments Flutter Plugin
Flutter Plugin for Square In-App Payments SDK
Stars: ✭ 256 (+349.12%)
Mutual labels:  payment, sdk
Mojaloop
Starting point for on-boarding and contribution documentation for mojaloop
Stars: ✭ 267 (+368.42%)
Mutual labels:  payment, mobile
Countly Server
Countly helps you get insights from your application. Available self-hosted or on private cloud.
Stars: ✭ 4,857 (+8421.05%)
Mutual labels:  sdk, mobile
awesome-payment
A curated list of payment services
Stars: ✭ 22 (-61.4%)
Mutual labels:  payment, payment-gateway
Voucherify Android Sdk
Android SDK for Voucherify - coupons, vouchers, promo codes
Stars: ✭ 13 (-77.19%)
Mutual labels:  sdk, mobile
Authnetjson
Library that abstracts Authorize.Net's JSON APIs. This includes the Advanced Integration Method (AIM), Automated Recurring Billing (ARB), Customer Information Manager (CIM), Transaction Reporting, Simple Integration Method (SIM), and Webhooks.
Stars: ✭ 14 (-75.44%)
Mutual labels:  payment, payment-gateway
Checkout Sdk Node
Checkout.com SDK for Node.js. Documentation here:
Stars: ✭ 28 (-50.88%)
Mutual labels:  payment-gateway, sdk
SSLCommerz-Laravel
SSLCOMMERZ is a bangladeshi payment gateway provider. This is Laravel Library for SSLCOMMERZ.
Stars: ✭ 66 (+15.79%)
Mutual labels:  payment, payment-gateway
cybersource-android-sdk
The CyberSource InApp SDK enables developers to simply and securely incorporate mobile payments into their Android applications.
Stars: ✭ 25 (-56.14%)
Mutual labels:  payment, payment-gateway
Weex
A framework for building Mobile cross-platform UI
Stars: ✭ 17,793 (+31115.79%)
Mutual labels:  sdk, mobile
flutter paystack
💳 A robust Flutter plugin for making payments via Paystack Payment Gateway. Completely supports Android and iOS
Stars: ✭ 146 (+156.14%)
Mutual labels:  payment, payment-gateway
Gringotts
A complete payment library for Elixir and Phoenix Framework
Stars: ✭ 396 (+594.74%)
Mutual labels:  payment, payment-gateway
Adyen Ruby Api Library
Adyen API Library for Ruby
Stars: ✭ 35 (-38.6%)
Mutual labels:  payment, payment-gateway
paymentgateway
Dokumentace ČSOB platební brány a jejího eAPI pro platby platebními kartami, Apple Pay, mallpay a platebními tlačítky ČSOB.
Stars: ✭ 104 (+82.46%)
Mutual labels:  payment, payment-gateway
youzan-pay
基于有赞云和有赞微小店实现个人收款解决方案。
Stars: ✭ 69 (+21.05%)
Mutual labels:  payment, payment-gateway
Pagarme Laravel
Pagar.me SDK for Laravel applications.
Stars: ✭ 23 (-59.65%)
Mutual labels:  payment, sdk

React Native Midtrans

By https://dumbways.id (Ega Radiegtya)

Originally Developed by my developer team @mucasali (Muchamad Sahli), and @uadacid (Pratamasetya)

This plugin already tested on Production at https://fifilio.com

React Native Midtrans is module for applicate Midtrans Payment Gateway, its use Midtrans Mobile SDK.

react-native-midtrans enable merchant to accept online payments in React Native apps. it use Midtrans Mobile user Interface SDK to make transactions on all the payment types supported by Midtrans. Watch the video for the default module example.

There are four parties involved in the payment process for making a payment.

  1. Merchant Server : The merchant backand implementation
  2. Customers
  3. Midtrans Backend (Payment Procesor)
  4. PaymentProject

Transaction Flow

  1. Checkout: Customer clicks the Checkout button on the Host application and the app makes a request to the Merchant Server
  2. Token request: Merchant Server makes a request to Veritrans server with Order Information.
  3. Token response: Midtrans responds with a valid transaction token to Merchant server
  4. Token response: Merchant server forwards the token to the Mobile SDK
  5. Get transaction options: Mobile SDK requests payment/merchant information based on the token
  6. Transaction options response: Mobile SDK renders the payment Options and payment information to make the payment
  7. Pay: Customers selects the payment method and the payment details and clicks “Pay”
  8. Charge: Mobile SDK sends the Charge request to the Veritrans Backend for payment Processing.
  9. Charge response: Mobile SDK receives the response from the Veritrans Backend and triggers the handler on Mobile App with success/failure/pending status
  10. Charge notification: Midtrans Backend sends a notification to the Merchant backend confirming the completion of transaction.

Prerequisites

  • Create a merchant account in MAP
  • In MAP, setup your merchant accounts settings, in particular Notification URL.
  • Setup your merchant server. A server side implementation is required for midtrans mobile SDK to work. You can check the server implementation reference, and walk through the API’s that you may need to implement on your backend server.
  • Minimum requirements for Android
  • compileSdkVersion 25
  • buildToolsVersion min 25.0.2
  • targetSdkVersion 25

Installation

  • Install the module
npm i --save react-native-midtrans

or

npm install --save git+https://github.com/radiegtya/react-native-midtrans.git
  • Link the library
react-native link react-native-midtrans
  • In your android/build.gradle add
android {
  .....
}
repositories {
    // Add the midtrans repository into the list of repositories
    maven { url "http://dl.bintray.com/pt-midtrans/maven" }
}

Usage

Lets require react-native-midtrans module

import PaymentMidtrans from 'react-native-midtrans'

Checkout Payment

PaymentMidtrans.checkOut(
	optionConect,
	transRequest,
	itemDetails,
	creditCardOptions,
  userDetail,
  optionColorTheme,
  optionFont,
	callback(res)
);

Props of Payment CheckOut

  • optionConect (Object)

    1. clientKey (String) clientKey from MAP (Merchant Admin Portal)
    2. urlMerchan (String) url Backend
    Example:
    const optionConect = {
    		clientKey: "VT-CLIENT-AAAAAAAAAAAAA",
    		urlMerchant : "http://example.com/payment"
    }
    

    Note: in merchant Server (backend) must be have route with name charge for handle request to Veritrans server with Order Information. for detail can visit here

  • transRequest (Object)

    1. transactionId (String) id of transaction
    2. totalAmount (Number) total amount be paied on checkOut
    Example:
    const transRequest = {
    		transactionId : "001",
    		totalAmount : 6000
    }
    
  • itemDetails (Arrray), holds infromation about ilist of tem purchased by user transaction required for Mandiri Bill and BCA KlikPay, Optional for another payment

    1. id (String) id of item
    2. price (Number) price of item
    3. qty (Number) qty of item
    4. name (String) name of item
Example:
var itemDetails = [
              {id:"001", price:1000, qty:4, name:"cimory"},
              {id:"002", price:2000, qty:2, name:"cofimix"}
            ];

Note: Sum of price must be equals with totalAmount in transRequest

  • creditCardOptions (Object)
    1. saveCard = save card to Snap (true or false)
    2. saveToken = save card token as 'one click' token (true or false)
    3. paymentMode = mode payment use credit Card ("Normal", "Two Click", "One Click")
    4. secure = using 3D secure (true, false)
var creditCardOptions = {
    saveCard:false,
    saveToken:false,
    paymentMode:"Normal",
    secure:false
    };
  • userDetail (Object)
    1. fullName = Full Name member (customer)
    2. email = Email customer
    3. phoneNumber = Phone Number Customer
    4. userId = User Id Customer
    5. address = Address Customer
    6. city = City Customer
    7. country = Country Customer
    8. zipCode = ZipCode Customer
var userDetail = {
  fullName:"Ahmad", email:"[email protected]", phoneNumber:"0850000000", userId:"U01", address:"kudus", city:"kudus", country:"IDN", zipCode:"59382"
};

*Note: value of country use ISO 3166-1 alpha-3, visit wikipedia to learn about ISO 3166-1 alpha-3

  • optionColorTheme (Object)
    1. primary = For top panels showing amount
    2. primaryDark = For bordered button, link button
    3. secondary = For text field.
var optionColorTheme = {
  primary:'#c51f1f',
  primaryDark:'#1a4794',
  secondary:'#1fce38'
}
  • optionFont (Object)
    1. defaultText = for default Text
    2. semiBoldText = for semi bold text
    3. boldText = for bold text
var font = {
  defaultText:"open_sans_regular.ttf", semiBoldText:"open_sans_semibold.ttf",
  boldText:"open_sans_bold.ttf"
}

*Note: open_sans_regular.ttf, open_sans_semibold.ttf, open_sans_bold.ttf is path of the custom font on the assets directory.

  • Callback (function) to return result of payment transaction;
var callback = (res)=>{console.log(res)};

Payment Result

TransactionResult is wrapper for UI flow finished transaction object. It contains:

status : either canceled, pending, success, failed or invalid based on payment API.

  • status canceled is value if transaction canceled. for example when selecting payment method users click back
  • status: pending will be only use on asynchronous transaction like bank transfer or internet banking.
  • status success / failed: For synchronous transaction you can immediately know the status of the transaction.
  • status invalid : There are unknown error happened.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].