shurjopay-plugins / sp-plugin-android

shurjoPay plugin SDK for Android apps

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

image Android plugin

Official shurjoPay Android plugin for merchants or service providers to connect with shurjoPay Payment Gateway developed and maintained by ShurjoMukhi Limited.

This plugin can be used with any Android application (e.g. Kotlin, Java).

  1. getToken: to get shurjoPay authorization token for future use
  2. makePayment: create and send payment request
  3. verifyPayment: to check payment status by order id

Also reduces many of the things that you had to do manually:

  • Handles http requests and errors.
  • JSON serialization and deserialization.
  • Authentication during initiating and verifying of payments.

Audience

This document is intended for the technical personnel of merchants and service providers who wants to integrate our online payment gateway for Android application using kotlin plugin provided by shurjoMukhi Limited.

How to configure and use this shurjoPay plugin

To integrate the shurjoPay Payment Gateway in your Android project do the following tasks sequentially.

android {
    ...
    compileSdk 33

    defaultConfig {
        ...
        targetSdk 33
        ...
    }

compileSdk 33 and targetSdk 33 required api 33 (Android Tiramisu)

To get a Git project into your build:

Step 1. Add the JitPack repository to your build file Add it in your root build.gradle at the end of repositories:

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

add this to build.gradle (Module: app) or if you are using "Android Studio Arctic Fox" or heigher add this to settings.gradle (Project Settings)

Step 2. Add the dependency

	dependencies {
		...
	        implementation "com.github.shurjopay-plugins:sp-plugin-android:2.2.1"
		...
	}

Step 3. Add these constraints(SP_USER, SP_PASS and SHURJOPAY_API) to configure Shurjopay instance

      shurjopay = Shurjopay(
          ShurjopayConfigs(
              username = SP_USER,
              password = SP_PASS,
              baseUrl = SHURJOPAY_API
          )
      )    

Android AndroidManifest

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

Request Data Model Setup:

// TODO request data model setup
        val data = PaymentReq(
            prefix,
            amount,
            orderId,
            currency,
            customerName,
            customerAddress,
            customerPhone,
            customerCity,
	    customerPostcode,
            customerEmail,
        )

Payment Request Setup:

// TODO payment request setup
      shurjopay?.makePayment(this, data,
            object : PaymentResultListener {
                override fun onSuccess(success: ShurjopaySuccess) {
                    Log.d(TAG, "onSuccess: debugMessage = ${success.debugMessage}")
                }

                override fun onFailed(exception: ShurjopayException) {
                    Log.d(TAG, "onFailed: debugMessage = ${exception.debugMessage}")
                }

                override fun onBackButtonListener(exception: ShurjopayException): Boolean {
                    Log.d(TAG, "onBackButton: debugMessage = ${exception.debugMessage}")
                    return true
                }

            })

That's all! Now you are ready to use the python plugin to seamlessly integrate with shurjoPay to make your payment system easy and smooth.

References

  1. Android example application showing usage of the library.
  2. Sample applications and projects in many different languages and frameworks showing
  3. shurjopay Plugins home page on github

License

This code is under the MIT open source License.

Please contact with shurjoPay team for more detail.

Copyright ©️2023 ShurjoMukhi Limited

About

shurjoPay plugin SDK for Android apps

License:MIT License


Languages

Language:Kotlin 100.0%