Skip to content

TanJay/payment_library

Repository files navigation

Payment Gateway Integration

JitPack Build
GitHub code size in bytes
GitHub language count
JitPack - Downloads
GitHub issues
GitHub last commit
GitHub
Uptime Robot status
GitHub Release Date
Build Status

Hi, Currently we have only integrated Genie payemnt gateway.

Demo Application

Payment Screen [Payment Screen] Card Save
Payment Screen [Payment Screen] Payment Process
Payment Screen [Payment Screen] Card Save with Initial charge

Installation

Add it in your root build.gradle at the end of repositories

allprojects {  
      repositories {  
         ...  
         maven { url 'https://jitpack.io' }  
      }  
   }  

Step 2. Add the dependency

dependencies {  
      ...  
        implementation 'lk.connectbench:payment_library:0.0.3'  
   }  

Simple Build will install all needed dependencies

Setup

Step 1: Add the following permissions to AndroidManifest.xml

<uses-permission android:name="android.permission.WAKE_LOCK" />  
<uses-permission android:name="android.permission.INTERNET" />  
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />  
<uses-permission android:name="android.permission.READ_PHONE_STATE" />  

Step 2: Add the metadata to AndroidManifest.xml under <application> tag

<meta-data android:name="pg_identifier" android:value="@string/pg_identifier" />  
<meta-data android:name="store_name" android:value="@string/store_name" />  
<meta-data android:name="secret_code" android:value="@string/secret_code" />  
<meta-data android:name="currency" android:value="@string/currency" />  
<meta-data android:name="callback" android:value="@string/callback" />  
<meta-data android:name="merchant_identifier" android:value="@string/merchant_identifier" />  
<meta-data android:name="token_store_name" android:value="@string/token_store_name" />  
<meta-data android:name="language" android:value="@string/language" />  
<meta-data android:name="card_save_type" android:value="@string/card_save_type" />  
<meta-data android:name="merchant_display" android:value="@string/merchant_display" />  
<meta-data  android:name="url_trigger" android:value="@string/url_trigger" />  
<meta-data android:name="banner_hide" android:value="@string/banner_hide" />

Step 3: Add strings to values strings.xml

<string name="banner_hide" translatable="false">value</string>
<string name="callback" translatable="false">value</string>
<string name="card_save_type" translatable="false">value</string>
<string name="currency" translatable="false">value</string>
<string name="language" translatable="false">value</string>
<string name="merchant_display" translatable="false">value</string>
<string name="merchant_identifier" translatable="false">value</string>
<string name="pg_identifier" translatable="false">value</string>
<string name="secret_code" translatable="false">value</string>
<string name="store_name" translatable="false">value</string>
<string name="token_store_name" translatable="false">value</string>
<string name="url_trigger" translatable="false">value</string> 

Step 4: Add the following under AndroidManifest.xml inside <application> tag on top

android:usesCleartextTraffic="true"  

Usage

Java Implementation

//Init the view with the price you need    
GeniePayment.processPayment(MainActivity.this, "1.00");

// Save the credit card
GeniePayment.processSaveCard(MainActivity.this);

// Save card with initial transaction
GeniePayment.processSaveCardWithInitialTransaction(MainActivity.this, "1.00");

//Listen for a successful callback from the Observerable    
GeniePayment.getListner(this).getCurrentName().observe(this, new Observer<TransactionResponse>() {  
    @Override  
  public void onChanged(@Nullable TransactionResponse result) {  
        if(result.getStatus()){  
            Toast.makeText(getApplicationContext(), String.format("Success: %s", result.getMessage()), Toast.LENGTH_LONG).show();  
		} else {  
		    Toast.makeText(getApplicationContext(), String.format("Failed: %s", result.getMessage()), Toast.LENGTH_LONG).show();  
		}  
        GeniePayment.dismiss();  
  }  
});

kt Implementation

//Init the view with the price you need    **(Will Update Soon)**
        GeniePayment.Process(this, "1.00")    
    
        //Listen for a successful callback from the Observerable    
        GeniePayment.getListner(this).currentName.observe(this, Observer<String> { t ->    
            Log.d("Genie - Result", String.format("Your result is %s", t))    
            if (t == "1") {    
                //Successful    
                GeniePayment.dismiss()    
            } else if (t == "0") {    
                //Failed    
                GeniePayment.dismiss()    
            } else {    
                //Nothing happened    
            }    
        })    

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages