Amount and Reference: Classes used to set the amount and reference properties.
PaymentWidgetType allows for multiple payment types:
Card
Google Pay™
iDEAL
Identifies the transaction result:
PAYMENT_SUCCESS
PAYMENT_ERROR
PAYMENT_CANCELLED
The JudoActivity class is used to start a payment intent.
Building the Judo Object
Set up the Transaction Amount
In the Amount object provide the Amount value and Currency type:
val amount = Amount.Builder()
.setAmount("150.50")
.setCurrency(Currency.GBP)
.build()
Set up the Transaction Reference
In the Reference object provide the ConsumerReference string:
val reference = Reference.Builder()
.setConsumerReference('my-consumer-reference')
.build()
Set up the Judo Configuration
Set the following required parameters:
The token and secret values, OR create the authorisation object (Step 3 below).
Set the SDK to run in sandbox mode
Set the following objects:
Judo ID
JudoId format = 100100100
Authorisation object (if using this method)
Amount
Reference
Create the authorisation object:
val authorization = PaymentSessionAuthorization.Builder()
.setPaymentSession(paymentSession)
.setApiToken(token)
.build()
4. Set the authorisation object when invoking Judo builder:
val builder = Judo.Builder(widgetType)
.setAuthorization(authorization)
Field
Description
CARD_PAYMENT
Card Payment
TOKEN_PAYMENT
Starts a token payment with optionally asking the user to enter their CSC and / or cardholder name.
PRE_AUTH
Card PreAuth
TOKEN_PRE_AUTH
Starts a pre-auth token payment with optionally asking the user to enter their CSC and / or cardholder name.
CREATE_CARD_TOKEN
Save Card
CHECK_CARD
Check Card
PAYMENT_METHODS
Payment Method Selection
PRE_AUTH_PAYMENT_METHODS
PreAuth Method Selection
GOOGLE_PAY
Google Pay (Payment)
PRE_AUTH_GOOGLE_PAY
Google Pay (PreAuth)
SERVER_TO_SERVER_PAYMENT_METHODS
Server to Server
The Judo object is now configured and you are ready to make a transaction.
Making a Transaction
Each transaction operation is represented as an Activity.
To make a transaction:
Create an Intent to pass the JudoActivity class
Add the Judo object to the Intent:
Call putExtra
Assign it to the JUDO_OPTIONS key
The Judo object holds all the payment configurations previously set up.
3. Pass the Intent and a request code to allow Judopay to handle the onActivityResult
and the transaction response:
val intent = Intent(this, JudoActivity::class.java);
intent.putExtra(JUDO_OPTIONS, judo);
startActivityForResult(intent, JUDO_PAYMENT_WIDGET_REQUEST_CODE);
4. Implement the onActivityResult method and handle the transaction response:
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
super.onActivityResult(requestCode, resultCode, data)
if (requestCode == JUDO_PAYMENT_WIDGET_REQUEST_CODE) {
when (resultCode) {
PAYMENT_CANCELLED -> toast("User cancelled the payment.")
PAYMENT_SUCCESS -> {
val result = data?.getParcelableExtra<JudoResult>(JUDO_RESULT)
// Handle response
}
PAYMENT_ERROR -> {
val error = data?.getParcelableExtra<JudoError>(JUDO_ERROR)
// Handle error
}
}
}
}
Check the request code from the onActivityResult and see if it matches with
JUDO_PAYMENT_WIDGET_REQUEST_CODE.
If it does, the result is called from the JudoActivity.
This means the imported response codes can be used to check the following possible response type and handle each case respectively:
JudoKit-Android is enabled for 3D Secure 2 (EMV 3DS).
3D Secure 2 is available on JudoKit Android version 3.0.0 or higher, and is available on github.
Using the Card Entry UI
The easiest way to integrate 3D Secure is to use the UI within JudoKit, as this handles the 3D Secure flow for you.
Using a 3D Secure Enabled credential*, follow the steps for Making a Transaction.
*We recommend using billingAddress and emailAddress fields for 3D Secure 2 transactions.
You can provide billingAddress and emailAddress in two ways:
Add and populate billingAddress and emailAddress to the payment configuration object:
Card Entry Example
1val uiConfiguration = UiConfiguration.Builder()2//...3// sets whether 3DS 2.0 UI billing information screen should be presented to the user4.setShouldAskForBillingInformation(false)5.build()67// in case you don't want to present billing info screen to the user, you can set the address instead8val address = Address.Builder()9.setLine1("My house")10.setLine2("My street")11.setTown("My town")12.setPostCode("TR14 8PA")13.setCountryCode("826")14.setBillingCountry("826")15.build()1617val judo = Judo.Builder(PaymentWidgetType.CARD_PAYMENT)18//...19.setUiConfiguration(uiConfiguration)2021// sets the value for challenge request indicator,22// possible values:23// ChallengeRequestIndicator.NO_PREFERENCE24// ChallengeRequestIndicator.NO_CHALLENGE25// ChallengeRequestIndicator.CHALLENGE_PREFERRED26// ChallengeRequestIndicator.CHALLENGE_AS_MANDATE27.setChallengeRequestIndicator(ChallengeRequestIndicator.NO_PREFERENCE)2829// sets the value for SCA exemption,30// possible values:31// ScaExemption.LOW_VALUE32// ScaExemption.SECURE_CORPORATE33// ScaExemption.TRUSTED_BENEFICIARY34// ScaExemption.TRANSACTION_RISK_ANALYSIS35.setScaExemption(ScaExemption.LOW_VALUE)3637// email address38.setEmailAddress("[email protected]")3940// sets the maximum timeout for 3DS 2.0 transactions in minutes,41// always use 2 characters when setting the timeout42.setThreeDSTwoMaxTimeout(30)4344// sets phone number country code45.setPhoneCountryCode("44")4647// phone number48.setMobileNumber("11223344556677")4950// 51.setAddress(address)5253// ...54.build()
Or, to request this information from your customer:
Enable the billingAddress and emailAddress fields to appear in the UI:
.setShouldAskForBillingInformation(true)
Using Token Payments with 3D Secure 2
Using a 3D Secure Enabled credential*, follow the steps for Token Payments.
Customising your Integration
You can customise the payment experience for the consumer by configuring the following UI behaviour properties in the UIConfiguration object:
You have flexibility on how the payment experience looks to the consumer.
The UIConfiguration object allows you to:
Enable | disable the Address Verification Service
Show | hide the amount in the Payments Widget
Enable | disable consumers entering the CV2 code
Show | hide the amount in the payment button
Enable | disable asking the consumer for their cardholder name
Enable | disable asking the consumer for their billing information
To create the UIConfiguration object:
UI Configuration Object
1import com.judopay.judokit.android.UIConfiguration
23val uiConfiguration = UIConfiguration.Builder()4.setAvsEnabled(true)5.setShouldPaymentMethodsDisplayAmount(true)6.setShouldPaymentMethodsVerifySecurityCode(true)7.setShouldPaymentButtonDisplayAmount(true)8.setShouldAskForCardholderName(true)9.setShouldAskForBillingInformation(true)10.build()1112//Call setUIConfiguration on the Judo builder13//Pass the uiConfiguration object:1415val judo = Judo.Builder(PaymentWidgetType.PAYMENT_METHODS)16...17.setUIConfiguration(uiConfiguration)18.build()
The incremental authorisation feature allows you to increment the value of your original preAuth for scenarios where you need to charge your customer a higher total amount.
By incrementing the preAuth value, you will be able to capture the total amount that you wish to charge your customer when you are ready.
The allowIncrement flag allows you to set up your initial preAuth so that it can be incremented by an additional amount.
This feature is only available with a limited set of processors - please check with your account manager before you use this feature.
allowIncrement is part of the main Judo config object, and can be set by the setAllowIncrement function.
If present = it is automatically applied for preAuth requests.
If no value is provided = then false is set by default.
It is mandatory for merchants who have an MCC code of 6012 to submit additional Information about the primary account holder in primaryAccountDetails for payment pre-authorisation.
To set the primary account details when using an alternative payment method, see Adding Payment Methods.
You can also set the primary account details to be sent with the transaction.
To set the primary account details:
Call the setPrimaryAccountDetails on the Judo builder:
You can select the card networks you want to support.
To select the supported card networks:
Set the setSupportedCardNetworks on the Judo builder with an array of CardNetwork values.
val networks = arrayOf(CardNetwork.VISA, CardNetwork.MASTERCARD)
val judo = Judo.Builder(PaymentWidgetType.CARD_PAYMENT)
...
.setSupportedCardNetworks(networks)
.build()
Card Network Options:
Card Network Name
Value
Visa
VISA
MasterCard
MASTERCARD
AMEX
AMEX
China Union Pay
CHINA_UNION_PAY
JCB
JCB
Maestro
MAESTRO
Diners Club International
DINERS_CLUB
Discover
DISCOVER
Other
OTHER
By default, all payment methods are displayed in the Payments Widget (as long as the required parameters are set).
However, you can select the payment methods you want to support.
To select the supported payment methods:
Call the setPaymentMethods on the Judo builder
Pass an array of PaymentMethod enum values:
val paymentMethods = arrayOf(
PaymentMethod.CARD,
PaymentMethod.GOOGLE_PAY,
PaymentMethod.IDEAL
)
val judo = Judo.Builder(PaymentWidgetType.CARD_PAYMENT)
...
.setPaymentMethods(paymentMethods)
.build()
The order you add the payment methods to the array is the order they will be displayed on screen.
You can:
Add any language you need.
Override some or all of the translations of an existing language.
The Judokit Android SDK supports: en (default), fr, es.
Generally, language translations follows the Android localisation process, utilising "res/values directories" and strings.xml files.
Use Existing Translations
To use or test one of Judopay's default language translations, change the language on your Android device:
Settings → System → Language & input → Languages
The translation will be applied automatically.
Override Existing Translations
Identify the SDK String Keys.
The SDK uses string resources defined in its strings.xml file.
You can find the list of all String Keys below.
To modify the value of an existing string, add a new one with the same key to the strings.xml file in your Android project.
You will find this located in the "res/values directory".
This will override the SDK value of this string.
If your app supports multiple languages, ensure you add translations for the overridden string in the appropriate values <language_code> folders.
For example values-fr for French or values-es for Spanish.
To add a new language
Identify the SDK String Keys and prepare the translations for all values in the language you wish to add or override.
You can find the list of all String Keys below.
In your app’s "res/values directory", create a new folder for the language you want to add.
Make sure you use the correct language and region codes, for example:
‘values-es’ for Spanish
‘values-zh-rCN’ for Simplified Chinese
Inside the new language folder, create a strings.xml file if one does not already exist.
Within the newly created strings.xml ensure you provide the translations for all String Keys used by the SDK, otherwise the translation may end up incomplete.
When overriding or adding new String Keys, be careful to avoid String Key conflicts between the SDK and your app.
Any matching Key will cause your app’s value to override the SDK's default value, which could potentially lead to unintended behaviour, or mismatched translations.
SDK String Keys:
<string name="add_address_line">Add address line (optional)</string>
<string name="add_card">Add card</string>
<string name="address_line_1_hint">Address line 1</string>
<string name="address_line_2_hint">Address line 2</string>
<string name="address_line_3_hint">Address line 3</string>
<string name="back">Back</string>
<string name="billing_details_title">Billing Details</string>
<string name="button_done">Done</string>
<string name="button_edit">Edit</string>
<string name="button_scan_card">Scan card</string>
<string name="cancel">Cancel</string>
<string name="ca_province_hint">Province or territory</string>
<string name="card_holder_hint">Cardholder Name</string>
<string name="card_holder_name_required">Cardholder Name is required</string>
<string name="card_holder_name_special_chars">Cardholder Name can't contain numbers or special characters</string>
<string name="card_holder_name_too_short">Cardholder Name can't be less than 4 characters</string>
<string name="card_number_hint">Card number</string>
<string name="card_subtitle">Ending</string>
<string name="cards">Cards</string>
<string name="check_amex_security_code">Check your CID</string>
<string name="check_card">Check Card</string>
<string name="check_card_number">Invalid card number</string>
<string name="check_china_union_pay_security_code">Check your CVN2</string>
<string name="check_cvv">Check your CVV</string>
<string name="check_expiry_date">Check expiry date</string>
<string name="check_jcb_security_code">Check your CAV2</string>
<string name="check_mastercard_security_code">Check your CVC2</string>
<string name="check_visa_security_code">Check your CVV2</string>
<string name="choose_payment_method">Choose a Payment Method</string>
<string name="city_hint">City</string>
<string name="close">Close</string>
<string name="connected_cards">Connected Cards</string>
<string name="continue_text">Continue</string>
<string name="country_canada">Canada</string>
<string name="country_hint">Country</string>
<string name="country_other">Other</string>
<string name="country_uk">UK</string>
<string name="country_usa">USA</string>
<string name="customize_card">Customise Card</string>
<string name="cvv_hint">CVV</string>
<string name="date_hint">MM/YY</string>
<string name="default_amex_card_title">My American Express Card</string>
<string name="default_chinaunionpay_card_title">My China Union Pay Card</string>
<string name="default_dinnersclub_card_title">My Diners Club Card</string>
<string name="default_discover_card_title">My Discover Card</string>
<string name="default_jcb_card_title">My JCB Card</string>
<string name="default_maestro_card_title">My Maestro Card</string>
<string name="default_mastercard_card_title">My MasterCard Card</string>
<string name="default_visa_card_title">My VISA Card</string>
<string name="delete">Delete</string>
<string name="delete_card_alert_message">Are you sure you want to delete this card from your wallet?</string>
<string name="delete_card_alert_title">Delete Card?</string>
<string name="dismiss">Dismiss</string>
<string name="email_hint">Email</string>
<string name="error_amex_not_supported">American Express is not supported</string>
<string name="error_card_title_too_long">Card Name cannot be longer than %1$d characters</string>
<string name="error_country_should_not_be_empty">Please select a country</string>
<string name="error_diners_club_not_supported">Diners Club is not supported</string>
<string name="error_discover_not_supported">Discover is not supported</string>
<string name="error_jcb_not_supported">JCB is not supported</string>
<string name="error_maestro_not_supported">Maestro is not supported</string>
<string name="error_mastercard_not_supported">Mastercard is not supported</string>
<string name="error_province_territory_should_not_be_empty">Please select a province or territory</string>
<string name="error_state_should_not_be_empty">Please select a state</string>
<string name="error_union_pay_not_supported">China UnionPay is not supported</string>
<string name="error_unknown_not_supported">Unknown Card Network is not supported</string>
<string name="error_visa_not_supported">Visa is not supported</string>
<string name="expire_soon">Expire soon</string>
<string name="expired">Expired</string>
<string name="ideal_transaction">iDEAL transaction</string>
<string name="invalid_address">Please enter a valid address</string>
<string name="invalid_city">Please enter a valid city</string>
<string name="invalid_email_address">Please enter a valid email</string>
<string name="invalid_mobile_number">Please enter a valid mobile number</string>
<string name="invalid_phone_country_code">Please enter a valid country code</string>
<string name="invalid_postcode">Invalid postcode entered</string>
<string name="invalid_zip_code">Invalid ZIP code entered</string>
<string name="is_expired">Is expired</string>
<string name="mobile_number_hint">Mobile number</string>
<string name="no">No</string>
<string name="no_cards_added">You didn’t add any cards yet. Add one right now or use any of the payment methods below</string>
<string name="no_connected_cards">You didn't connect any cards yet</string>
<string name="ok">Ok</string>
<string name="pay_amount">Pay %1$s</string>
<string name="pay_now">Pay Now</string>
<string name="phone_country_code_hint">+()</string>
<string name="post_code_hint">Postcode</string>
<string name="processing">Transaction pending…</string>
<string name="register_card">Register Card</string>
<string name="retry">Retry</string>
<string name="save">Save</string>
<string name="save_as_default_payment_method">Save as default payment method</string>
<string name="save_card">Save Card</string>
<string name="scan_card_confirm">Got it</string>
<string name="scan_card_go_to_settings">Go to Settings</string>
<string name="scan_card_no_permission_message">Permissions must be granted in order to use the scan card functionality. Please go to Settings and toggle Camera on</string>
<string name="scan_card_no_permission_title">Camera permissions not granted</string>
<string name="secure_checkout">Secure Checkout</string>
<string name="secure_server_transmission">Your card details are encrypted using TLS before transmission to our secure payment service provider.</string>
<string name="there_is_a_delay">This is taking longer than expected. Please wait…</string>
<string name="three_d_secure_check">3D Secure Check</string>
<string name="transaction_successful">Transaction success!</string>
<string name="transaction_unsuccessful">Transaction unsuccessful - please try again</string>
<string name="unable_to_process_request_error_title">Unable to process</string>
<string name="us_state_hint">State</string>
<string name="will_expire_soon">Will expire soon</string>
<string name="yes">Yes</string>
<string name="you_will_pay">You will pay</string>
Set the required properties using the prerequisite imported models.
Set some additional optional properties to customise Google Pay™:
val billingAddressParams = GooglePayBillingAddressParameters(
format = GooglePayAddressFormat.MIN,
phoneNumberRequired = true
)
val shippingAddressParams = GooglePayShippingAddressParameters(
phoneNumberRequired = true
)
val googlePayConfiguration = GooglePayConfiguration.Builder()
.setTransactionCountryCode("GB")
.setEnvironment(GooglePayEnvironment.TEST)
.setIsEmailRequired(true)
.setIsBillingAddressRequired(true)
.setBillingAddressParameters(billingAddressParams)
.setIsShippingAddressRequired(true)
.setShippingAddressParameters(shippingAddressParams)
.build()
Field
Description
setTransactionCountryCode
Required
Sets the transaction ISO-3166 country code.
setEnvironment
Required
Sets the Google Pay™ environment to either:
TEST
PRODUCTION
In order to go-live you will need to have set up your Google Pay™ API merchant live account.
setIsEmailRequired
Optional
Sets the option for the consumer to provide their email address.
setIsBillingAddressRequired
Optional
Sets the option for the consumer to provide their billing address.
setBillingAddressParameters
Optional
Sets the billing address format.
SetIsShippingAddressRequired
Optional
Sets the option for the consumer to provide their shipping information.
setShippingAddressParameters
Optional
Sets the shipping address format.
Although setting the billing and shipping parameters is optional, they must be provided if the billing and shipping requirements are set to true.
Making a Google Pay™ Transaction
Prerequisite
You have set up the GooglePayConfiguration.
To make a Google Pay™ transaction:
Add the setGooglePayConfiguration method to the Judo builder
Set the PaymentWidgetType to:
GOOGLE_PAY
Start the Judo activity:
val judo = Judo.Builder(PaymentWidgetType.GOOGLE_PAY)
...
.setGooglePayConfiguration(googlePayConfiguration)
.build()
val intent = Intent(this, JudoActivity::class.java);
intent.putExtra(JUDO_OPTIONS, judo);
startActivityForResult(intent, JUDO_PAYMENT_WIDGET_REQUEST_CODE);
To make a Google Pay™ pre-auth request:
Add the setGooglePayConfiguration method to the Judo builder
Set the PaymentWidgetType to:
PRE_AUTH_GOOGLE_PAY
Start the Judo activity:
val judo = Judo.Builder(PaymentWidgetType.PRE_AUTH_GOOGLE_PAY)
...
.setGooglePayConfiguration(googlePayConfiguration)
.build()
val intent = Intent(this, JudoActivity::class.java);
intent.putExtra(JUDO_OPTIONS, judo);
startActivityForResult(intent, JUDO_PAYMENT_WIDGET_REQUEST_CODE);
To add iDEAL support to your Payments Widget, set:
The currency code to EUR (Euro)
The JudoId
The judoIdparameter can be set by calling setJudoIdon the Judo builder.
An example of a valid iDEAL configuration:
val judo = Judo.Builder(PaymentWidgetType.PAYMENT_METHODS)
...
.setJudoId("my-judo-id")
.setCurrency("EUR")
.build()
Once the currency and judoId are set, iDEAL will be available as a payment method in the Payments Widget.
Testing Android Mobile Card Transactions
Follow our suggested guidelines to simulate both positive / happy path scenarios, and negative scenarios in the sandbox environment to test your integration is working correctly.
This will give you confidence for when your integration goes live.
Ensure your Android Application Package is enabled for sandbox testing.
This is to permit the Google Pay™ Support Team to run their review tests.
Send your Android Application Package to the Google Pay™ Support Team so they can review your app and assist you with any of the Terms and Conditions that need to be agreed.
The Google Pay™ Support Team will enable your app with production access to Google Pay™, once their review has been successfully completed.
You will then be able to accept Google Pay™ transactions from your mobile app.