Android SDK (Kotlin)
Initialization factory
The Initialization Factory is a component of the Payment SDK, designed to provide developers with extensive customization options for the visual aspects of payment integration in their applications. With support for multilingualism, bidirectional writing, light/dark themes, and color customization, the Initialization Factory empowers developers to create tailored payment experiences that meet the diverse needs of their users.
Key Features:
-
Multilingual Support: The Initialization Factory supports English, Arabic, and Kurdish out of the box. Through the
PaymentSDKLocalizationobject you define the list of languages the user can pick from inside the SDK UI, and which one is selected initially. -
Bidirectional Writing (LTR and RTL): Developers can configure the Initialization Factory to support both left-to-right (LTR) and right-to-left (RTL) writing directions, ensuring optimal layout and readability for languages like Arabic.
-
Light and Dark Themes: The Initialization Factory offers options for both light and dark themes, enabling developers to adapt payment interfaces to different environments and user Preferences.
-
Connection Settings: The Initialization Factory allows to configure technical and Security related values, such as base URLs, payment scheme certificates and public keys for data Encryption.
-
Optional Parameters: All customization parameters provided by the Initialization Factory are optional, allowing developers to selectively implement features based on their application Requirements.
Project Setup (v2.0.4)
Before writing any code, make sure your app/build.gradle meets the v2.0.4 requirements:
android {
compileOptions {
// Required by the 2.0.4 AAR
coreLibraryDesugaringEnabled true
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
}
}
dependencies {
// The Payment SDK and 3DS SDK binaries (placed in app/libs)
implementation(name: 'payment-2.0.4', ext: 'aar')
implementation(name: 'emv-3ds-sdk-1.1.6', ext: 'aar')
// Required for core library desugaring
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:2.1.4'
// Provides the LanguageCode enum used by the new localization API
implementation 'com.neovisionaries:nv-i18n:1.29'
}
The v2 configuration classes live in a new sub-package. Note the changed imports:
// v2 configuration builder (moved to the .v2 sub-package)
import tech.finon.payment.config.v2.PaymentSDKConfiguration
import tech.finon.payment.config.v2.PaymentSDKLocalization
// The old Language enum is gone — languages are ISO 639-1 codes now
import com.neovisionaries.i18n.LanguageCode
import tech.finon.payment.config.SDKLanguage
// New configuration types
import tech.finon.payment.config.Merchant
import tech.finon.payment.config.AvailablePaymentMethods
import tech.finon.payment.config.PaymentMethodChoice
import tech.finon.payment.config.AliPaySettings
import tech.finon.payment.config.PaymentTypeAliPay
Code Example:
Configure the SDK (initialization)
// Languages available in the SDK's language picker.
// A null code means "follow the system language".
val availableLanguages = setOf(
SDKLanguage(LanguageCode.en, "English"),
SDKLanguage(LanguageCode.ar, "العربية"),
SDKLanguage(LanguageCode.ku, "کوردی"), // Kurdish — new in v2.x
SDKLanguage(null, "System")
)
val localization = PaymentSDKLocalization(
availableLanguages = availableLanguages,
selectedLanguageCode = LanguageCode.en, // UI language to apply first
writingDirection = WritingDirection.LEFT_TO_RIGHT
)
// Merchant display settings — REQUIRED on Android (see warning below)
val merchant = Merchant(
name = "Merchant Name",
logoUrlLight = "https://example.com/logo-light.png", // logo for light theme
logoUrlDark = "https://example.com/logo-dark.png" // logo for dark theme
)
// Settings for the "Pay with SuperQi" (ALIPAY) payment screen
val aliPaySettings = AliPaySettings(
showFirst = PaymentTypeAliPay.QR, // show the QR option first (or LINK)
qrToDeepLinkFallback = true, // offer an "open the app" button next to the QR
deepLinkToQrFallback = true // offer a QR next to the "open the app" button
)
// 3DS authentication flow settings (replaces the old flat tdssUICustomization)
val tdsSettings = TDSSettings(
authFirst = AuthTypeTDS.SDK, // try the embedded 3DS SDK flow first (or BROWSER)
authFallback = true, // fall back to the other flow on failure
tdssUICustomization = SdkUiCustomization() // EMVCo UI customization
)
val paymentSDKConfiguration = PaymentSDKConfiguration.Builder()
.setConnectionSettings(connectionSettings) // Payment Gateway URL, certificates, keys
.setMerchant(merchant) // required
.setLocalization(localization) // replaces setLanguage / setWritingDirection
.setTheme(Theme.SYSTEM) // LIGHT, DARK, or SYSTEM
.setAvailablePaymentMethods(setOf(
AvailablePaymentMethods.CARD,
AvailablePaymentMethods.ALIPAY, // = "Pay with SuperQi"
AvailablePaymentMethods.PAYMENT_TOKEN
))
.setPaymentMethodChoice(PaymentMethodChoice.ON_SDK) // SDK draws the method chooser
.setAliPaySettings(aliPaySettings)
.setTDSSettings(tdsSettings)
.setSkipResultScreen(false)
.build()
// Initialize Payment SDK with custom configuration.
// The exit callback fires when the user taps the SDK's back/close button.
PaymentSDK.initialize(activity, paymentSDKConfiguration, sdkExitCallback)
Merchant is mandatory on AndroidPaymentSDKConfiguration.Builder().build() throws an SdkIllegalStateException if
setMerchant(...) was never called. Always set the merchant name and logo URLs.
The old top-level setLanguage(...), setWritingDirection(...), and setTdssUICustomization(...)
still compile in v2.x for backward compatibility, but they are deprecated and will be removed
in a future release. The new localization.* and tdsSettings.* values take priority — new
integrations should only use the API shown above.
CustomerInfo.accountIdv2.0.4 rejects a CustomerInfo with a null accountId (the old no-arg CustomerInfo() pattern
no longer works). Always construct it with the real user/account identifier:
val customerInfo = CustomerInfo(accountId = accountId, embossingName = embossingName)
Adding AvailablePaymentMethods.ALIPAY to the method set is all it takes to offer
Pay with SuperQi — ALIPAY is the SDK's internal identifier for it. The full guide
(flows, fallbacks, presets) is in the Pay with SuperQi section.
Custom Forms Configurations
Forms configuration settings allow to personalize various visual and textual elements of the application to align with business requirements and branding. Payment SDK uses platform native approaches for colors, labels and localisation, while embedded 3DS SDK strictly follows EMVCo requirements using UICustomization class.
Key Features:
-
Color Transfer: Developers can customize font, background, and input colors for each theme, with the option to transfer colors between themes for consistent branding and user experience.
-
Custom Labels: The Initialization Factory allows developers to set custom labels as a map of key-value pairs, providing the flexibility to customize text elements within the payment interface according to specific application requirements.
Color Palette
Define the primary, secondary, accent colors, and more to establish the visual identity of your application:
| Color key | Description |
|---|---|
finon_pay_sdk_successful | Success |
finon_pay_sdk_text_error | Error text |
finon_pay_sdk_failed | Failure |
finon_pay_sdk_border | Border |
finon_pay_sdk_shadow | Shadow |
finon_pay_sdk_input_frame_normal | Normal input background |
finon_pay_sdk_input_frame_error | Error input frame |
finon_pay_sdk_button_active_primary | Active primary button |
finon_pay_sdk_button_active_secondary | Active secondary button |
finon_pay_sdk_button_active_third | Active tertiary button |
finon_pay_sdk_button_text_color_primary | Primary button text |
finon_pay_sdk_button_text_color_secondary | Secondary button text |
finon_pay_sdk_button_text_color_third | Tertiary button text |
finon_pay_sdk_button_widget | Non-standard button (back/fallback/locale) |
finon_pay_sdk_text_regular | Regular text |
finon_pay_sdk_text_bold | Bold text |
finon_pay_sdk_bg | Screen background |
finon_pay_sdk_bg_bottom_sheet | Bottom sheet background |
finon_pay_sdk_bg_hint | Hint background |
finon_pay_sdk_bg_card | Card background |
finon_pay_sdk_fragment_bg | Fragment background |
finon_pay_sdk_hint_button | Hint button |
finon_pay_sdk_white_black | White/black (invert) |
finon_pay_sdk_black_white | Black/white (invert) |
finon_pay_sdk_stroke_border | Border and lines |
finon_pay_sdk_badge_color | Badge background color |
finon_pay_sdk_badge_text_color | Badge text color |
finon_pay_sdk_bnpl_card_bg | Installment card background |
finon_pay_sdk_bnpl_installment_label_active | Installment active label |
finon_pay_sdk_bnpl_installment_label_inactive | Installment inactive label |
finon_pay_sdk_bnpl_installment_circle_segment_active | Installment active circle segment |
finon_pay_sdk_bnpl_installment_circle_segment_inactive | Installment inactive circle segment |
XML Example:
Below is an example for resources colors.xml for a particular theme:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="finon_pay_sdk_text_bold">#0A1F41</color>
<color name="finon_pay_sdk_text_regular">#43536D</color>
<color name="finon_pay_sdk_text_error">#F23B37</color>
<color name="finon_pay_sdk_input_frame_normal">#C1C7D0</color>
<color name="finon_pay_sdk_input_frame_error">#F23B37</color>
<color name="finon_pay_sdk_shadow">#7742F4</color>
<color name="finon_pay_sdk_button_active_primary">#7742F4</color>
<color name="finon_pay_sdk_button_active_secondary">#39A156</color>
<color name="finon_pay_sdk_button_text_color_primary">#FFFFFFFF</color>
<color name="finon_pay_sdk_button_text_color_secondary">#39A156</color>
<color name="finon_pay_sdk_bg_bottom_sheet">#FFFFFFFF</color>
<color name="finon_pay_sdk_bg_card">#000000</color>
</resources>
SDK Text & Labels
Tailor text labels, button texts, error messages, and other textual content to resonate with your target audience. Keys are grouped by the screen they appear on:
Common page elements
| String key | Description |
|---|---|
finon_pay_sdk_pay_title | Common title |
finon_pay_sdk_select_locale_title | Select locale title |
finon_pay_sdk_select_locale_cancel_label | Select locale close button label |
finon_pay_sdk_order_amount_info | Order amount info |
finon_pay_sdk_order_merchant_info | Order merchant info |
finon_pay_sdk_secure_label | Common bottom label |
Choose payment method (shown when paymentMethodChoice = ON_SDK)
| String key | Description |
|---|---|
finon_pay_sdk_choose_methods_subtitle | Choose your payment method subtitle |
finon_pay_sdk_choose_alipay_label | Pay with SuperQi method button label |
finon_pay_sdk_choose_aqsati_label | Aqsati method button label |
finon_pay_sdk_choose_card_label | Card method button label |
finon_pay_sdk_choose_tokens_subtitle | Choose token method subtitle |
finon_pay_sdk_choose_card_ends_with_label | Token method button label |
Card / token payment screen
| String key | Description |
|---|---|
finon_pay_sdk_card_subtitle | Card payment screen subtitle |
finon_pay_sdk_card_holder_name_label | Cardholder name label |
finon_pay_sdk_card_holder_name_placeholder | Cardholder name placeholder |
finon_pay_sdk_card_holder_name_char_error | Cardholder name error (invalid characters) |
finon_pay_sdk_card_holder_name_length_error | Cardholder name error (invalid length) |
finon_pay_sdk_card_number_label | Card number label |
finon_pay_sdk_card_number_placeholder | Card number placeholder |
finon_pay_sdk_card_number_error | Card number error |
finon_pay_sdk_card_cvv_label | CVV label |
finon_pay_sdk_card_cvv_placeholder | CVV placeholder |
finon_pay_sdk_card_cvv_error | CVV error text |
finon_pay_sdk_cvv_hint | CVV hint text |
finon_pay_sdk_card_expire_label | Card expiry label |
finon_pay_sdk_card_expire_placeholder | Card expiry placeholder |
finon_pay_sdk_card_expire_error | Card expiry error |
finon_pay_sdk_card_button_label | Card payment next button label |
Pay with SuperQi (ALIPAY) payment screen
| String key | Description |
|---|---|
finon_pay_sdk_alipay_qr_title | Title for the payment start screen |
finon_pay_sdk_alipay_qr_info | Information for the payment start screen |
finon_pay_sdk_alipay_link_waiting_subtitle | Title for the payment waiting screen |
finon_pay_sdk_alipay_link_waiting_info | Information for the payment waiting screen |
finon_pay_sdk_alipay_qr_link_fallback_label | Button label for the QR → application fallback |
finon_pay_sdk_alipay_qr_link_fallback_info | Information about the QR → application fallback |
finon_pay_sdk_alipay_link_qr_fallback_label | Button label for the application → QR fallback |
finon_pay_sdk_alipay_link_qr_fallback_info | Information about the application → QR fallback |
finon_pay_sdk_alipay_link_qr_scan_subtitle | Title for the scan QR modal screen |
finon_pay_sdk_alipay_link_qr_scan_info | Information for the scan QR modal screen |
finon_pay_sdk_alipay_link_error | Error text in case of issues with the payment |
Result screen and receipt
| String key | Description |
|---|---|
finon_pay_sdk_result_success_payment_title | Result screen title for a successful payment |
finon_pay_sdk_result_success_non_payment_title | Result screen title for a successful non-payment operation |
finon_pay_sdk_result_amount_paid_label | Purchase amount label on the success screen |
finon_pay_sdk_result_merchant_name_label | Merchant name label on the success screen |
finon_pay_sdk_result_payment_method_label | Payment method label on the success screen |
finon_pay_sdk_result_transaction_id_label | Transaction ID label on the success screen |
finon_pay_sdk_result_date_time_label | Date and time label on the success screen |
finon_pay_sdk_result_download_receipt_button_label | Download receipt button label |
finon_pay_sdk_result_success_button_label | Finish button label on the success screen |
finon_pay_sdk_result_failure_payment_title | Result screen title for a failed payment |
finon_pay_sdk_result_failure_payment_info | Result screen information for a failed payment |
finon_pay_sdk_result_failure_non_payment_title | Result screen title for a failed non-payment operation |
finon_pay_sdk_result_failure_non_payment_info | Result screen information for a failed non-payment operation |
finon_pay_sdk_result_failure_button_label | Finish button label on the failure screen |
finon_pay_sdk_receipt_title | Receipt title text |
finon_pay_sdk_receipt_powered_by_label | Receipt bottom label |
The Aqsati (BNPL) screens have their own finon_pay_sdk_bnpl_* key family — the full list is in
the vendor documentation.
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="finon_pay_sdk_pay_title">Pay</string>
<string name="finon_pay_sdk_card_subtitle">Add card</string>
<string name="finon_pay_sdk_card_button_label">Next</string>
<string name="finon_pay_sdk_card_number_label">Card number</string>
<string name="finon_pay_sdk_card_number_placeholder">0000–0000–0000–0000</string>
<string name="finon_pay_sdk_card_number_error">Enter your card number</string>
</resources>
Support methods
Get Payment Tokens
The Get Payment Tokens method allows developers to retrieve payment tokens associated with an
accountId from local storage. Payment tokens, represented in the form of UUIDs, serve as secure
identifiers for cards and facilitate seamless payment processing within applications.
Key Features:
-
Secure Token Retrieval: The
Get Payment Tokensmethod retrieves payment tokens securely from local storage, ensuring the confidentiality and integrity of sensitive payment information. -
Association with account ID: Developers can specify an
accountIdas a parameter to retrieve payment tokens associated with that particular user, enabling personalized payment experiences and streamlined transaction management. -
UUID Format: Payment tokens are returned in the form of Universally Unique Identifiers (UUIDs), ensuring uniqueness and compatibility across different platforms and systems.
-
Card Hash: Returns also associated card hashes, so tokens can be migrated to a new device for same account Id.
Code Example:
private fun getPaymentTokens(accountId: String): List<PaymentToken> {
// Call Payment SDK to retrieve payment tokens associated with the specified account Id
return PaymentSDK.getPaymentTokens(accountId)
}
Get latest token transactions
The Get latest Token Transactions method enables developers to retrieve the latest token
transactions associated with a specific payment token.
Code Example:
private fun getLatestTokenTransactions(paymentToken: PaymentToken): List<TokenTransaction> {
// Call Payment SDK to retrieve the latest token transactions
// associated with the specified payment token
return PaymentSDK.getLatestTokenTransactions(paymentToken)
}
Block Payment Token
The Block Payment Token method allows developers to block the payment token, in the case when
it is assumed that the payment token can no longer be used for payment. The card hashe associated
with the blocked token will be removed. It allows to create new token for the card.
Key Features:
-
Token Status Management: The method enables developers to change the status of payment tokens stored locally within the SDK. This status prevent their further use in payment transactions.
-
Developer Control: Developers have full control over the token status, allowing them to block tokens programmatically based on various conditions or triggers. This flexibility enables proactive management of payment tokens to mitigate fraud or security risks.
-
Real-Time Updates: Changes to token status are reflected in real-time within the local storage of the SDK. This ensures that any blocked tokens are immediately recognized and cannot be used for future payment transactions.
-
Granular Blocking: Developers can block specific tokens individually, allowing for granular control over which tokens are invalidated. This precision is useful in scenarios where only certain tokens need to be blocked while others remain active.
Code Example:
private fun blockPaymentToken(paymentToken: PaymentToken): BlockPaymentTokenResult {
// Call Payment SDK to block payment token
return PaymentSDK.blockPaymentToken(paymentToken)
}
Transfer Payment Tokens
The "Transfer Payment Tokens" method allows developers to transfer payment tokens and card hashes associated with an account Id from local storage of one device to another. Payment tokens, represented in the form of UUIDs, serve as secure identifiers for cards and facilitate seamless device to device data migration.
Key Features:
-
Cross-Device Transfer: The method enables developers to transfer payment tokens securely between devices. This facilitates seamless migration of payment data from one device to another, ensuring continuity of payment services for users across different platforms or devices.
-
Account ID Association: Payment tokens are associated with a specific account ID, allowing developers to transfer tokens linked to a particular user or account from one device to another. This ensures that the transferred tokens remain tied to the same user’s account.
-
Local Storage Synchronization: The SDK synchronizes the transfer of payment tokens between devices' local storage seamlessly. This ensures that transferred tokens are accurately replicated on the recipient device without loss or corruption of data.
-
UUID Representation: Payment tokens are represented as universally unique identifiers (UUIDs), ensuring their uniqueness and preventing conflicts or duplication during transfer between devices. This standard format simplifies token management and interoperability across different systems.
-
Secure Transfer Protocol: The method employs a secure transfer protocol to encrypt and protect payment token data during transmission between devices. This safeguards sensitive payment information from interception or unauthorized access by malicious actors.
Code Example:
private fun transferPaymentTokens(accountId: String, tokens: List<PaymentToken>)
: TransferPaymentTokensResult {
// Call Payment SDK to transfer payment tokens associated with the specified account Id
return PaymentSDK.transferPaymentTokens(accountId, tokens)
}
Payment SDK Configuration Change
The Payment SDK Configuration Change method allows developers to update the payment
configuration settings dynamically within their applications, without re-initializing the SDK or
restarting the application. PaymentSDK.updateConfiguration(...) is overloaded by argument
type — pass the value you want to change and the SDK applies it immediately.
Code Example:
// Examples of dynamically changing payment configuration in an Android application
// Update the available payment methods
PaymentSDK.updateConfiguration(
setOf(
AvailablePaymentMethods.PAYMENT_TOKEN,
AvailablePaymentMethods.CARD,
AvailablePaymentMethods.ALIPAY // "Pay with SuperQi"
)
)
// Move the method-selection screen to the app side
PaymentSDK.updateConfiguration(PaymentMethodChoice.ON_APP)
// Change the SuperQi presentation to deep-link first
PaymentSDK.updateConfiguration(AliPaySettings(PaymentTypeAliPay.LINK, true, true))
// Update language to Kurdish
PaymentSDK.updateConfiguration(LanguageCode.ku)
// Update theme to dark
PaymentSDK.updateConfiguration(Theme.DARK)
// Replace the whole localization object
PaymentSDK.updateConfiguration(
PaymentSDKLocalization(
selectedLanguageCode = LanguageCode.en,
availableLanguages = setOf(
SDKLanguage(LanguageCode.en, "English"),
SDKLanguage(LanguageCode.ar, "العربية"),
SDKLanguage(LanguageCode.ku, "کوردی"),
SDKLanguage(null, "System")
),
writingDirection = WritingDirection.LEFT_TO_RIGHT
)
)
Change connection settings
The Change Connection Settings method allows developers to configure connection settings for
the payment gateway within their applications. This functionality enables developers to specify
parameters such as the payment gateway base URL and payment schema certificates, ensuring
secure and reliable communication with the payment gateway server.
Code Example:
// Example of setting connection settings in an Android application
fun setConnectionSettings(settings: ConnectionSettings) {
// Set the payment gateway base URL
PaymentSDK.setPaymentGatewayBaseUrl(settings.baseUrl)
// Set the payment gateway public key
PaymentSDK.setPaymentGatewayBaseUrl(settings.publicKey)
// Set the payment schema certificates
for ((scheme, certificate) in settings.certificates) {
PaymentSDK.setPaymentSchemaCertificate(scheme, certificate, CertAlgorithm.RSA)
}
}
Customize payment form closure actions
The "Subscribe to payment form closure" method allows developers to configure actions such as additional questions or behavioral changes on their application if event for the form closure was fired from Payment SDK side.
Code Example:
// Example of adding a listener to closure event in an Android application
override fun onReceive(context: Context, intent: Intent) {
BroadcastScope().launch {
PaymentSDK.exitSdk { requireContext, onExit ->
requireContext?.let {
val dialog = Dialog(requireContext)
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE)
dialog.setContentView(R.layout.dialog_sdk_exit)
dialog.window?.setBackgroundDrawable(ColorDrawable(Color.TRANSPARENT))
val btnYes = dialog.findViewById<AppCompatButton>(R.id.bt_yes)
val btnNo = dialog.findViewById<AppCompatButton>(R.id.bt_no)
btnYes.text = SpannableStringBuilder()
.underline { append(context.getString(R.string.yes)) }
btnNo.text = SpannableStringBuilder()
.underline { append(context.getString(R.string.no)) }
btnYes.setOnClickListener {
dialog.dismiss()
onExit(true)
}
btnNo.setOnClickListener {
dialog.dismiss()
onExit(false)
}
dialog.show()
}
}
}
}
Exception Handling
SDKNotInitializedException
The SDKNotInitializedException is thrown when an attempt is made to use a feature or
functionality of the Payment SDK without initializing it first. This exception serves as a signal to
developers that the SDK initialization process has not been completed successfully, and subsequent
operations cannot proceed until the SDK is properly initialized.
Code Example:
// Example of handling SDKNotInitializedException in an Android application
try {
// Attempt to perform operations requiring SDK initialization
PaymentSDK.processPayment()
} catch (e: SDKNotInitializedException) {
// Handle SDKNotInitializedException
Log.e("SDK Error", "SDK not initialized: ${e.message}")
// Notify user or initiate retry logic
// Example:
Toast.makeText(context, "Payment SDK not initialized. Please try again later.",
Toast.LENGTH_SHORT).show()
}
SDKAlreadyInitialized
The SDKAlreadyInitialized exception is thrown when an attempt is made to initialize the Payment
SDK multiple times within the application lifecycle. This exception serves as a signal to developers
that the SDK has already been initialized and subsequent initialization attempts are redundant.
Code Example:
// Example of handling SDKAlreadyInitialized exception in an Android application
try {
// Attempt to initialize Payment SDK
PaymentSDK.initialize(context, paymentSDKConfiguration)
} catch (e: SDKAlreadyInitializedException) {
// Handle SDKAlreadyInitializedException
Log.e("SDK Error", "Payment SDK already initialized: ${e.message}")
// Notify user or log the error
// Example:
Toast.makeText(context, "Payment SDK already initialized.", Toast.LENGTH_SHORT)
.show()
}
SDKRuntimeException
The SDKRuntimeException represents unexpected runtime errors that may occur during the
execution of Payment SDK operations. These errors could be due to various factors such as network
issues, server errors, or invalid input parameters. Handling this exception allows developers to
gracefully manage such runtime errors and provide appropriate feedback to users.
Code Example:
// Example of handling SDKRuntimeException in an Android application
try {
// Attempt to perform Payment SDK operation
PaymentSDK.processPayment()
} catch (e: SDKRuntimeException) {
// Handle SDKRuntimeException
Log.e("SDK Error", "Runtime error occurred: ${e.message}")
// Notify user or log the error
// Example:
Toast.makeText(context, "An unexpected error occurred. Please try again later.",Toast.LENGTH_SHORT)
.show()
}
Payment method
Payment Details
The PaymentDetails object represents basic data for payment processing implementation.
Key values description:
-
paymentId- payment identifier returned from payment gateway -
requestId- request identifier from the application -
customerInfo- payer’s dataaccountId- account identifier (user identifier)
-
amount- payment amount -
currency- payment currency -
paymentMethod- representation of method for the payment-
paymentType-PAYMENT_TOKEN,CARDorALIPAY(Pay with SuperQi) -
paymentToken- PaymentToken.id if paymentType is PaymentType.PAYMENT_TOKEN
-
-
nonPaymentOperation- A sign of a non-payment operation. Amount must be null for nonpayment transactions. -
withoutAuthenticate- The indication of the operation without authentication of the payer. -
needPaymentToken- A sign of the need to generate a paymentToken for making Payments,based on a successful Payment. For non-payment transactions, the value must be 'true'. -
tokenType- The type of the requested token (in descending order of possibilities):-
AUTH - authenticated token (for any operations)
-
NON_RECUR - authenticated token (you can perform any operations except recurrent)
-
UNAUTH - an unauthenticated token (only for authentication operations). If the capabilities of the requested token are lower than the result of the operation, a token of the requested type will be returned. Otherwise, the token that was obtained as a result of the operation will be returned.
-
-
aPlusWalletId- wallet identifier for Facial Recognition Authentication
Process payment method call
The Process Payment method facilitates payment transactions within the application using the
Payment SDK. This functionality enables developers to securely process payments and handle
transaction outcomes. The method includes callback functions to handle both successful and error
scenarios, ensuring a seamless payment experience for users.
Code Example:
// Example of calling the "Process Payment" method with paymentDetails, onSuccess, and onError callbacks in an Android application
fun processPayment(
paymentDetails: PaymentDetails,
onSuccess: () -> Unit,
onError: (String) -> Unit
) {
try {
// Attempt to process payment using the provided payment details
PaymentSDK.processPayment(paymentDetails, onSuccess, onError)
} catch (e: PaymentException) {
// Handle PaymentException and invoke error callback
onError("Payment processing error: ${e.message}")
}
}
// Usage:
processPayment(
paymentDetails = paymentDetails,
onSuccess = { showPaymentSuccessMessage() },
onError = { errorMessage -> showErrorDialog("Payment Error", errorMessage) }
)
private fun showPaymentSuccessMessage() {
// Display payment success message to the user
}
private fun showErrorDialog(title: String, message: String) {
// Display error dialog with the provided title and message to the user
}
Integration Support
After reading this entire page, if you've faced any issues or any questions in mind regarding the integration with the Payment SDK then please contact the Payment Gateway Integration Support via Payment Gateway Support Team