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

Provider SDK (Android)

Freedom QR Provider SDK#

 Freedom QR Provider - An SDK for generating payment QR codes and interacting with the Freedom Pay API.
Preliminary Steps
Requirements
Installation
Integration
Getting Started
Initializing Requests
Error Information
Receiving the payment QR code
Getting Payment Status
Payment Cancellation
Payment Refund
Support

Preliminary Steps#

 To start working with the QR Provider SDK as a partner, submit the form to create a merchant account.
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 FreedomQrProvider 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.
region: Region – an enum parameter that specifies the regional domain for forming API requests. Supported values:
Region.KZ – Kazakhstan
Region.UZ – Uzbekistan
Region.KG – Kyrgyzstan.
By default,Region.KZ is used.

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.

Receiving the payment QR code#

 To retrieve the payment QR code, you need to call the sdk.getQR method.
 You also need to pass the following parameters to the method:
orderId: String - The payment identifier in the merchant's system. It is recommended to ensure the uniqueness of this field.
amount: Double - The payment amount in the currency.
description: String - A description of the product or service. It will be displayed to the customer during the payment process.
currency: String - The currency in which the amount is specified. Example: KZT, USD, EUR.
 Example of calling the method to retrieve the payment QR code:
 As a result of a successful obtaining the payment QR code method call, the onResult callback will return an InitPaymentResponse object, containing the following fields:
FieldDescription
statusThe status of the request execution
invoiceStatusThe status of the invoice
errorCodeError code ID
errorDescriptionA textual description of the error
invoiceIdThe transaction identifier in the Freedom Pay system
invoiceMethodsThe object containing the payment methods requested by the merchant InvoiceMethods
dtDate and time of the request in the format YYYY-MM-DDThh:mm:ss±hh:mm
 The invoice status invoiceStatus can have various states:
ValueDescription
newA new invoice has been created
processWaiting for payer or payment system
okThe invoice has been successfully paid
failedPayment failed
incompleteInvoice expired
 The invoice method invoiceMethods is an InvoiceMethods object containing a single field:
FieldDescription
qrImage for displaying the payment QR code in Bitmap format
Also, note the onStatusChanged callback, which allows you to track the payment status of the QR code and return the status from the invoiceStatus field based on the payment result.
 To stop tracking the QR payment status, you need to override onPause or onDestroy in your fragment or activity and call the sdk.stopStatusUpdates() method.

The method call is only required if the onStatusChanged callback is being listened to.
 Example of calling the method to stop listening for the QR payment status:

Getting Payment Status#

 To obtain the payment status, the following methods are available:
Get the payment status by orderId: String – payment identifier in the merchant's system.
Get the payment status by invoiceId: Int – payment identifier in the Freedom Pay system.
 To retrieve the payment status, you need to call the method sdk.getPaymentStatus and pass one of the fields, either orderId or invoiceId.
 Example of calling the method to get the payment status by orderId:
 Example of calling the method to get the payment status by invoiceId:
 In the case of a successful call to one of the payment status methods, the onResult callback will return a PaymentStatusResponse object with the following fields:
FieldDescription
statusThe result of the request execution.
invoiceStatusThe status of the invoice.
invoiceIdThe unique identifier of the invoice in the Freedom Pay system.
errorCodeThe error code ID, if applicable.
errorDescriptionA textual description of the error, if applicable.
cardPanThe masked PAN (Primary Account Number) of the card used for payment.
cardTokenThe unique identifier of the card used for payment.
amountThe amount of payment in the currency specified in the currency field.
currencyThe currency used for the payment.
dtThe date and time of the request, in the format YYYY-MM-DDThh:mm:ss±hh:mm.

Payment Cancellation#

 To cancel a payment, you need to call the sdk.cancelPayment method.
 You also need to pass a single parameter to the method:
invoiceId: Int - the unique identifier of the payment transaction in Freedom Pay.
 Example of calling the method to cancel the payment:
 As a result of a successful payment cancellation method call, the callback onResult will return an OperationResultResponse object, which contains the following fields:
FieldDescription
statusStatus of the operation
 The status of the operation can have the following values:
ValueDescription
okSuccessful
errorError

Payment Refund#

 To refund a payment, you need to call the sdk.refundPayment method.
 The method requires two parameters:
invoiceId: Int - a unique identifier of the payment transaction in Freedom Pay.
refundAmount: Double - the amount to be refunded.
 Here’s an example of calling the method for a payment refund:
 In the case of a successful payment refund, the onResult callback will return the same object as in the payment cancellation operation: OperationResultResponse.

Support#

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