1. Merchant SDK
Freedom Pay
  • Overview
  • Gateway API
    • Overview
    • Sync API
      • Overview
      • Card data encryption
      • Payments
        • Overview
        • Pay by card
        • Pay by card: complete 3DS
        • Pay with Apple Pay
        • Pay with Google Pay
        • Pay by recurring profile
        • Create payment page
        • Create payment page with any amount
        • Capture payment (clearing)
        • Cancel payment
        • Refund payment
        • Get payment status
      • Payouts
        • Overview
        • Pay out to card
        • Pay out to IBAN
        • Get payout balance
        • Get payout status
      • Transfers
        • Overview
        • Transfer from card to card
        • Transfer from card to card: complete 3DS
        • Get exchange rates
        • Get transfer status
      • Saved cards
        • Overview
        • Save card
        • Save card: complete 3DS
        • List saved cards
        • Remove saved card
        • Pay by card token
        • Pay out to card token
        • Get payment status
    • Async API
      • Overview
      • Create
        • Create payment
        • Save card without a charge
      • Read
        • Get payment status
        • Get request result
      • Edit
        • Capture payment (clearing)
        • Cancel payment (reverse)
        • Refund payment
  • Merchant API
    • Overview
    • Payments
      • Overview
      • Checkout
      • Pay by saved card
        • Overview
        • Create payment
        • Confirm payment with CVC
        • Confirm payment without the client
      • Create payment
      • Create payment with a payment page template
      • Create payment in a payment frame
      • Create payment with any amount
      • Create recurring payment
      • Capture payment (clearing)
      • Cancel payment
      • Refund payment
      • Get payment status
    • Payouts
      • Overview
      • Create payout page
      • Pay out to saved card
      • Pay out to IBAN
      • Get payout status
      • Get payout balance
    • Saved cards
      • Get saved cards
      • Save card
      • Save card for payouts
      • Delete saved card
      • Save card without a charge
    • Mobile balance
      • Overview
      • Create mobile balance payment
      • Charge mobile balance
      • Get mobile balance payment status
      • Confirm payment with SMS code
      • Resend SMS code
    • Invoices
      • Overview
      • Recurring payments
        • Overview
        • Create recurring profile
        • Get recurring profile
        • Charge by recurring profile
        • Cancel recurring profile
        • Recurring profile notification
      • Tips
        • Overview
        • Create
      • Create invoice
      • Get invoice status
      • Get invoice details
      • Cancel invoice
      • Refund invoice
    • SDK
      • JS SDK
      • Merchant SDK
        • Android
        • iOS
        • Migration guide
    • CMS
      • Overview
      • Get Merchant ID and key
      • WordPress
        • Overview
        • Installation
        • Configuration
        • Test
        • Live payments
        • Update
      • Tilda
        • Overview
        • Installation
        • Configuration
        • Test
        • Live payments
      • InSales
        • Overview
        • Installation
        • Configuration
        • Test
        • Live payments
      • Ecwid
        • Overview
        • Installation
        • Configuration
        • Test
        • Live payments
      • Bitrix
        • Overview
        • Installation
        • Configuration
        • Test
        • Live payments
      • PrestaShop
        • Overview
        • Installation
        • Configuration
        • Test
        • Live payments
      • OpenCart
        • Overview
        • Installation
        • Configuration
        • Test
        • Live payments
      • CS-Cart
        • Overview
        • Installation
        • Configuration
        • Test
        • Live payments
    • Installment
      • Overview
      • Status
        • Get application status
        • Application status notification
        • Change application status
      • Get partners
      • Create application
    • Callbacks
      • Overview
      • Result notify
      • Check request
      • Payout notify
      • Redirect back
  • Partner API
    • Overview
    • Rates
      • Overview
      • Rates
    • Products
      • Overview
      • Dictionaries
      • Add client with product
      • Client request status
      • Create terminal
      • Update terminal limits
      • Product request status
    • E-Money
      • Overview
      • Add
      • Owner identification
      • Info
      • Close
      • Block
      • Balance
      • Statement
      • Request Status
    • Device ID
      • Android SDK
      • iOS SDK
    • Implement SuperApp
      • Overview
      • Pay
      • Refund
      • Status
    • Account
      • Overview
      • Create payment
      • Payment status
      • Batch statuses
      • Statement
      • Statement status
      • Balance
      • Balance status
    • Invoices
      • Info
  1. Merchant SDK

Android

The Merchant SDK is a library that simplifies interaction with the Freedom Pay API. Supports Android 9 and above.
 Updating to a newer version of the SDK? See the migration guide.

Getting Started#

 Before you begin integrating the Freedom Merchant SDK into your Android app, ensure you have the following:
An Android app project with a minimum API level of 28.

Installation Instructions#

1. Add JitPack repository#

 Add JitPack to your project's settings.gradle.kts:

2. Add Dependency#

3. Sync the project#

 Sync the project with the Gradle files. The latest version is on JitPack.

SDK integration#

Initialize#

 To initialize the Freedom Merchant SDK, call the create method of the FreedomAPI class. This method requires three parameters:
Your merchant ID
Your merchant secret key (where to find the merchant ID and the key: Get Merchant ID and key)
The payment region: the country where your merchant account is registered

Table: Region#

Enum ConstantDescription
KZKazakhstan region.
UZUzbekistan region.
KGKyrgyzstan region.

Integrating the PaymentView#

 PaymentView shows the payment page, the card form and 3DS. It is required for createPaymentPage, createPaymentFrame, addNewCard and confirmCardPayment; other methods work without it.

Adding PaymentView#

 Add the PaymentView to your activity's layout file:
<kz.freedompay.paymentsdk.api.view.PaymentView
   android:id="@+id/paymentView"
   android:layout_width="match_parent"
   android:layout_height="match_parent"/>

Connecting PaymentView#

 Pass the instance of your PaymentView to the SDK:

Tracking Loading Progress (Optional)#

 To track the loading progress of the payment page, use the onLoadingStateChanged listener:

SDK Configuration#

 The SDK's behavior is controlled through its configuration, which you manage using the SdkConfiguration data class. This class acts as a central container, encapsulating two key components: UserConfiguration for customer-specific settings and OperationalConfiguration for general operational parameters.

SdkConfiguration Overview#

The SdkConfiguration object is passed to the SDK via freedomApi.setConfiguration().

Table: UserConfiguration#

 This data class holds customer-specific details.
PropertyTypeDescription
userPhoneString?Customer's phone number. If provided, it will be displayed on the payment page. If null, the user will be prompted to enter it.
userContactEmailString?Customer's contact email.
userEmailString?Customer's email address. If provided, it will be displayed on the payment page. If null, the user will be prompted to enter it.

Table: OperationalConfiguration#

 This data class contains general operational settings for the SDK.
PropertyTypeDescriptionDefault Value
testingModeBoolean?Enables or disables test mode. If null, the value is inherited from the merchant's settings. A non-null value will override the merchant's setting.null
languageLanguage?Sets the language of the payment page. See Language enum for available options. If null, the value is inherited from the merchant's settings. A non-null value will override the merchant's setting.null
lifetimeIntDuration, in seconds, for which the payment page remains valid for completing a payment.1800
autoClearingBoolean?Activates automatic clearing of payments. If null, the value is inherited from the merchant's settings. A non-null value will override the merchant's setting.null
checkUrlString?URL to which the payment check will be sent.null
resultUrlString?URL to which the payment result will be sent.null
requestMethodHttpMethod?HTTP method used for requests to checkUrl or resultUrl. See HttpMethod enum. Defaults to GET if checkUrl or resultUrl is set.HttpMethod.GET (if checkUrl or resultUrl is not null, otherwise null)

Table: Language#

Enum ConstantDescription
KZSDK uses the Kazakh language.
RUSDK uses the Russian language.
ENSDK uses the English language.

Table: HttpMethod#

Enum ConstantDescription
GETSDK uses the HTTP GET method.
POSTSDK uses the HTTP POST method.

Applying the Configuration#

 To apply your desired SDK configuration, create an instance of SdkConfiguration and pass it to the freedomApi.setConfiguration() method:

Working with the SDK#

 This section details the primary methods available in the SDK for managing payments within your application.
Results of server requests are delivered to onResult on the main thread.
Errors found before the request (for example, validation errors) can be delivered on another thread: switch to the main thread before updating the UI.

Create Payment page/frame#

 To initiate a new payment transaction and display the payment page, call the createPaymentPage or createPaymentFrame method on your FreedomAPI instance. This method handles the presentation of the payment page/frame within the previously configured PaymentView.
These methods require that a PaymentView has been set using freedomApi.setPaymentView() prior to calling them.
 These methods accept several parameters to define the payment details:
ParameterTypeDescription
paymentRequestStandardPaymentRequestEssential details required to initiate a new payment. See StandardPaymentRequest model.
onResult(FreedomResult<PaymentResponse>) -> UnitCallback function that will be invoked upon the completion of the payment process. See PaymentResponse model.
 The process returns an FreedomResult<PaymentResponse> object, which can be either:
Success: Contains a PaymentResponse object.
Error: Specifies the type of error that occurred.

Get Payment status#

 To retrieve the current status of a previously initiated payment, use the getPaymentStatus method.
 This method takes these parameters:
ParameterTypeDescription
paymentIdLongUnique identifier of the payment you want to check.
includeLastTransactionInfoBoolean?Optional. When true, includes details of the most recent transaction in the response.
onResult(FreedomResult<Status>) -> UnitCallback function that will be invoked with the result of the payment status. See Status model.
 The process returns an FreedomResult<Status> object, which can be either:
Success: Contains a Status object.
Error: Specifies the type of error that occurred.

Make Clearing Payment#

This method is specifically designed for merchants who have auto-clearing disabled in their SDK configuration. Auto-clearing can be managed via the autoClearing property within the OperationalConfiguration of your SdkConfiguration.
 Use the makeClearingPayment method to explicitly initiate the clearing (final capture) of funds for a previously authorized payment. This method gives you the flexibility to clear an amount that may be different from the original amount specified when the payment was created (e.g., for partial captures).
 This method takes these parameters:
ParameterTypeDescriptionConstraints/Notes
paymentIdLongUnique identifier of the payment you want to clear.
amountFloat?Amount to be cleared. If null, the full amount of the original authorized payment will be cleared.Optional. Defaults to null. Must be between 0.01 and 99999999.00 if provided. Cannot exceed the authorized amount.
onResult(FreedomResult<ClearingStatus>) -> UnitCallback function that will be invoked with the result of the clearing operation. See ClearingStatus model.
 The process returns an FreedomResult<ClearingStatus> object, which can be either:
Success: Contains a ClearingStatus object.
Error: Specifies the type of error that occurred.

Make Cancel Payment#

This method is specifically designed for merchants who have auto-clearing disabled in their SDK configuration. Auto-clearing can be managed via the autoClearing property within the OperationalConfiguration of your SdkConfiguration.
 Use the makeCancelPayment method to reverse an authorized payment, effectively unblocking the amount on the customer's card. This ensures that the funds will not be charged.
 This method takes these parameters:
ParameterTypeDescription
paymentIdLongUnique identifier of the payment you want to cancel.
onResult(FreedomResult<PaymentResponse>) -> UnitCallback function that will be invoked with the result of the cancellation attempt. See PaymentResponse model.
 The process returns an FreedomResult<PaymentResponse> object, which can be either:
Success: Contains a PaymentResponse object.
Error: Specifies the type of error that occurred.

Make Revoke Payment#

 The makeRevokePayment method allows you to process a full or partial refund for a completed payment.
 This method takes these parameters:
ParameterTypeDescriptionConstraints/Notes
paymentIdLongUnique identifier of the payment you want to revoke (refund).
amountFloat?Amount of funds to return. If null, the full amount of the original debited payment will be refunded.Optional. Defaults to null. Must be between 0.01 and 99999999.00 if provided. Cannot exceed the authorized amount.
onResult(FreedomResult<PaymentResponse>) -> UnitCallback function that will be invoked with the result of the refund process. See PaymentResponse model.
 The process returns an FreedomResult<PaymentResponse> object, which can be either:
Success: Contains a PaymentResponse object.
Error: Specifies the type of error that occurred.

Add New Card#

 The addNewCard method facilitates the secure tokenization and addition of a new payment card to a customer's profile. This process allows future payments to be made without requiring the customer to re-enter their card details.
This method requires that a PaymentView has been set using freedomApi.setPaymentView() prior to calling it, as it will display a web-based form within the PaymentView for the customer to securely enter their card details.
 This method takes these parameters:
ParameterTypeDescriptionConstraints/Notes
userIdStringIdentifier for a user to associate this new card with.Must contain 1-50 characters. Also, must match regex ^[a-zA-Z0-9_-]+$.
orderIdString?Unique identifier for this order within your system.Optional. Defaults to null. Must contain 1-50 characters.
onResult(FreedomResult<PaymentResponse>) -> UnitCallback function that will be invoked upon the completion of the card addition process. See PaymentResponse model.
 The process returns an FreedomResult<PaymentResponse> object, which can be either:
Success: Contains a PaymentResponse object.
Error: Specifies the type of error that occurred.

Get Added Cards#

 The getAddedCards method allows you to retrieve a list of payment cards that have been previously added and tokenized for a specific user.
 This method takes these parameters:
ParameterTypeDescriptionConstraints/Notes
userIdStringIdentifier of the user whose added cards you wish to retrieve.Must contain 1-50 characters. Also, must match regex ^[a-zA-Z0-9_-]+$.
onResult(FreedomResult<List<Card>>) -> UnitCallback function that will be invoked upon the completion of the card retrieval operation. See Card model.
 The process returns an FreedomResult<List<Card>> object, which can be either:
Success: Contains a list of Card objects.
Error: Specifies the type of error that occurred.

Remove Added Card#

 removeAddedCard method allows you to securely remove a previously tokenized payment card associated with a specific user.
 This method takes these parameters:
ParameterTypeDescriptionConstraints/Notes
userIdStringIdentifier of the user from whom the card will be removed.Must contain 1-50 characters. Also, must match regex ^[a-zA-Z0-9_-]+$.
cardTokenStringUnique token of the card to be removed. This token is obtained when the card is added (via addNewCard or retrieved using getAddedCards.Must contain 1 or more characters.
onResult(FreedomResult<RemovedCard>) -> UnitCallback function that will be invoked upon the completion of the card removal operation. See RemovedCard model.
 The process returns an FreedomResult<RemovedCard> object, which can be either:
Success: Contains a RemovedCard object.
Error: Specifies the type of error that occurred.

Create Card Payment#

 The createCardPayment method is used to initiate a payment using a previously tokenized (saved) card.
A payment initiated with createCardPayment is a two-stage process. After successfully calling this method, the created payment must be confirmed using either the confirmCardPayment or confirmDirectPayment method to finalize the transaction.
 This method takes these parameters:
ParameterTypeDescription
paymentRequestTokenizedPaymentRequestEssential details required to initiate a new payment with previously tokenized card. See TokenizedPaymentRequest model.
onResult(FreedomResult<PaymentResponse>) -> UnitCallback function that will be invoked with the result of the payment initiation. See PaymentResponse model.
 The process returns an FreedomResult<PaymentResponse> object, which can be either:
Success: Contains a PaymentResponse object.
Error: Specifies the type of error that occurred.

Confirm Card Payment#

 The confirmCardPayment method is used to finalize a payment that was previously initiated with a saved card using createCardPayment.
This method requires that a PaymentView has been set using freedomApi.setPaymentView() prior to calling it, as it will display a web-based form within the PaymentView for CVC entry and 3DS authentication.
 This method takes these parameters:
ParameterTypeDescription
paymentIdLongUnique identifier of the payment to confirm. This paymentId is obtained from the createCardPayment method.
onResult(FreedomResult<PaymentResponse>) -> UnitCallback function that will be invoked upon the completion of the payment process. See PaymentResponse model.
 The process returns an FreedomResult<PaymentResponse> object, which can be either:
Success: Contains a PaymentResponse object.
Error: Specifies the type of error that occurred.

Confirm Direct Payment#

 The confirmDirectPayment method is used to finalize a payment that was previously initiated with a saved card using createCardPayment. Unlike confirmCardPayment, it does not open PaymentView: the client does not enter the CVC.
 This method takes these parameters:
ParameterTypeDescription
paymentIdLongUnique identifier of the payment to confirm. This paymentId is obtained from the createCardPayment method.
onResult(FreedomResult<PaymentResponse>) -> UnitCallback function that will be invoked with the result of the payment process. See PaymentResponse model.
 The process returns an FreedomResult<PaymentResponse> object, which can be either:
Success: Contains a PaymentResponse object.
Error: Specifies the type of error that occurred.

Google Pay Integration#

 These methods facilitate integrating Google Pay into your application through the SDK. Our SDK's methods bridge your Google Pay implementation with our payment gateway, handling the transaction processing.
 Before you begin, register your app with Google: see step 1.
1. Registering your app with Google
2. Integrating the Google Pay SDK into your project
3. Initialization of PaymentsClient and PayButton
4. Getting a Google Pay Token
5. Paying with Google Pay

1. Registering your app with Google#

Before you can accept real Google Pay payments, register the app in the Google Pay & Wallet Console and get production access from Google. Until Google approves the app, Google Pay works only in the test environment.
Before you start, make sure that:
your app is published in Google Play under the same Google account that you use in the console: the console shows only these apps;
Google Pay already works in your app in the test environment (WalletConstants.ENVIRONMENT_TEST): Google asks for screenshots of the payment flow.
1.
Open the Google Pay & Wallet Console and sign in with your Google account.
2.
Choose Merchant as the business type and fill in the business profile.
3.
Open the Google Pay API tab, click Get Started and accept the Terms of Service and the Acceptable Use Policy.
4.
Go to Google Pay API > Integrations > Integrate with your Android app, find your app and click Manage.
If the app is not in the list: open Users, click Invite a user and add the owner or administrator of the app's Google Play Developer account. Then sign in as this user.
5.
In Integration type, select Gateway: the payments go through Freedom Pay.
6.
Upload screenshots of the payment flow in your app:
item selection (product or service screen);
pre-purchase screen (order confirmation);
payment method selection with the Google Pay button;
Google Pay payment sheet;
post-purchase screen (receipt or success message).
7.
Click Save, then Submit for approval, and wait for the reply of the Google onboarding team. Google does not state a fixed review time.
8.
After Google approves the app, switch PaymentsClient to WalletConstants.ENVIRONMENT_PRODUCTION (see step 3) and make a payment with a real card.

2. Integrating the Google Pay SDK into your project#

 After registering, integrate the Google Pay SDK into your app by adding the following dependency to your build.gradle.kts file:
 Next, update your AndroidManifest.xml to enable the Google Pay API:
<application>
    ...
    <!-- Enables the Google Pay API -->
    <meta-data android:name="com.google.android.gms.wallet.api.enabled"
        android:value="true" />
</application>
 Add PayButton to your XML layout file where you want it to appear:
<com.google.android.gms.wallet.button.PayButton
    android:id="@+id/buttonPaymentByGoogle"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    />

3. Initialization of PaymentsClient and PayButton#

 To initialize the payment button and the Google Pay PaymentsClient in your activity:
 The Wallet.getPaymentsClient method is used to get an instance of PaymentsClient. It has the following environments:
ParameterValue
ENVIRONMENT_PRODUCTIONProduction environment
ENVIRONMENT_TESTTest environment

4. Getting a Google Pay Token#

Step 4.1. Launch Google Pay#

 When the user taps the Google Pay button, request payment data from Google Pay. No SDK call is needed at this step: the SDK is called once Google Pay returns the token (see Step 4.3).
createPaymentDataRequest() is a method that returns a PaymentDataRequest object. This object defines the parameters and requirements for the payment data request, such as payment methods, shipping address, and more.
loadPaymentData() initiates an asynchronous task to load payment data using the provided request.
AutoResolveHelper.resolveTask<PaymentData>()is used to handle the payment data loading task.
REQUEST_CODE is a request code used to identify the result of the task in the onActivityResult method.

Step 4.2. createPaymentDataRequest() implementation#

 Here is an example implementation of createPaymentDataRequest():
PaymentDataRequest.newBuilder() creates a new builder for the payment data request.
setTransactionInfo() sets transaction information, such as the total payment amount and currency code.
PaymentMethodTokenizationParameters.newBuilder() creates a builder for the payment method tokenization parameters.
setPaymentMethodTokenizationType() sets the tokenization type (e.g., a payment gateway).
addParameter() adds parameters for the payment gateway, such as gateway and gatewayMerchantId.
setPaymentMethodTokenizationParameters() sets the tokenization parameters in the payment data request.

Step 4.3. Handling the onActivityResult#

 The result of the Google Pay task is handled in the onActivityResult method:
onActivityResult is used to handle the results returned by the Google Pay integration activity.
data is the object containing the data returned by the activity.
Activity.RESULT_OK indicates the successful completion of the operation.
AutoResolveHelper.RESULT_ERROR indicates that an error occurred while resolving the request.

5. Paying with Google Pay#

 The payWithGooglePay method is the final step in processing a Google Pay payment with the SDK. After you have obtained the Google Pay token (see Step 4.3), pass it to this method together with the payment details.
This method requires a PaymentView set with freedomApi.setPaymentView() before the call: see Integrating the PaymentView.
If the bank requires 3-D Secure, the SDK shows the bank's page in the PaymentView.
Without a PaymentView, the payment fails with PaymentViewIsNotInitialized.
 This method takes these parameters:
ParameterTypeDescription
paymentRequestStandardPaymentRequestEssential details required to make a payment. amount and currency must match the ones in your Google Pay request. See StandardPaymentRequest model.
tokenStringEncrypted payment token received from the Google Pay API. This token contains the sensitive card data securely.
force3DSBooleanOptional. Defaults to false. Set to true to require 3-D Secure for this payment.
onResult(FreedomResult<PaymentResponse>) -> UnitCallback function that will be invoked with the final result of the Google Pay payment. See PaymentResponse model.
 The process returns a FreedomResult<PaymentResponse> object, which can be either:
Success: Contains a PaymentResponse object. Check its status:
Success: the payment is completed.
Error: the payment was declined (for example, 3-D Secure failed). The code and description explain why.
Any other status: the payment is not final yet, for example the user closed the 3-D Secure page before the bank responded. Check the final status later with getPaymentStatus.
Error: Specifies the type of error that occurred.
3-D Secure: the SDK shows the PaymentView with the bank's page and hides it once the payment gets a final status. There is no time limit for the user to complete it.
To let the user cancel 3-D Secure (for example, on a Back press), hide the PaymentView (paymentView.visibility = View.GONE). The SDK then returns the latest known status.
If the call returns FreedomResult.Error.NetworkError, the payment may still have been made. Check its status by orderId before letting the user pay again. Always set orderId in StandardPaymentRequest.

Error Handling and Results#

 All asynchronous operations in the SDK (methods with an onResult callback) return their outcome encapsulated within a FreedomResult sealed interface.
 The FreedomResult interface has two primary states: Success for successful completion and Error for any failures.

FreedomResult.Success<T>#

Description: Represents a successful completion of the SDK operation.
value: T: Holds the actual result data of the operation. The type T will vary depending on the specific method called (e.g., PaymentResponse, List<Card>, Status).

FreedomResult.Error Sub-Types#

 The Error interface is a sealed hierarchy itself, providing distinct types of errors for more precise handling.

1. ValidationError#

 Indicates that one or more inputs provided to the SDK method were invalid or did not meet specified constraints (e.g., amount out of range, userId format mismatch).
errors: List<ValidationErrorType>: A list detailing all specific validation errors that occurred. For a comprehensive list of types, refer to the ValidationErrorType table.

2. PaymentInitializationFailed#

 Indicates a general failure during the initial setup or preparation of a payment, before it reaches the transaction processing stage.

3. Transaction#

 Represents an error encountered by the payment gateway during the transaction processing (e.g., card declines, insufficient funds, 3D Secure failures).
errorCode: Int: A numerical code representing a specific transaction error. You can find an up-to-date reference of error codes here.
errorDescription: String?: A human-readable description of the transaction error, if available.

4. NetworkError#

 Represents errors related to network connectivity or API responses. This is a sealed interface with several specific network error types:
Protocol: Indicates an issue with the communication protocol or an unexpected response from the API.
code: Int: An HTTP status code or an internal protocol error code.
body: String?: The raw response body or a human-readable description of the protocol error, if available.
Connectivity: Indicates problems related to the device's network connection. This sealed interface includes the following specific errors:
ConnectionFailed: The network connection could not be established.
ConnectionTimeout: The network request timed out.
Integrity: An issue with the integrity of the network connection (e.g., SSL/TLS certificate issues).
Unknown: A general network error occurred that does not fall into more specific categories.

5. InfrastructureError#

 Represents errors related to the internal state, configuration, or core components of the SDK. This is a sealed interface with several specific infrastructure error types:
SdkNotConfigured: The SDK is not configured.
SdkCleared: The SDK methods were called after freedomApi.clear(), which clears the SDK state and stops further operations.
ParsingError: An error occurred while parsing data (e.g., a response from the server could not be deserialized).
WebView: Errors specifically related to the internal WebView component used for displaying payment pages or frames. This sealed interface includes the following specific errors:
PaymentViewIsNotInitialized: A method requiring PaymentView was called, but freedomApi.setPaymentView() has not been called or the view is not ready.
Failed: A general error occurred during the payment process within the WebView, without a more specific cause.

Data Structures#

 This section provides detailed descriptions of the data classes and enums used throughout the SDK, particularly in the results of various method calls.

StandardPaymentRequest Structure#

 The StandardPaymentRequest data class encapsulates the essential details required to initiate a new payment transaction.
ParameterTypeDescriptionConstraints/Notes
amountFloatTotal amount of the payment.Must be between 0.01 and 99999999.00.
currencyCurrency?Currency of the payment. See Currency enum for available options.Optional. Defaults to null.
descriptionStringDescription of the payment.
userIdString?Identifier for the user making the payment.Optional. Defaults to null. Must contain 1-50 characters. Also, must match regex ^[a-zA-Z0-9_-]+$.
orderIdString?Unique identifier for this payment order within your system.Optional. Defaults to null. Must contain 1-50 characters.
extraParamsHashMap<String, String>?Optional map of additional key-value pairs to pass custom data with the payment.Optional. Defaults to null.

TokenizedPaymentRequest Structure#

 The TokenizedPaymentRequest data class is used to create payments with a previously saved and tokenized card, requiring the card's unique token along with standard payment details.
ParameterTypeDescriptionConstraints/Notes
amountFloatTotal amount of the payment to be charged to the saved card..Must be between 0.01 and 99999999.00.
currencyCurrency?Currency of the payment. See Currency enum for available options.Optional. Defaults to null.
descriptionStringDescription of the payment.
cardTokenStringUnique token representing the saved card that will be used for this payment. This token is obtained from addNewCard or getAddedCards.Must contain 1 or more characters.
userIdStringIdentifier for the user making the payment.Must contain 1-50 characters. Also, must match regex ^[a-zA-Z0-9_-]+$.
orderIdStringUnique identifier for this payment order within your system.Must contain 1-50 characters.
extraParamsHashMap<String, String>?Optional map of additional key-value pairs to pass custom data with the payment.Optional. Defaults to null.

PaymentResponse Structure#

 The PaymentResponse data class represents the result of a payment operation: the payment IDs and the status, including Error.
PropertyTypeDescription
statusPaymentResponse.StatusStatus of the operation.
paymentIdLongUnique identifier for this payment.
merchantIdStringID of the merchant associated with the payment.
orderIdString?Order ID provided during payment creation.
PropertyTypeDescription
Newdata objectPayment has been created but no processing has started yet.
Waitingdata objectPayment is pending further action or confirmation.
Processingdata objectPayment is actively being handled by the system or provider.
Incompletedata objectIndicates that the payment was initiated but did not reach a final state within the allotted time.
Successdata objectPayment was completed successfully and funds have been confirmed.
Unknown(val value: String)data classStatus value is not recognized by the SDK, possibly due to a new or unexpected status from the backend.
Error(val code: String, val description: String)data classPayment failed, with an error code and description available for diagnosis.

Status Structure#

 Provides comprehensive details about the current state of a payment.
PropertyTypeDescription
statusStringResult of the request: always ok. An error is returned as FreedomResult.Error.
paymentIdLongUnique identifier for this payment.
orderIdString?Order ID provided during payment creation.
currencyStringCurrency code of the payment.
amountFloatOriginal amount of the payment.
canRejectBoolean?Indicates if the payment can still be cancelled.
paymentMethodString?Payment method, for example bankcard or mobile_commerce; none if the client has not chosen it yet.
paymentStatusString?Status of the payment: new, waiting, process, success or error. See Get payment status.
clearingAmountFloat?Total amount that has been cleared (captured) for this payment.
revokedAmountFloat?Total amount that has been cancelled for this payment.
refundAmountFloat?Total amount that has been refunded.
cardNameString?Name on the card used for the payment.
cardPanString?Masked Primary Account Number (PAN) of the card.
revokedPaymentsList<RevokedPayment>?List of individual cancelled transactions associated with this payment.
refundPaymentsList<RefundPayment>?List of individual refund transactions associated with this payment.
referenceLong?System-generated reference number for the payment.
capturedBoolean?Indicates if the funds for the payment have been captured.
createDateStringDate and time when the payment was created.
authorizationCodeString?Authorization code for the payment, including alphanumeric values.
authCodeInt?Deprecated numeric authorization code. Use authorizationCode instead.
failureCodeString?Code indicating why the payment failed.
failureDescriptionString?Human-readable reason for the payment failure.
lastTransactionInfoLastTransactionInfo?Details of the most recent transaction associated with this payment.

RevokedPayment Structure#

 Details of an individual cancelled transaction.
PropertyTypeDescription
paymentIdLong?ID of the cancelled payment.
paymentStatusString?Status of the cancel operation: success, process or error.

RefundPayment Structure#

 Details of an individual refund transaction.
PropertyTypeDescription
paymentIdLong?ID of the refund payment.
paymentStatusString?Status of the refund operation: success, process or error.
amountFloat?Amount that was refunded in this transaction.
paymentDateString?Date and time of the refund.
referenceLong?System-generated reference number for the refund.

LastTransactionInfo Structure#

 Details of the most recent transaction associated with this payment
PropertyTypeDescription
statusStringStatus of the last transaction: waiting, process, success, error or incomplete.
failureCodeString?Code indicating why the transaction failed.
failureDescriptionString?Human-readable reason for the transaction failure.

ClearingStatus Structure#

 Represents the status of a clearing operation.
TypeDescription
Success(val amount: Float)Indicates that the clearing operation was successful. amount: The amount that was successfully cleared.
ExceedsPaymentAmountIndicates that the requested clearing amount exceeded the originally authorized payment amount.
FailedIndicates that the clearing operation failed.

Card Structure#

 Represents a single tokenized payment card associated with a user.
PropertyTypeDescription
statusString?Status of the operation.
merchantIdString?ID of the merchant.
recurringProfileIdString?ID assigned to a user's recurring payment profile
cardTokenString?Token used to reference this card for future payments.
cardHashString?Masked Primary Account Number (PAN) of the card.
createdAtString?Date and time when the card was added.

RemovedCard Structure#

 Represents the outcome of an attempt to remove a stored card.
PropertyTypeDescription
statusString?Status of the operation.
merchantIdString?ID of the merchant.
cardHashString?Masked Primary Account Number (PAN) of the card.
deletedAtString?Date and time when the card was deleted.

ValidationErrorType Structure#

Enum ConstantDescription
INVALID_MERCHANT_IDProvided merchant ID is invalid or missing.
INVALID_SECRET_KEYProvided secret key is invalid or missing.
INVALID_PAYMENT_AMOUNTPayment amount is outside the allowed range (0.01 - 99999999.00).
INVALID_ORDER_IDProvided order ID does not meet the specified length constraints.
INVALID_USER_IDProvided user ID does not meet the specified format or length constraints.
INVALID_CARD_TOKENProvided card token does not meet the specified length constraints.

Currency Structure#

 The Currency enum defines all supported currency codes that can be used when specifying payment amounts.
Enum ConstantDescription
KZTKazakhstani tenge.
RUBRussian ruble.
USDUS dollar.
UZSUzbek sum.
KGSKyrgyzstani som.
EUREuro.
HKDHong Kong dollar.
GBPBritish pound.
AEDUnited Arab Emirates dirham.
CNYChinese yuan.
KRWSouth Korean won.
INRIndian rupee.
THBThai baht.
UAHUkrainian hryvnia.
AMDArmenian dram.
BYNBelarusian ruble.
PLNPolish złoty.
CZKCzech koruna.
AZNAzerbaijani manat.
GELGeorgian lari.
TJSTajikistani somoni.
CADCanadian dollar.
MDLMoldovan leu.
TRYTurkish lira.

Support#

If you find an inaccuracy in the documentation or need help with the integration, write to support@freedompay.kz.
For connection and merchant settings, contact your account manager.
Previous
JS SDK
Next
iOS