API documentation - Fusion Pay

API documentation - Fusion Pay

Contents:

  1. General information

    1. Bank Products

    2. Integration Process

  2. Methods

    1. Get Calculations

      1. Examples

    2. Register Applications

      1. Examples

    3. Get Application Status

    4. Get Application Data

  3. Ready embedded calculator

  4. Express buy button in product page

  5. Add to cart functionality

  6. Example files

 

General Information

 

This document serves as a guide for merchants to integrate with the TBI Bank loan application platform using the provided API. The platform can be accessed through the following URLs:

Upon registering for a partnership with TBI Bank, merchants will receive access to these platforms to track all incoming loan applications. This guide refers to the platform as the "Merchant Portal." Merchants will also be provided with a 'reseller code' (a four-character code) and a 'reseller key' to identify the store or object when using the API methods.

Bank Products

TBI Bank offers various repayment schemes:

  • Loan terms range from 3 to 60 months.

  • Loan amounts range from 100 to 30,000 BGN.

  • Options include standard loans and "Buy Now, Pay Later" schemes.

  • Terms and interest rates are agreed upon with the Merchant Enabler (a TBI Bank employee responsible for the merchant).

  • Interest rates can vary based on the loan amount, with options for 0% rates and promotional schemes for specific periods. These terms are also arranged with the Merchant Enabler.

Integration Process

The integration process for sending loan applications is divided into two main parts:

Part 1: Display Financing Options

  1. Display Financing Button:

    • Show a button on the product page saying "Buy in installments starting from XX.XX per month" or "Buy in X installments for XX.XX / monthly."

    • Use the GetCalculations API method to calculate the installment amount (XX.XX).

  2. Show All Pay Schemes:

    • Allow the customer to view all available pay schemes with different periods.

    • Display this information on both the product and checkout pages.

    • Ensure that the following EU-compliant parameters are displayed: APR, NIR, Total Due Amount, Installment, and Period. These details are provided by the GetCalculations method.

Part 2: Submit Loan Application

  1. Send Loan Application:

    • Use the RegisterApplication API method to send client data (e.g., Full Name, Phone Number, Address) and shopping cart items to the bank.

    • The only mandatory fields are the items list and the order ID from the merchant's website.

    • The RegisterApplication method returns a URL where the customer completes the application. This URL can be used to redirect the customer or display a pop-up on the website.

    • Preferably, send customer data in the API call to prefill the application form, enhancing customer satisfaction.

Extra: Update Application Status

  • Check Application Status:

    • Use the GetApplicationStatus endpoint to retrieve the current status of an application and track its status changes throughout the processing.

By following these steps, merchants can seamlessly integrate with the TBI Bank loan application platform, offering flexible financing options to their customers and ensuring a smooth application process.

 

Methods

GetCalculations

Overview

The GetCalculations API call provides a RESTful response with available repayment schemes for a specific merchant or store. It supports both GET and POST requests. The response includes all necessary parameters to display repayment schemes in compliance with EU requirements and to facilitate sending applications to the bank processing platform.

To optimize performance, it's recommended to update the parameters once per day, preferably after the first scheme request of the new day or after 00:01 daily. A manual pull update API call from the merchant backend is also advisable if different interest rate conditions are set up.

However, if the API is called for each calculation, the response remains efficient and easy to handle.

Endpoint

<https://beta.tbibank.support/api/GetCalculations>

Request Parameters

Parameter

Description

Type

Required

Parameter

Description

Type

Required

reseller_code

Parameter to identify the merchant in the system

String

Yes

reseller_key

Parameter to validate the merchant and specify in case of multiple websites/objects with different APRs

String

Yes

amount

Total price of basket goods / Total credit amount to extract specific schemes by amount-defined APR tiers

Double

No

category_id

ID to extract repayment schemes set only for a specific category

Int

No

Response Parameters

Parameter

Description / Usage

Type

Parameter

Description / Usage

Type

id

Scheme unique ID. Used to sync with calculation API ID. /Backend/

Int

name

Scheme name. Used as the preferred name in the repayment options list. /Frontend/

String

bank_product

Bank product name. Not used with this type of integration. /Backend/

String

period

Repayment period in months. Used to display options. /Frontend; Backend/

Int

installment_factor

Coefficient used as a multiplier to the product/basket total price for calculating the monthly installment. Used to display repayment options. /Frontend; Backend/

Double

total_due_factor

Coefficient used as a multiplier to the product/basket total price for calculating the repayment. Optional usage. /Frontend; Backend/

Double

nir

Scheme Nominal Interest Rate. Displayed in loan description as mandatory for EU compliance. /Frontend/

Double

apr

Scheme Annual Percentage Rate. Displayed in loan description as mandatory for EU compliance. /Frontend/

Double

amount_min

Minimum loan credit amount for the scheme to be available in the list. /Backend/

Double

amount_max

Maximum loan credit amount for the scheme to be available in the list. /Backend/

Double

category_id

Scheme product category limitation for the scheme to be available in the list. /Backend/

Int

Examples

Example Requests and Responses

 

  1. Basic Request

    Request:

    <https://beta.tbibank.support/api/GetCalculations?reseller_code=TBI1&reseller_key=EX1>

    Response:

    [ { "id": 755, "name": "3 месеца ПРОМО 0%", "bank_product": "Promo 0%", "period": 3, "installment_factor": 0.3333333, "total_due_factor": 1, "nir": 0, "apr": 0, "amount_min": 100, "amount_max": 1200, "category_id": 255 }, { "id": 1, "name": "3 месеца", "bank_product": "Standard 0.61%", "period": 3, "installment_factor": 0.33940643333333, "total_due_factor": 1.0182193, "nir": 10.9, "apr": 10.09, "amount_min": 10000, "amount_max": 30000, "category_id": 0 }, { "id": 474, "name": "12 месеца", "bank_product": "Standard 1.50%", "period": 12, "installment_factor": 0.098333333333333, "total_due_factor": 1.18, "nir": 31.72, "apr": 34.91, "amount_min": 100, "amount_max": 5000, "category_id": 0 } ]
  2. Filtered by Amount

    Request:

    <https://beta.tbibank.support/api/GetCalculations?reseller_code=TBI1&reseller_key=EX1&amount=1500>

    Response:

    [ { "id": 474, "name": "12 месеца", "bank_product": "Standard 1.50%", "period": 12, "installment_factor": 0.098333333333333, "total_due_factor": 1.18, "nir": 31.72, "apr": 34.91, "amount_min": 100, "amount_max": 5000, "category_id": 0 } ]
  3. Empty Request

    Request:

    <https://beta.tbibank.support/api/GetCalculations>

    Response:

    { "error": 203, "message": "Empty request /api/info203" }
  4. Invalid Request

    Request:

    <https://beta.tbibank.support/api/GetCalculations?test=test>

    Response:

    { "error": 204, "message": "Invalid request /api/info204" }
  5. Unauthorized Access

    Request:

    <https://beta.tbibank.support/api/GetCalculations?reseller_code=TBI1&reseller_key=UNAUTH>

    Response:

    { "error": 205, "message": "Access denied /api/info205" }
  6. Valid Authorization with No Schemes

    Request:

    <https://beta.tbibank.support/api/GetCalculations?reseller_code=TBI1&reseller_key=EMPTY>

    Response:

    []

Important Notice

The GetCalculations API can receive all parameters via a GET request and has no limitations since it does not handle sensitive information. However, setting the code and key via GET is not recommended. The preferred usage is via data form POST or text/JSON raw POST request from the backend.

Example cURL Commands

  1. Form Data POST Request

    curl --location '<https://beta.tbibank.support/api/GetCalculations>' \\ --form 'reseller_code="TBI1"' \\ --form 'reseller_key="EMPTY"'
  2. JSON POST Request

    curl --location '<https://beta.tbibank.support/api/GetCalculations>' \\ --header 'Content-Type: application/json' \\ --data '{"reseller_code":"TBI1","reseller_key":"EX1","category_id":"255","amount":"1000"}'
  3. Text/Plain POST Request

    curl --location '<https://beta.tbibank.support/api/GetCalculations>' \\ --header 'Content-Type: text/plain' \\ --data '{"reseller_code":"TBI1","reseller_key":"EX1","category_id":"255","amount":"1000"}'

 

Register Application

Overview

 

The RegisterApplication method sends customer and order data to TBI Bank. If the data is valid, the response includes a URL to which the customer should be redirected to complete the application. This endpoint supports only the POST method.

For testing, use the following credentials:

  • reseller_code: TBI1

  • reseller_key: EX1

  • encryption key: d1c2e12cfeababc8b95daf6902e210b170992e68fd1c1f19565a40cf0099c6e2cb559b85d7c14ea05b4dca0a790656d003ccade9286827cffdf8e664fd271499

Endpoint

<https://beta.tbibank.support/api/RegisterApplication>

Request Parameters

Parameter

Description

Type

Required

Parameter

Description

Type

Required

reseller_code

Merchant reseller code

String

Yes

reseller_key

Merchant reseller key

String

Yes

data

Encrypted JSON format string containing information for the application

String

Yes

Encrypted JSON Parameters

The encrypted JSON containing application information includes the following parameters:

Parameter

Description

Type

Required

Parameter

Description

Type

Required

orderid

Merchant order ID

String

Yes

firstname

Client first name

String

No

lastname

Client last name

String

No

surname

Client surname

String

No

email

Client email

String

No

phone

Client phone number

String

No

deliveryaddress

Client delivery address

JSON

No

items

List of items including delivery fee, describing goods to be financed

List

Yes

period

Preselected period (default 12 months)

Int

No

promo

Preselected promo scheme (default false)

Bool

No

successRedirectURL

URL to redirect customer after successful application

String

No

bnpl

Indicate if BNPL should be allowed in the current application

You can use this parameter on a product by product basis to indicate you want BNPL to be an option or not.

Please note that BNPL already has a built in parameter of only appearing in prices from 40-400 BGN

Bool (1, 0)

No

failRedirectURL

URL to redirect customer after failed application (used in BNPL)

String

No

statusURL

Merchant endpoint for application status updates

String

No

Items List Parameters

Parameter

Description

Type

Required

Parameter

Description

Type

Required

name

Product name

String

Yes

description

Product description

String

No

qty

Product quantity in basket

Int

Yes

price

Product single price

Double

Yes

sku

Product SKU or ID

String

No

category

Product category ID

Int

Yes

imagelink

Product image URL

String

No

Note:

  • imagelink is recommended because it enhances the page where the customer is redirected.

  • category is mandatory to determine eligibility for promotional schemes.

Examples:

 

Input:

{ "reseller_code":"TBI1", "reseller_key":"EX1", "data":"5kx8mkDB5nPal+He0Q6XMMy2ZFvknJhUjmviqR2rHCMLWkP9VZIrqeyVMmZ3S6hJsA34D65 Di6dF8ytD2g5Y3qQHnLJIp7ifChba8euLcmWAR0GbtTOZQNDfQC7SdDUaWcA5LyDj4d3m+Q2GBRwbjKVWiB Lkn7g+o8VBbU7SYX1vISWKaM285YwVT9EmufQ9A+Se1ZRD4wOYgCHnDu9XoWdxG382dDdMsXFL1Dlhcbl37 tirFTpxoZEwLYz6ZjPktfMu+AayFQmLFcbxLQkuFyqTUaSEEuEvEgkkK4eyIliWmKgt7HoteKvG491GOYby XGr1abp8im8XzXnvDoPGk1yXJEgJfa8jlK8UNv3GAluN/aKZyXb9yOUMoUecMukakAZEKFbMtdMUPUMxa/A lYB0Vtfe4Sv7ZnhTBDT57fB9S9Y83j8FI1+siR+SBaibNEZPfI5VyhFp4InLWSWfEtpOaQXMs9S1pe2R9Xk MRUam6x23/HRdDuhEuDQbRAVxmp4kNLw51SLS6NSPMxviVI89pp8zejKJzJA41ccg7v/vtFBRhF7N7tvXQS 1/1ZsMKh193lCAViSsQcJcmbLvS6XNAf8us+EG6LGi/VDw4vTBR8m8UloYqcHXbfSgnMGQPkknBUG+VtC3S KjiS42I+H+JieSzAj5BBEx2Eda0hidFsg993CPS1F/uX372QpEm72fN0z9EBOINuuNL67CeR7TUKPoPE1FC 6PudVCxB4MHwXBtDqDvD6rrsLgDq4EjG37dKblHBML/Sp/tMvLLWCog3eqtAVk2328hL+ceocezWWpQcav1 ia2oYouZU/mGWyGDgToqyc1pb16B9nFoBNS2mJESdApegI8eGVkVGXqFi2XOyh9wHzeD4UUz0cvg1Ha7kIL St4Cg9vUob5D2hhWu/aafuOfbrmBNVUgmMVWCYsSNxIGh7HgBpZJ6UJezrO0hQYyL/yniO60N6utp6o3wHp dOfjU5I0u0NlIakGe4W7QR88h8ybO+/bn3BG5qjwHD9BIwvjCujS8i1MxPX2GRyKLsd2NCvkna+Jg+/GHpi ydz7cu0oBjnf1brkGp9w0h4Xk5lZsFl45/XJlH0ImwKFg3aBgeihBolRCMc+8YBzGyoNi1M0uoDm9tul60o oKO61/cbKhWK0i1cOkjUDvOIYLav2KPYpyaTcoaw+DSG46RXdUuceQXnqTOlKKuhqozQ==" }

 

in the example input the data is encrypted with key:

d1c2e12cfeababc8b95daf6902e210b170992e68fd1c1f19565a40cf0099c6e2cb 559b85d7c14ea05b4dca0a790656d003ccade9286827cffdf8e664fd271499

and contains the following JSON:

{ "orderid": "12345", "firstname": "Тест", "lastname": "Тестов", "surname": "", "email": "test@tbibank.bg", "phone": "0888123456", "deliveryaddress": { "country": "Bulgaria", "county": "", "city": "", "streetname": "", "streetno": "", "buildingno": "", "entranceno": "", "floorno": "", "apartmentno": "", "postalcode": "" }, "items": [ { "name": "Спортно елегантен панталон", "description": "", "qty": "3", "price": "24.87", "sku": "3345", "category": "9", "imagelink": "https://presta16.tbitest.online/img/p/8/8- large_default.jpg" }, { "name": "Блуза раета", "description": "", "qty": "2", "price": "21.57", "sku": "5566", "category": "4", "imagelink": "https://presta16.tbitest.online/img/p/7/7- large_default.jpg" } ] }
Output: { "error": 0, "order_id": 22, "token": "bdf54849927eed3d4b785fe1e812582a17ad", "url": "https://beta.tbibank.support/application/?order_id=22&token=bdf54849927 eed3d4b785fe1e812582a17ad" }

 

With this output the customer should be either redirected to

https://beta.tbibank.support/application/?order_id=22&token=bdf54849927eed3d4b785fe1e812582a17ad

or get a popup with iframe containing the page.

 

Examples with optional fields:

{ "orderid": "123456", "firstname": "John", "lastname": "Dow", "surname": "", "email": "test@tbibank.bg", "phone": "0879123456", "deliveryaddress": { "country": "", "county": "", "city": "", "streetname": "", "streetno": "", "buildingno": "", "entranceno": "", "floorno": "", "apartmentno": "", "postalcode": "" }, "items": [ { "name": "Спортно елегантен панталон", "description": "", "qty": "3", "price": "34.99", "sku": "3345", "category": "9", "imagelink": "https://tbi-uat.online/hat/hat.jpg" }, { "name": "Блуза раета", "description": "", "qty": "1", "price": "110.65", "sku": "5566", "category": "4", "imagelink": "https://tbi-uat.online/hat/hat.jpg" } ], "promo": true, "successRedirectURL": "https://testsuccess.com", "failRedirectURL": "https://testfail.com" }

The body of the application from the above example will have Promo scheme preselected and the application will have both successRedirectURL and failRedirectURL defined.

{ "orderid": "123456", "firstname": "John", "lastname": "Dow", "surname": "", "email": "test@tbibank.bg", "phone": "0879123456", "deliveryaddress": { "country": "", "county": "", "city": "", "streetname": "", "streetno": "", "buildingno": "", "entranceno": "", "floorno": "", "apartmentno": "", "postalcode": "" }, "items": [ { "name": "Спортно елегантен панталон", "description": "", "qty": "3", "price": "34.99", "sku": "3345", "category": "111", "imagelink": "https://tbi-uat.online/hat/hat.jpg" }, { "name": "Блуза раета", "description": "", "qty": "1", "price": "110.65", "sku": "5566", "category": "111", "imagelink": "https://tbi-uat.online/hat/hat.jpg" } ], "period": 34, "statusURL" : "https://tbi-uat.online/endpoint/status-update" }

The body of the application from the above example will have a period of 34 months preselected and the application will receive status updates at https://tbi-uat.online/endpoint/status-update awaiting post update with body for Standard repayment plans from 3 to 60 months:

{ "CreditApplicationId": "APPLICATION ID FROM BANKLY", "StatusUrl": "https://tbi-uat.online/endpoint/status-update", "OrderId": "123456", "Status": "3", "Message": "Approved", "ResellerCode": "TBI1" }

And body for BNPL:

{ "CreditApplicationId": "BNPL APPLICATION ID", "StatusUrl": "https://tbi-uat.online/endpoint/status-update" "OrderId": "123456", "Status": 1, "Message": "in_progress", "ResellerCode": "TBI1", "System": "FTOS", "ContractNumber": null }

 

Standard application status variations:

Application Type

Status

Description

Status Explanation

Application Type

Status

Description

Status Explanation

Standard, BNPL

Draft

Intermediary status

Application not finished, And has not been sent to the banking systems

Standard

MP Sent

Intermediary status

Awaiting Processing by Call Center

Standard

InProgress

Intermediary status

In progress with Call Center Agent

Standard

InProgressAssessment

Intermediary status

In Risk Assesment

Standard

Approved

Intermediary status

Risk Assessment Approved

Standard

KYC

Intermediary status

KYC

Standard

ContractSigning

Intermediary status

Contract ready to sign

Standard

Rejected

Final status

Rejected from Risk

Standard

Canceled

Final status

Cancelled/Expired application

Standard

ContractSigned

Final status

Contract Signed

Standard

Paid

Final status

Payment Disbursed

BNPL

in_progress

Intermediary status

 

BNPL

rejected

Final status

 

BNPL

canceled

Final status

 

BNPL

approved & signed

Final status

 

BNPL

expired

Final status

 

 

  1. Missing Parameters:

{ "error": 203, "message": "Empty request /api/info203" }

Indicates that the request is missing required parameters.

  1. Total Basket Amount Outside Financing Ranges:

{ "error": 210, "message": "Total basket amount (31000) is below or above financing limits /api/info210" }

Indicates that the total basket amount exceeds the allowable financing limits.

  1. Incorrect Reseller Code or Key Matching, or Incorrect Encryption:

{ "error": 205, "message": "Access denied /api/info205" }

Indicates that there is an issue with the reseller code, key matching, or encryption used.

  1. Incorrect Parameters:

{ "error": 209, "message": "Missing mandatory parameters in the items list /api/info209" }

Indicates that there are incorrect parameters provided in the request's items list.

 

 

Get Application Status

Overview

 

After successfully sending an application, the response will include an order_id and token. You can use these, along with the reseller_code and reseller_key, to request and track the application's status and its movement through the assessment process. This API endpoint exclusively supports the POST method.

Parameters

Parameter

Description

Type

Required

Parameter

Description

Type

Required

reseller_code

Identifies the merchant in the system

String

Yes

reseller_key

Validates the merchant

String

Yes

order_id

Order ID received with Register Application method

Int

Yes

token

Token received with Register Application method

String

Yes

Examples

Input:

curl --location '<https://beta.tbibank.support/api/GetApplicationStatus>' \ --header 'Content-Type: application/json' \ --data '{ "reseller_code": "TBI1", "reseller_key": "EX1", "order_id": 20, "token": "b5f80fc011c052231240e1cf267e9ebbbc55" }'

Output:

{ "error": 0, "store_order_id": "230110114428803", "status": "Draft", "status_chain": [ { "datetime": "30.03.2023 12:11:22", "status": "Draft" }, { "datetime": "30.03.2023 12:15:22", "status": "InProgress" } ] }

Here, store_order_id refers to the order ID on the merchant's side, which is sent in the Register Application method.

Get Application Data

Overview

After successfully sending an application, the response will include an order_id and token. You can use these, along with the reseller_code and reseller_key, to request and track the application's data and some of its details like store_order_id (the id in the merchants store), latest status, downpayment, installment and period of the loan application. This API endpoint exclusively supports the POST method.

Parameters

Parameter

Description

Type

Required

Parameter

Description

Type

Required

reseller_code

Identifies the merchant in the system

String

Yes

reseller_key

Validates the merchant

String

Yes

order_id

Order ID received with Register Application method

Int

Yes

token

Token received with Register Application method

String

Yes

Examples

Input:

curl --location '<https://beta.tbibank.support/api/GetApplicationData>' \ --header 'Content-Type: application/json' \ --data '{ "reseller_code": "TBI1", "reseller_key": "EX1", "order_id": 20, "token": "b5f80fc011c052231240e1cf267e9ebbbc55" }'

Output:

{ "error": 0, "store_order_id": "2973", "status": "MP Sent", "downpayment": "1270.00", "installment": "146.07", "period": 12 }

Here, store_order_id refers to the order ID on the merchant's side, which is sent in the Register Application method. status is the latest status of the application. downpayment is either NULL (if not downpayment is used or not eligible for the merchant) or a double value - the amount of downpayment selected by the customer. installment is the amount of the monthly installment of the remaining amount. period is an integer and show the selected period of the application.

 

Ready-Embedded Calculator

 

Using the reseller_code, reseller_key, and the total basket amount, you can call a dynamic URL to present available repayment schemes:

In the tbi system, additional schemes can be added depending on the category ID. For example, the second link above triggers two more schemes, which are only available for category ID 255. This category ID should also be sent in the item list category field.

 

Express Buy Button Integration on Product Page

 

An express buy with tbi button can be implemented in product page using a callback if customer finishes the application in tbi redirected URL. To use this option the merchant need an endpoint which will receive a POST message with a body similar to tbi RegisterApplication with encrypted data. This endpoint needs to return 'order_id' that is created in the merchant website.

If the order_id has value 0 when registering the initial application tbi will send back the information with customer details back to the mechant and will use the returned order_id to be visible in Merchant Portal.

Integration Process Overview:

  1. Merchant Initialization: Send the application with missing data and "orderid": "0" as follows:

{ "orderid": "0", "firstname": "", "lastname": "", "surname": "", "email": "", "phone": "", "deliveryaddress": { "country": "", "county": "", "city": "", "streetname": "", "streetno": "", "buildingno": "", "entranceno": "", "floorno": "", "apartmentno": "", "postalcode": "" }, "items": [ { "name": "Sport Elegant Pants", "description": "", "qty": "3", "price": "34.99", "sku": "3345", "category": "9", "imagelink": "<https://tbi-uat.online/hat/hat.jpg>" }, { "name": "Blouse Raita", "description": "", "qty": "1", "price": "110.65", "sku": "5566", "category": "4", "imagelink": "<https://tbi-uat.online/hat/hat.jpg>" } ], "promo": true, "successRedirectURL": "<https://testsuccess.com>", "failRedirectURL": "<https://testfail.com>" }
  1. TBI Response: TBI will respond with:

{ "reseller_code": "TBI1", "reseller_key": "EX1", "data": "ENCRYPTED_BODY" }
  1. Decryption: Decrypt the data field to obtain the following JSON format. Note that the period can represent either a period in months or 'BNPL'. Also, the sku field is replaced with code in the items list:

{ "firstname": "John", "lastname": "Dow", "surname": "", "email": "test@tbibank.bg", "phone": "0879123456", "deliveryaddress": { "country": "", "county": "", "city": "", "streetname": "", "streetno": "", "buildingno": "", "entranceno": "", "floorno": "", "apartmentno": "", "postalcode": "" }, "items": [ { "name": "Sport Elegant Pants", "description": "", "qty": "3", "price": "34.99", "code": "3345", "category": "111", "imagelink": "<https://tbi-uat.online/hat/hat.jpg>" }, { "name": "Blouse Raita", "description": "", "qty": "1", "price": "110.65", "code": "5566", "category": "111", "imagelink": "<https://tbi-uat.online/hat/hat.jpg>" } ], "period": 34 }

Add to cart functionality

 

On choosing a scheme and/or downpayment, our calculator’s JS will return a message via

targetWindow.postMessage(message, '*');

The content of the message will be a JSON in the following format as example

{"scheme_id" : 477, "downpayment" : 150}

The Merchants website must catch this message and read it

Example code to include:

const FPTBI_ORIGIN = 'https://beta.tbibank.support'; window.addEventListener('message', (e) => { if (e.origin === FPTBI_ORIGIN) { try { const jsonObject = JSON.parse(e.data); if (jsonObject.scheme_id !== undefined || jsonObject.downpayment !== undefined) { // Merchants defatul logic for adding to cart, includiding the scheme_id and downpayment in some sort of session data } //if it's a success, then close the pop-up or return the product page with the default add to cart message } catch (error) { console.error('Invalid JSON string:', error); } } });

 

We need the scheme_id and/or downpayment to be accessible in checkout. If they are - then include them in the RegisterApplication request, just like that:

 

$data_array = [ "orderid" => "123", "firstname" => "Тест", "lastname" => "Тестов", "surname" => "", "email" => "test@tbibank.bg", "phone" => "1231231231", "deliveryaddress" => [ "country" => "Bulgaria", "county" => "", "city" => "София", "streetname" => "ГМ Димитров", "streetno" => "62", "buildingno" => "", "entranceno" => "", "floorno" => "321", "apartmentno" => "123", "postalcode" => "" ], "items" => [ [ "name" => "Спортно елегантен панталон", "description" => "", "qty" => "3", "price" => "34.99", "sku" => "3345", "category" => "255", "imagelink" => "https://tbi-uat.online/hat/hat.jpg" ], [ "name" => "Блуза раета", "description" => "", "qty" => "1", "price" => "90.65", "sku" => "5566", "category" => "255", "imagelink" => "https://tbi-uat.online/hat/hat.jpg" ] ], "successRedirectURL" => "https://success.com", "failRedirectURL" => "https://fail.com", //add the values here "scheme_id" => 755, "downpayment" => 155 ];

 

Example files

 

– can be used as a reference to get repayments schemes. registerApplication.php – an example application encryption and cURL request getStatusUpdate.php – an example cURL for status update

– an encryption model file for encrypting sensitive data in the Register Application method.

For different programming languages additional model files can be provided