Freedom Pay
  1. Freedom QR
Freedom Pay
  • Gateway API
    • Introduction
    • Reference
      • Test cards
      • Error codes
    • Sync API
      • Introduction
      • Page
        • Introduction
        • Page
        • Page with amount control
        • Status
      • Pay
        • Introduction
        • Card
        • 3DSecure
        • Cancel
        • Clearing
        • Refund
        • Status
      • Payout
        • Introduction
        • Card
        • IBAN
        • Balance
        • Status
        • StatusV2
      • Transfer
        • Introduction
        • Card
        • 3DSecure
        • Rates
        • Status
      • Card
        • Introduction
        • Add
        • 3DSecure
        • List
        • Remove
        • Status
      • Token
        • Introduction
        • Token Pay
        • Apple Pay
        • Google Pay
        • Samsung Pay
        • Token Payout
        • Status
    • Async API
      • Introduction
      • create
        • create payment
        • create payment recurrent
      • read
        • read payment
        • read request
      • edit
        • edit payment.refund
        • edit payment.reverse
        • edit payment.clearing
      • delete
  • Merchant API
    • Introduction
    • Reference
      • Test cards
      • Test phone numbers
      • Error codes
    • Page
      • Introduction
      • Page
      • Page with amount control
      • Payout page
      • Frame
      • Widget
      • Status
    • Pay
      • Introduction
      • Cancel
      • Clearing
      • Refund
      • Status
    • Payout
      • Introduction
      • IBAN
      • Balance
      • Status by order_id
      • Status by Payment ID
      • Status by Payment ID V2
    • Mobile balance
      • Introduction
      • Init
      • Pay
      • Approve
      • Resend code
      • Status
    • Card
      • Introduction
      • Add
      • Add for payout
      • Remove
      • List
      • Status
    • Token
      • Introduction
      • Saved card with CVC input (Init)
      • Saved card with CVC input (Pay)
      • Non-acceptance payments
      • Non-acceptance payments (Pay)
      • Token payout
      • Status
    • Invoice
      • Introduction
      • Init
      • Info
      • Pay
      • Status
    • Additional
      • Introduction
      • Check request
      • Result notify
      • Payout notify
      • Redirect back
  • Card API
    • Introduction
    • Payment Cards
      • Reference
        • Request Status
        • Client product
        • Card product
        • Card status
        • Card block
        • Transaction
        • Error codes
      • Card issue
        • Bulk
        • Single
        • Physical
      • Card control
        • Activate
        • Block
        • Unblock
        • Set PIN
        • Reset PIN counter
        • Close
        • Identification
        • Info
        • Balance
        • Secret data
        • Statement
      • Client
        • Create
        • Edit
        • Card list
      • Additional
        • Request status
    • Gift Cards
      • Introduction
      • Reference
        • Request status
        • Card status
      • List
      • Issue
      • Confirm
      • Resend
      • Resend code
      • Status
  • Partner API
    • Rates
      • Introduction
      • Rates
    • Products
      • Introduction
      • Reference
        • Request
        • Product
        • Freedom POS
        • Freedom ECOM
        • Freedom BOX
        • Limits
      • Add user
      • Add product
      • Add user with product
      • Grant user
      • Send auth data
      • Request status
    • E-Money
      • Introduction
      • Reference
        • Request
        • Operation
        • Error codes
      • Add
      • Owner identification
      • Info
      • Close
      • Block
      • Balance
      • Statement
      • Request Status
    • Freedom ID
      • Introduction
      • Android SDK
      • iOS SDK
      • Reference
        • Error codes
      • Link
      • Token
      • Token refresh
      • Info
      • Profile
      • Request
  • Mobile SDK
    • Payment SDK
      • iOS
      • Android
    • Freedom QR
      • Reader SDK (Android)
      • Provider SDK (Android)
  • CMS
    • Introduction
    • Get Merchant ID and key
    • WordPress
      • Introduction
      • Installation
      • Configuration
      • Test
      • Live payments
      • Update
    • Tilda
      • Introduction
      • Installation
      • Configuration
      • Test
      • Live payments
    • InSales
      • Introduction
      • Installation
      • Configuration
      • Test
      • Live payments
    • Ecwid
      • Introduction
      • Installation
      • Configuration
      • Test
      • Live payments
    • Bitrix
      • Introduction
      • Installation
      • Configuration
      • Test
      • Live payments
    • PrestaShop
      • Introduction
      • Installation
      • Configuration
      • Test
      • Live payments
    • OpenCart
      • Introduction
      • Installation
      • Configuration
      • Test
      • Live payments
  1. Freedom QR

Reader SDK (Android)

Freedom QR Reader Android SDK#

 Freedom QR Reader is an SDK for scanning payment QR codes and interacting with the Freedom Pay API.
Link to the repository with the test application
Preliminary Steps
Requirements
Installation
Integration
Getting Started
Initializing Requests
Error Information
Adding card view
Scanner view
Retrieving the List of Tokenized Cards
Adding a Tokenized Card
Removing a Tokenized Card
Retrieving Payment Status
Payment with tokenized card
Support

Preliminary Steps#

 After creating and connecting the merchant in your personal account, you will receive a Merchant_ID and Secret_key, which are required to interact with the SDK.

Requirements#

 To use the QR Provider SDK, Android version 5.0 (API level 24) or higher is required.

Installation#

 To add the SDK, include the following line to the build.gradle file of your root project:
 Also, add the following line to your project's build.gradle:
version - current SDK version.

Integration#

Getting Started#

 All necessary interactions within the library occur exclusively through the FreedomQrClient class.
 To initialize the SDK in your fragment or activity, you need to create an object:
secretKey: String - The secret key provided when connecting the merchant in the personal account.
merchantId: String - A unique identifier assigned to the merchant after creating the account.

Initializing Requests#

 After creating the SDK object, it is necessary to study the main structure of parameters for initializing requests, which consists of params and callbacks.
sdkObject - The SDK object that has been initialized.
methodName - The name of the method that was called by the user.
 Request Parameters
ParameterDescription
paramsOne or more parameters that need to be passed to the user for making the request.
onResultReturns the execution result object <T>.
onErrorReturns an ErrorResponse object, which provides information about the error.
onFailureReturns an Exception object, which provides information about the request sending error.

Error Information#

ErrorResponse - an object that provides information about the server error:
FieldDescription
codeThe error code returned from the server. The main error codes can be found in the documentation.
messageThe error message.

Adding card view#

 To add a tokenized card to the Freedom Pay system, you need to use the custom view AddCardView, which should be added to your fragment or activity XML file. AddCardView is a webview where the card addition page will open.
 Example of adding AddCardView:
<money.freedompay.qrclient.api.ui.AddCardView
    android:id="@+id/addCardView"
    android:layout_width="match_parent"
    android:layout_height="match_parent"/>
 After adding it to the XML, you need to pass your view to the SDK:
 To track the progress of the card linking or the returned result, a public interface AddCardViewListener is available. You need to override this interface in your fragment or activity and pass it to your AddCardView:
this refers to the AddCardViewListener interface, which includes the following methods:
 Start of the card addition page loading
 End of the card addition page loading
 Result of card addition
isSuccess indicates the success of the card addition result.

Scanner view#

 To scan the payment QR code and process the payment, you need to use the custom view FreedomQRScannerView, which should be added to your fragment or activity XML file. FreedomQRScannerView is a camera screen used for scanning the QR code.
 Example of adding FreedomQRScannerView:
<money.freedompay.qrclient.api.ui.FreedomQRScannerView
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    app:isVibrationAfterScanning="true"/>
 Successful scanning of the QR code is accompanied by a vibration signal, controlled by the special attribute isVibrationAfterScanning.
ResultDescription
trueVibration signal present
falseVibration signal absent
 To control the camera state, such as enabling and disabling it, you need to call the corresponding methods in your fragment or activity.
 Enabling the camera:
 Disabling the camera:
 To track the status of a successful QR code scan or the returned result, public interfaces ResultHandler and ErrorHandler are available.
ResultHandler is a public interface that returns the result of the QR code scan. To use this method, it must be overridden in your fragment or activity.
this refers to the ResultHandler interface, which has the following method:
result: String - the result of scanning the QR code.
ErrorHandler is a public interface that provides a callback for errors, which you can override as needed. To use this method, you need to override it in your fragment or activity.
 this refers to the ErrorHandler interface, which contains the following method:
NOTE
For proper functionality of the QR code scanning view, it is necessary to grant access to android.permission.CAMERA in your fragment or activity.
The result of scanning the QR code is the customerId field, which is required to get the status of the invoice or pay the invoice.

Retrieving the List of Tokenized Cards#

 To get the list of tokenized cards, you need to call the method sdk.getTokenizedCardList.
 You must pass the following parameter to the method:
userId: String - the unique user identifier in the merchant's system.
 Example of calling the method to get the list of tokenized cards:
 As a result of successfully calling the method to get the list of tokenized cards, the onResult callback will return an object TokenizedCardResponse, containing a list of cards:
FieldDescription
List<TokenizedCardDetailResponse> listList of tokenized cards
The card list is a collection of objects from the class TokenizedCardDetailResponse, containing the following fields:
FieldDescription
statusDisplays the status of the card
cardTokenUnique identifier of the card
cardHashMasked PAN of the card
If no tokenized cards have been added to the Freedom Pay system, the server will also respond with TokenizedCardResponse, where the card list will be empty

Adding a Tokenized Card#

 Adding a tokenized card to the Freedom Pay system is done on the add card page. Once your AddCardView is passed to the SDK, you need to call the method sdk.initAddingCard.
 The method also requires the following parameters:
userId: String - Unique identifier of the user in the merchant's system.
postLink: String - An optional field representing the URL to receive the result notification.
 Example of calling the method to add a tokenized card:
 As a result of a successful method call, the AddCardView will open the card addition page in the webView, where you need to enter the card details to add the card.
 After successfully filling in the card details, you need to confirm the entered data and submit the information.
There is no onResult callback in the method for initializing the addition of the card sdk.initAddingCard, because the result of adding the card can be tracked through the interface method AddCardViewListener
 Result of adding the card:
ResultDescription
trueThe card was successfully added
falseFailed to add the card

Removing a Tokenized Card#

 To remove a tokenized card, you need to call the method sdk.removeTokenizedCard.
 The method requires the following parameters:
userId: String - unique user identifier in the merchant's system.
tokenCard: String - unique card identifier, which can be obtained in the request for retrieving the list of tokenized cards.
 Example of calling the method to remove a tokenized card:
 As a result of successfully calling the method to remove a tokenized card, the onResult callback will return an object of TokenizedCardResponse, similar to when retrieving the list of cards. The status field of the card will be updated.

Retrieving Payment Status#

 To retrieve the payment status, the following methods are available:
Retrieve the payment status by customerId: String – a unique identifier displayed when initializing payment via QR code generation, which can be obtained when scanning the payment QR code.
Retrieve the payment status by url: Url – a unique URL scanned from the QR code.
 To retrieve the payment status, you need to call the sdk.getPaymentStatus method and pass either the customerId or url.
 Example of calling the method to retrieve the status by customerId:
 To call the method for retrieving the status by url, you need to scan the QR code, obtain the unique link, initialize a Url object, and pass it as a parameter to the method:
url – is an object that accepts a field of type String.
link - is the unique URL obtained when scanning the merchant's payment QR code.
 Example of calling the method to get the status by url:
 As a result of successfully calling the method to get the payment status, the onResult callback will return an object PaymentStatusResponse, containing the following fields:
FieldDescription
amountThe amount of the payment in the currency specified in currency
orderIdThe order ID in the merchant's system
invoiceStatusThe status of the invoice
invoiceIdThe unique invoice ID in the Freedom Pay system
cardPanThe masked PAN of the card
descriptionA description of the product or service
currencyThe currency in which the payment will be made
dtThe date and time of the request in the format YYYY-MM-DDThh:mm:ss±hh:mm
 The invoice status invoiceStatus can have different states:
ValueDescription
newA new invoice has been created
processAwaiting payer or payment system response
okThe invoice has been successfully paid
failedPayment failed
incompleteThe invoice has expired

Payment with tokenized card#

 To pay the invoice using a tokenized card, you must scan the payment QR code, from which you will get the customerId field needed to make the payment. Additionally, you should call the method sdk.payByCard.
 The method requires the following parameters:
customerId: String - a unique identifier that appears when the payment is initialized through QR code generation, and which can be obtained when scanning the payment QR code.
userId: String - a unique identifier for the user in the merchant's system.
tokenCard: String - a unique card identifier, which can be obtained in the request to get the list of cards.
If you don't have any tokenized cards added to the Freedom Pay system, you will first need to add a card. This can be done using the add card method.
 Example of calling the method to pay the invoice.
 As a result of a successful method call, the same object as when receiving the invoice status, PaymentStatusResponse, will be returned in the onResult callback.
The main difference in the PaymentStatusResponse model is that the invoiceStatus field will change the status of the invoice.

Support#

If you have questions or need help, feel free to reach out! 👋
Email: support@freedompay.uz
Previous
Android
Next
Provider SDK (Android)