Checkout Reference for 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{:target="_blank" rel="noopener"}.
  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.
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.
dependencies {
    implementation 'io.jengapgw:android:1.0.0'
}
  1. Add Jenga API key and Consumer Secret as meta-data properties under the tag in your app-
    level AndroidManifest.xml file and replace the values with your Api key and consumer secret.
<application>

    <meta-data
        android:name="com.jenga.checkout.JengaCheckoutAPIKey"
android:value="<---Enter your Api key here--->" />

    <meta-data
        android:name="com.jenga.checkout.JengaCheckoutConsumerSecret"
        android:value="<---Enter your Consumer Secret here--->" />

</application>

Navigate to Settings -> Api Keys under the left navigation menu on Jenga HQ and click on View Keys button to find your Api Key and Consumer Secret. Refer below image for the same:

602602
  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.
val order = Order(
    merchantCode, walletId, amount, orderReference, productType,
    productDescription, extraInfo, paymentTimeLimit, currency,
    callbackUrl, signature, countryCode, customerFirstName,
    customerLastName, customerZipCode, customerAddress
)

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

Parameter

Type

Meaning

Mandatory

merchantCode

String

A 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

walletId

String

A unique string identifier for the Jenga wallet you want to use. You can obtain the walletId from under Settings -> Wallets in the left navigation menu on Jenga HQ.

Y

amount

String

Order amount, which you want to transact.

Y

orderReference

String

A unique id identifying your order, this you may get from the order you have created in your system.

Y

productType

String

Type of the product which the order contains.

Y

productDescription

String

Description of the product which the order contains.

Y

extraInfo

String

Any extra information you may want to set for the order.

Y

paymentTimeLimit

Integer

Time limit in seconds, to complete the transaction.

Y

currency

String

Currency code for the order amount currency.

Y

callbackUrl

String

A callback url to post back the checkout data.

Y

signature

String

Signature to verify if secureMode is enabled.

Y

countryCode

String

Customer’s country code.

Y

customerFirstName

String

Customer’s first name.

Y

customerLastName

String

Customer’s last name.

Y

customerZipCode

String

Customer’s zipcode.

Y

customerAddress

String

Customer’s address.

Y

  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.
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.
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:

Parameter

Type

Meaning

success

Boolean

True if the checkout was successful else false.

orderReference

String

Order reference you passed earlier.

transactionReference

String

A unique transaction reference generated by Jenga.

transactionDate

String

Date of the transaction, formatted as “YYYY-MM-ddThh:mm:ssZ”.

transactionAmount

String

Order transaction amount.

transactionCurrency

String

Order transaction currency.

paymentChannel

String

Payment Channel Id used by the customer.

message

String

Checkout success or failure message.