Guides & Tutorials
Jenga PGW
Checkout SDK
Android

Payment Gateway SDK - Android

This document is intended to help understand the integration process of your Native Android App with Jenga Payment Gateway Android SDK.

Pre-requisites

  1. Sign up for an account on Jenga HQ (opens in a new tab)
  2. Make sure you have at least one wallet added under Settings -> Wallets in the left navigation menu.
  3. Navigate to Settings -> Subscriptions under the left navigation menu and add subscriptions for the payment
    methods you want to provide on the checkout screen.
  4. Navigate to Settings -> Api Keys under left navigation menu and click on Generate New Keys, if the keys
    have not been generated yet.
  5. On the above Settings -> Api Keys screen, click on View inside Your Public Key section, if the window which
    opens does not contains your public key, please generate and paste it there, and then click on the Update
    button to update the same on Jenga HQ.

Integration Steps

Follow the below steps to integrate Checkout Android SDK with your Android application:

  1. Open your project-level build.gradle file and declare mavenCentral() repository inside repositories block inside
    buildscript block, if it does not already exists.
build.gradle
buildscript {
    repositories {
        mavenCentral()
    }
}
  1. Open your app-level build.gradle file and add Jenga Checkout’s gradle dependency inside the dependencies
    block. For the latest version, please refer the Releases and Versions section.
build.gradle
dependencies {
    implementation 'io.jengapgw:jengapgw-android:1.0.2'
}
  1. If you have not generated a token, follow the steps in the prerequisites page to get one.

  2. Import the required packages as shown below

Kotlin
import io.jengapgw.Checkout
import io.jengapgw.CheckoutResultListener
import io.jengapgw.models.CheckoutResult
import io.jengapgw.models.Order
  1. Create an order in your system and then create an order for the Jenga Android SDK by creating an object of the
    Order class.
Kotlin
val order = Order(
    merchantCode, walletId, amount, orderReference, productType,
    productDescription, extraInfo, paymentTimeLimit, currency,
    callbackUrl, signature, countryCode, customerFirstName,
    customerLastName, customerZipCode, customerAddress, environment,
    token
)

Order class’s fields and their description are as follows:

ParameterTypeMeaningMandatory
merchantCodeStringA unique string identifier for a merchant. You can obtain your merchantCode from under **Settings -> Api **Keys in the left navigation menu on Jenga HQ.Y
amountStringOrder amount, which you want to transact.Y
orderReferenceStringA unique id identifying your order, this you may get from the order you have created in your system.Y
productTypeStringType of the product which the order contains.N
productDescriptionStringDescription of the product which the order contains.Y
extraInfoStringAny extra information you may want to set for the order.N
paymentTimeLimitIntegerTime limit in seconds, to complete the transaction.N
currencyStringCurrency code for the order amount currency.Y
callbackUrlStringA callback url to post back the checkout data.Y
signatureStringSignature to verify if secureMode is enabled.N
countryCodeStringCustomer’s country code.N
customerFirstNameStringCustomer’s first name.N
customerLastNameStringCustomer’s last name.N
customerZipCodeStringCustomer’s zipcode.N
customerAddressStringCustomer’s address.N
environmentStringThe environment being utilized. It should either be live or sandboxY
tokenStringThe bearer authorization tokenY
  1. Launch Checkout screen to initiate payment by calling start() method of the Checkout class and passing the
    order object created in the previous step and the FragmentManager class’s instance.
Kotlin
val checkout = Checkout()
checkout.start(order, supportFragmentManager)
  1. Implement CheckoutResultListener interface and override its onResult method in the class where you are
    launching the checkout from, to receive a callback from the SDK once the checkouts gets successful or failed.
    Here you can show a relevant message to the customer, based on the checkout status.
Kotlin
class CheckoutActivity : AppCompatActivity(), CheckoutResultListener {
 
    override fun onResult(result: CheckoutResult) {
        Toast.makeText(this, result.message, Toast.LENGTH_SHORT).show()
        Log.i("Response Result", result.toString())
    }
}

CheckoutResult class’s fields and their description is as below:

ParameterTypeMeaning
successBooleanTrue if the checkout was successful else false.
orderReferenceStringOrder reference you passed earlier.
transactionReferenceStringA unique transaction reference generated by Jenga.
transactionDateStringDate of the transaction, formatted as “YYYY-MM-ddThh:mm:ssZ”.
transactionAmountStringOrder transaction amount.
transactionCurrencyStringOrder transaction currency.
paymentChannelStringPayment Channel Id used by the customer.
messageStringCheckout success or failure message.