### Full Payment Request Example (Card) Source: https://docs.freedompay.kz/api-9587005 A complete example of a payment request using a card. It includes all mandatory fields such as amount, currency, description, order_id, auto_clearing, the 'from' object with card details, and device information. ```json { "amount": 100, "currency": "KZT", "description": "description", "order_id": "1234", "user_id": "12345", "auto_clearing": false, "from": { "type": "card", "card": { "name": "Test Test", "pan": "4400444400004440", "cvc": "123", "year": 30, "month": 5 } }, "device": { "user_ip": "84.252.158.239" } } ``` -------------------------------- ### Setup FreedomPay SDK with Public Key and Token Source: https://docs.freedompay.kz/doc-869917 After the SDK script is loaded, configure it by calling the `setup` method with your public key and token. These credentials are essential for authenticating your requests and can be obtained from your personal manager. ```javascript FreedomPaySDK.setup('mypublickey', 'mytoken'); ``` -------------------------------- ### Full Payment Request Example (Apple Pay) Source: https://docs.freedompay.kz/api-9587005 A complete example of a payment request using Apple Pay. It includes essential fields and specifies the tokenized payment method. ```json { "amount": 10, "currency": "KZT", "description": "applepay", "order_id": "apple1", "auto_clearing": false, "from": { "type": "tokenized", "token": { "type": "applepay" }, "card": { "pan": "4476-XXXX-XXXX-7601", "month": "XX", "year": "XX" } } } ``` -------------------------------- ### Full FreedomPay SDK Integration Example Source: https://docs.freedompay.kz/doc-869917 This comprehensive HTML and JavaScript example demonstrates a full integration of the FreedomPay SDK. It includes setting up the SDK, defining payment and transaction options, handling the `charge` request, managing the 3DS confirmation flow using `confirmInIframe`, and basic error handling. ```html
``` -------------------------------- ### Payment Example: Success Status Source: https://docs.freedompay.kz/api-9587007 Illustrates a payment object with the status 'success'. This example shows a fully processed payment, including clearing details, card information, and a record of a successful refund. ```json { "id": "01978d0e-b956-7ea2-9a42-32cff1f44ede", "status": "success", "amount": 100, "created_at": "2025-06-20T07:13:31.068188524Z", "order_id": "1234", "clearing": { "cleared": true, "amount": 100 }, "from": { "card": { "token": "01978d11-669e-7dd1-bf1b-75a12bf57ca9", "brand": "VI" } }, "refund_payments": [ { "id": "01978d53-4748-74c1-9c0a-0ca2b64b9c1b", "amount": -100, "status": "success" } ], "additional": { "approval_code": "95F69T", "reference": "1234567891234", "intreference": "AC1BFED11052BFAC" }, "3ds": { "acs_url": "", "flow_type": "F" } } ``` -------------------------------- ### Payment Example: Approved Status Source: https://docs.freedompay.kz/api-9587007 An example of a payment object with the status 'approved'. This includes details like the payment ID, amount, creation time, order ID, clearing status, card information, and additional approval data. ```json { "id": "01978d0e-b956-7ea2-9a42-32cff1f44ede", "status": "approved", "amount": 100, "created_at": "2025-06-20T07:13:31.068188524Z", "order_id": "1234", "clearing": { "cleared": false, "amount": 0 }, "from": { "card": { "token": "01978d11-669e-7dd1-bf1b-75a12bf57ca9", "brand": "VI" } }, "additional": { "approval_code": "95F69T", "reference": "1234567891234", "intreference": "AC1BFED11052BFAC" }, "3ds": { "acs_url": "", "flow_type": "F" } } ``` -------------------------------- ### Get Batch Statuses OpenAPI Specification Source: https://docs.freedompay.kz/api-24102332 This OpenAPI specification defines the GET endpoint for retrieving batch statuses. It details the required path parameter 'OrgnlMsgId', response structure including 'GrpHdr', 'OrgnlGrpInfAndSts', and 'OrgnlPmtInfAndSts', and provides an example XML response. ```yaml openapi: 3.0.1 info: title: '' description: '' version: 1.0.0 paths: /v5/partner/settlement-partitions/batch/{OrgnlMsgId}/status: get: summary: Batch statuses deprecated: false description: "| XML Tag | Type | Required | Description | Constraints | |----------------|---------|-------------|-------------|-------------| |**OrgnlMsgId**|string |+ |Identifier of the original message from `pain.001` | 1–35 characters, alphanumeric, may include hyphen (-) and underscore (_) |" tags: - Partner API/Account/Settlement parameters: - name: OrgnlMsgId in: path description: '' required: true schema: type: string responses: '200': description: "|Tag|Name |Description| |---|---|---| |**GrpHdr** | |\| Message ID |Unique message identifier| |\| Creation Date Time |Report creation date and time| |**OrgnlGrpInfAndSts** | |\| Original Message ID |Unique ID of the original request message (pain.001)| |\| Original Message Name ID |Indicates the type of the original message (e.g., pain.001.001.14)| |\| Group Status |Status of the batch (e.g., ACCP, RJCT, PART, PDNG)| |**OrgnlPmtInfAndSts** | |\| Original Payment Info ID |ID of the payment information section from pain.001| |\/\| End-to-End ID |Unique identifier of the individual payment instruction| |\/\| Transaction Status |Payment processing status (e.g., ACCP, RJCT, PDNG)| |\/\| Account Servicer Reference |Internal identifier assigned by the servicing bank to the transaction| " content: application/xml: schema: type: object properties: {} x-apidog-orders: - 01K9S7D62SPYQD20HX64RPF1P6 example: "{\r\n"status": "success",\r\n"error_code": 0,\r\n"error_description": "",\r\n"document_type": "iso20022",\r\n"document_body": "\r\n\n\r\n\n \r\n \n \r\n \n \r\n k221YIoYrWbIbAnP133a07B5wmpEcJSOQ6X\r\n\r\n 2025-11-05T10:40:24+00:00\r\n\r\n \r\n\r\n \r\n \r\n batch-payment-002\r\n\r\n pain.001.001.14\r\n\r\n PART\r\n\r\n \r\n\r\n \r\n \r\n PMT-001\r\n\r\n \r\n \r\n EXT-493723559479911\r\n\r\n \r\n\r\n PDNG\r\n\r\n 176232737137\r\n\r\n \r\n\r\n \r\n \r\n EXT-780273386982009\r\n\r\n \r\n\r\n PDNG\r\n\r\n 176232737138\r\n\r\n \r\n\r\n \r\n \r\n EXT-872174653393565\r\n\r\n \r\n\r\n PDNG\r\n\r\n 176232737139\r\n\r\n \r\n\r\n \r\n\r\n \r\n\r\n\r\n",\r\n "dt": "2025-11-05T10:40:24+00:00"\r\n}" headers: {} x-apidog-name: Success security: [] x-apidog-folder: Partner API/Account/Settlement x-apidog-status: developing x-run-in-apidog: https://app.apidog.com/web/project/640842/apis/api-24102332-run components: schemas: {} securitySchemes: card-api: type: jwt scheme: bearer bearerFormat: JWT x-apidog: addTokenTo: header headerPrefix: Bearer servers: - url: https://api.freedompay.kz description: Prod Env security: [] ``` -------------------------------- ### HTML Button to Trigger Payment Source: https://docs.freedompay.kz/doc-852985 An example HTML button that, when clicked, calls the `pay` JavaScript function with a specified amount to initiate the payment process. ```html ``` -------------------------------- ### JS SDK Initialization and Setup Source: https://docs.freedompay.kz/doc-869917 Instructions on how to include the FreedomPay JS SDK script in your website and how to set up the SDK with your public key and token. ```APIDOC ## Initialization and Setup ### Description To initialize the SDK, add the provided script to the `` of your HTML document. After the script is loaded, you can set your public key and token using the `FreedomPaySDK.setup()` method. ### Method N/A (Client-side script inclusion and setup) ### Endpoint N/A ### Parameters #### Initialization Script ```html ``` #### SDK Setup - **publicKey** (string) - Required - Your unique public key obtained from your manager. - **token** (string) - Required - Your token obtained from your manager. ```javascript FreedomPaySDK.setup('YOUR_PUBLIC_KEY', 'YOUR_TOKEN'); ``` ### Request Example N/A (Client-side setup) ### Response N/A (Client-side setup) ### Error Handling - Contact your personal manager if you encounter issues during setup or require credentials. ``` -------------------------------- ### Initialize Device ID SDK (Kotlin) Source: https://docs.freedompay.kz/doc-966303 Demonstrates how to initialize the Device ID SDK by calling the `create` method. This method requires an Android `Context` object as input. ```kotlin val context = Context val deviceID = DeviceID.create(context) ``` -------------------------------- ### Payment Example: Reversed Status Source: https://docs.freedompay.kz/api-9587007 Provides an example of a payment object with the status 'reversed'. This includes the payment ID, amount, timestamp, order details, clearing status, card information, and details of the reversal transaction. ```json { "id": "01978d55-748b-79a4-9e9e-77ab3c15aadd", "status": "reversed", "amount": 100, "created_at": "2025-06-20T12:34:37.323632498Z", "order_id": "1234", "clearing": { "cleared": false, "amount": 0 }, "from": { "card": { "token": "01978d27-fdb1-7fd1-8812-ce7a83414c72", "brand": "VI" } }, "reverse_payments": [ { "id": "01978d55-ba15-738e-8a99-44cd25f0eb6b", "amount": -100, "status": "success" } ], "additional": { "approval_code": "218881", "reference": "517101387057" } } ``` -------------------------------- ### Make SDK Requests with Callbacks Source: https://docs.freedompay.kz/doc-690111 Demonstrates how to make requests using an initialized FreedomQrProvider SDK object. It includes success, server error, and request failure callback handlers for processing the results. ```kotlin sdkObject.methodName("params", onResult = { result -> // Result of the request execution. }, onError = { serverError -> // Server error. }, onFailure = { exception -> // Request sending error. } ) ``` -------------------------------- ### Initialize FreedomQrClient in Android Source: https://docs.freedompay.kz/doc-690109 Demonstrates how to initialize the FreedomQrClient, the main class for interacting with the SDK. This requires providing the secret key and merchant ID obtained during merchant account setup. ```kotlin private val sdk = FreedomQrClient.initialize(secretKey, merchantId) ``` -------------------------------- ### Initiate Payment with Full Configuration (JavaScript) Source: https://docs.freedompay.kz/doc-852985 This JavaScript function shows the full configuration options for initiating a payment, including order details, currency, expiration, custom parameters, callbacks, user information, and receipt positions. ```javascript function pay(amount) { var data = { token: "your token", payment: { order: "1", amount: "200", currency: "KZT", description: "Description of the order", expires_at: "2020-12-12 00:00:00", param1: "string", param2: "string", param3: "string", test: 1, // testing mode options: { callbacks: { result_url: "https://my-domain.com/result", check_url: "https://my-domain.com/check" }, custom_params: {}, user: { email: "user@test.com", phone: "77777777777", }, receipt_positions: [ { count: 2, name: "Mouse pad", tax_type: 3, price: 1000 }, { count: 2, name: "Socket", tax_type: 3, price: 1000 } ] } }, successCallback: function (payment) { //... }, errorCallback: function (payment) { //... } } var widget = new Checkout(data); widget.create(); } ``` -------------------------------- ### FreedomPay XML Response Example (Failure) Source: https://docs.freedompay.kz/api-12090694 This example illustrates a failed response from the FreedomPay API. It shows a successful request status ('ok') but a 'failed' transaction status, including specific error codes and descriptions for diagnosis. ```xml ok 511180 failed 0 0 2021-08-26 11:53:12 5 ``` -------------------------------- ### POST /v1/merchant/merchant_id/card/init Source: https://docs.freedompay.kz/api-11620882 Initializes a payment using a previously saved card. Verifies the card token and returns a payment ID upon success. ```APIDOC ## POST /v1/merchant/{merchant_id}/card/init ### Description Initializes a payment using a previously saved card. Verifies the card token and returns a payment ID upon success. ### Method POST ### Endpoint /v1/merchant/{merchant_id}/card/init ### Parameters #### Path Parameters - **merchant_id** (integer) - Required - Merchant ID in the system. #### Query Parameters None #### Request Body - **pg_amount** (number) - Required - Payment amount. Minimum 0.01. - **pg_currency** (string) - Required - Payment currency. - **pg_order_id** (string) - Required - Order ID in the merchant system. - **pg_user_id** (string) - Required - User ID in the merchant system. - **pg_card_id** (number) - Optional - Card ID. (Deprecated). Required if no pg_card_token. - **pg_card_token** (string) - Optional - Card token. Required if no pg_card_id. - **pg_description** (string) - Required - Order description. - **pg_receipt_positions[0][count]** (integer) - Required - Product quantity. - **pg_receipt_positions[0][name]** (string) - Required - Product name. - **pg_receipt_positions[0][tax_type]** (integer) - Required - Tax type. Possible values: 0 (Without tax), 1 (VAT 0%), 2 (VAT 12%), 3 (VAT 12/112), 4 (VAT 18%), 5 (VAT 18/118), 6 (VAT 10%), 7 (VAT 10/110), 8 (VAT 20%), 9 (VAT 20/120). - **pg_receipt_positions[0][price]** (number) - Required - Product price. ### Request Example ```json { "pg_amount": 100.00, "pg_currency": "KZT", "pg_order_id": "order_12345", "pg_user_id": "user_abcde", "pg_card_token": "ef741cfc-f85e-41a0-84e6-2ba964912182", "pg_description": "Payment for goods", "pg_receipt_positions": [ { "count": 2, "name": "Mouse pad", "tax_type": 0, "price": 50.00 } ] } ``` ### Response #### Success Response (200) - **payment_id** (string) - The unique identifier for the initiated payment. #### Response Example ```json { "payment_id": "pay_1a2b3c4d5e6f7a8b9c0d" } ``` ``` -------------------------------- ### POST /v5/merchant/invoice/init Source: https://docs.freedompay.kz/api-11622180 Initiates a payment by sending a request to the Freedom Pay Gateway. Returns an invoice_id and a QR code URL for user redirection. ```APIDOC ## POST /v5/merchant/invoice/init ### Description Initiates a payment by sending a request to the Freedom Pay Gateway. In response, you will receive an invoice_id and a QR code URL to redirect the user. ### Method POST ### Endpoint /v5/merchant/invoice/init ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **order_id** (string) - Required - Payment ID in the merchant system. It is recommended to keep this field unique. - **merchant_id** (integer) - Required - Merchant ID in the project issued upon connection. - **amount** (number) - Required - Payment amount in currency. - **description** (string) - Required - Description of the product or service. Displayed to the buyer during the payment process. - **invoice_method** (string) - Required - Invoicing method. Values are separated by commas. Possible values: qr. - **currency** (string) - Optional - The currency in which the amount is indicated. e.g., KZT - **check_url** (string) - Optional - URL to check the possibility of payment. Called before the payment. - **result_url** (string) - Optional - URL for reporting the result of the payment. Called after payment on success or failure. Required if not set in the store settings. - **request_method** (string) - Optional - Specifies the request method for checking payment status. Possible values: GET, POST. ### Request Example ```json { "order_id": "550e8400-e29b-41d4-a716-446655440000", "merchant_id": 0, "amount": 100.50, "description": "Product Purchase", "invoice_method": "qr", "currency": "KZT", "check_url": "https://site.com/check", "result_url": "https://site.com/result", "request_method": "GET" } ``` ### Response #### Success Response (200) - **status** (string) - Shows the result of the query. Possible values: `ok`, `error`. - **invoice_status** (string) - Invoice status. Possible values: `new`, `process`, `ok`, `failed`, `incomplete`. - **error_code** (integer) - Error code ID. - **error_description** (string) - Text description of the error. - **invoice_id** (integer) - The ID of the created invoice. #### Response Example ```json { "status": "ok", "invoice_status": "new", "error_code": 0, "error_description": "", "invoice_id": 123456789 } ``` ``` -------------------------------- ### Install FreedomPay SDK for iOS using CocoaPods Source: https://docs.freedompay.kz/doc-690101 This snippet shows how to add the PayBoxSdk to your Xcode project's Podfile for integration using CocoaPods. After updating the Podfile, run 'pod install' in your terminal. ```Ruby target 'Project name' do pod 'PayBoxSdk', :git => 'https://github.com/PayBox/SDK_iOS-input-.git', :submodules => true end ``` ```Shell $ pod install ``` -------------------------------- ### FreedomPay XML Response Example (Success) Source: https://docs.freedompay.kz/api-12090694 This example demonstrates a successful response from the FreedomPay API, indicating an 'ok' status for both the general request and the payment transaction. It includes essential details like payment ID, capture status, and creation date. ```xml ok 511194 ok 0 1 2021-08-26 11:52:25 41F5ZyqcOabTG5u7 34484775bd62986753429d6af57e94eb ``` -------------------------------- ### Making SDK Requests Source: https://docs.freedompay.kz/doc-690109 Demonstrates how to make requests using the initialized SDK object, including handling results, errors, and failures. ```APIDOC ## Making SDK Requests ### Description This outlines the general structure for making requests using the FreedomQrClient SDK, including parameters and callback handling. ### Method `sdkObject.methodName(params, onResult, onError, onFailure)` ### Parameters - **sdkObject** (FreedomQrClient) - Required - The initialized SDK object. - **methodName** (String) - Required - The name of the method to call (e.g., `retrieveTokenizedCards`, `addTokenizedCard`). - **params** (Object) - Required - Parameters specific to the method being called. - **onResult** (Callback) - Required - A callback function that receives the result object of type `` upon successful execution. - **onError** (Callback) - Required - A callback function that receives an `ErrorResponse` object containing server error details. - **onFailure** (Callback) - Required - A callback function that receives an `Exception` object if there's an error sending the request. ### Request Example ```kotlin val params = "..." sdk.someMethodName(params, onResult = { result -> // Handle successful result }, onError = { serverError -> // Handle server error println("Error Code: ${serverError.code}, Message: ${serverError.message}") }, onFailure = { exception -> // Handle request sending failure println("Request failed: ${exception.message}") } ) ``` ### Response - **onResult**: Returns the execution result object ``. - **onError**: Returns an `ErrorResponse` object with `code` (Int) and `message` (String) fields. - **onFailure**: Returns an `Exception` object detailing the request sending error. ``` -------------------------------- ### XML Response Example for Successful Payment Source: https://docs.freedompay.kz/api-11620882 This code snippet provides an example of a successful payment response in XML format. It includes fields such as status, payment ID, order ID, merchant ID, salt, and signature. This is crucial for verifying transaction success and obtaining transaction details. ```xml ok 7999007876 12345 9970 LNTZ7ciT1xjwzCFr 760767e58ac9c2089e02471638b01111 ``` -------------------------------- ### Example of Formed JWS Token and Signature Source: https://docs.freedompay.kz/doc-761023 This section provides an example of a fully formed JWS token, which includes the header, payload (request body), and signature. It also shows the signature part separately, which is transmitted in the `X-JWS-Signature` header. The supported algorithm is HS256. ```text eyJ1cmkiOiIvdjUvcGFydG5lci9jbGllbnQvYWRkIiwiYXV0aF9pZCI6IjEyMzQ1NiIsIm1ldGhvZCI6IlBPU1QiLCJwYXJhbXMiOiIiLCJhbGciOiJIUzI1NiJ9.eyJyZXF1ZXN0X2lkIjoiODI4Y2Y3MWQtYTQ0Ny00YTY3LWExNDktYzFkZjhiYzE5N2NhIiwibmFtZSI6ItCd0LDQt9Cy0LDQvdC40LUg0Y7RgNC40LTQuNGH0LXRgdC60L7Qs9C-INC70LjRhtCwIiwiYmluIjoxMjM0NTY3ODkwMTIsImNlb19pbmZvIjp7ImZpcnN0X25hbWUiOiLQmNC80Y8iLCJsYXN0X25hbWUiOiLQpNCw0LzQuNC70LjRjyIsInBob25lIjo3NzAxNzc3Nzc3NywiZW1haWwiOiJtYWlsQGV4YW1wbGUua3oifSwiYWRkcmVzc19pbmZvIjp7ImNvdW50cnkiOiJLWiIsInBvc3RhbF9jb2RlIjoiMDUwMDAwIiwiYWRkcmVzc19saW5lMSI6IkFsbWF0eSIsImFkZHJlc3NfbGluZTIiOiJaaGVsdG9rc2FuIiwiYWRkcmVzc19saW5lMyI6IjExNSJ9LCJpYmFuIjoiS1oxMjM0NUI3ODkwMTIzNDVLWlQiLCJkZXNjcmlwdGlvbiI6ItCd0L7QstGL0Lkg0L_QsNGA0YLQvdC10YAifQ.HR6MSeTvX6MFbug2619WEUf2TyoQTi9XUKVU4QtXNAQ ``` ```text eyJ1cmkiOiIvdjUvcGFydG5lci9jbGllbnQvYWRkIiwiYXV0aF9pZCI6IjEyMzQ1NiIsIm1ldGhvZCI6IlBPU1QiLCJwYXJhbXMiOiIiLCJhbGciOiJIUzI1NiJ9..HR6MSeTvX6MFbug2619WEUf2TyoQTi9XUKVU4QtXNAQ ``` -------------------------------- ### SDK Initialization Source: https://docs.freedompay.kz/doc-690109 Initializes the FreedomQrClient SDK with your secret key and merchant ID. ```APIDOC ## SDK Initialization ### Description Initializes the FreedomQrClient SDK. This is the first step before making any requests. ### Method `FreedomQrClient.initialize(secretKey: String, merchantId: String)` ### Parameters - **secretKey** (String) - Required - The secret key provided when connecting the merchant in the personal account. - **merchantId** (String) - Required - A unique identifier assigned to the merchant after creating the account. ### Request Example ```kotlin private val sdk = FreedomQrClient.initialize("YOUR_SECRET_KEY", "YOUR_MERCHANT_ID") ``` ### Response - **FreedomQrClient** (Object) - The initialized SDK object. ``` -------------------------------- ### XML Response Example for Generic Payment Error Source: https://docs.freedompay.kz/api-11620882 This code snippet shows an example of an error response in XML format for general payment processing failures. It includes the status, an error code, a text description of the error, and the order ID. This helps in diagnosing and communicating payment issues to the user or system. ```xml error 9999 Внутренняя ошибка сервиса, попробуйте повторить запрос позднее. 1234 ``` -------------------------------- ### Initialize and Configure FreedomPay SDK in Swift Source: https://docs.freedompay.kz/doc-690101 Demonstrates the basic initialization of the PayboxSdk with merchant credentials and configuration of various payment parameters such as test mode, region, currency, and language. ```Swift let sdk = PayboxSdk.initialize(merchantId: merchantID, secretKey: "secretKey") sdk.config().testMode(enabled: true) sdk.config().setRegion(region: .DEFAULT) sdk.config().setPaymentSystem(paymentSystem: paymentSystem) sdk.config().setCurrencyCode(code: "KZT") sdk.config().autoClearing(enabled: true) sdk.config().setEncoding(encoding: "UTF-8") sdk.config().setRecurringLifetime(lifetime: 36) sdk.config().setPaymentLifetime(lifetime: 300) sdk.config().recurringMode(enabled: false) sdk.config().setUserPhone(userPhone: userPhone) sdk.config().setUserEmail(userEmail: email) sdk.config().setLanguage(language: .ru) sdk.config().setCheckUrl(url: url) sdk.config().setResultUrl(url: url) sdk.config().setRefundUrl(url: url) sdk.config().setClearingUrl(url: url) sdk.config().setRequestMethod(requestMethod: requestMethod) sdk.config().setFrameRequired(isRequired: true) ``` -------------------------------- ### ISO 20022 Payment Status Report Example (XML) Source: https://docs.freedompay.kz/api-19237244 This snippet shows an example of an ISO 20022 payment status report (pain.002.001.14) in XML format. It includes elements for message headers, original group information, and payment information status, detailing transaction outcomes like rejection. ```xml LiaUvQVYxY9GOPzNIcX9oHtBD 2025-06-16T09:27:54+00:00 batch-payment-001 pain.001.001.14 PART PMT-001 INV-001 RJCT 12345 INV-001 INV-001 RJCT ``` -------------------------------- ### Payment Example: Process Status Source: https://docs.freedompay.kz/api-9587007 Demonstrates a payment object where the status is 'process'. It includes essential payment details like ID, amount, creation time, order ID, and card information, along with basic 3D Secure data. ```json { "id": "01978d0e-b956-7ea2-9a42-32cff1f44ede", "status": "process", "amount": 100, "created_at": "2025-06-20T07:13:31.068188524Z", "order_id": "1234", "from": { "card": { "brand": "VI", "token": "01978d11-669e-7dd1-bf1b-75a12bf57ca9" } }, "3ds": { "acs_url": "" } } ``` -------------------------------- ### Configure FreedomPay SDK Source: https://docs.freedompay.kz/doc-1368420 Sets up the SDK with user and operational configurations. Requires UserConfiguration and OperationalConfiguration objects. Outputs the configured SDK instance. ```kotlin val myUserConfig = UserConfiguration( userPhone = "1234567890", userEmail = "user@example.com" ) val myOperationalConfig = OperationalConfiguration( testingMode = false, language = Language.EN, // Using the provided Language enum lifetime = 600, // 10 minutes autoClearing = true, resultUrl = "https://example.com/result", requestMethod = HttpMethod.POST // Using the provided HttpMethod enum ) val sdkConfiguration = SdkConfiguration( userConfiguration = myUserConfig, operationalConfiguration = myOperationalConfig ) freedomApi.setConfiguration(sdkConfiguration) ``` -------------------------------- ### Example Usage of JWS Signature Generation (Node.js) Source: https://docs.freedompay.kz/doc-1281608 This Node.js example demonstrates how to use the `makeSignature` function to generate a JWS token for an API request. It defines a sample request object, stringifies it to `rawBody`, and then calls `makeSignature` with the necessary parameters including the API endpoint details and secret key. The generated token is then logged to the console. ```javascript const requestObj = { "document_type": "iso20022", "document_body": "..." }; // Body должен быть строкой, не JSON-объектом const rawBody = JSON.stringify(requestObj); const token = makeSignature({ rawBody: rawBody, urlPath: ['api', 'v5', 'partner', 'settlement-partitions'], method: "POST", secret: "your_partner_api_secret_key", auth_id: "user_id" }); console.log("Generated JWS Token:", token); ``` -------------------------------- ### Initiate Payment with Minimum Configuration (JavaScript) Source: https://docs.freedompay.kz/doc-852985 This JavaScript function demonstrates the minimum configuration required to initiate a payment using the FreedomPay checkout. It takes the amount as an argument and includes basic success and error callbacks. ```javascript function pay(amount) { var data = { token: Your token, payment: { amount: amount, language: 'ru', // Widget language description: 'Order description', }, successCallback: function (payment) { console.log(payment) // Payment details }, errorCallback: function (payment) { console.log(payment) // Payment details } } var widget = new Checkout(data); widget.create(); } ```