Skip to main content

10. API Integration (Detailed)

Without using a widget, the entire payment process is managed by the merchant backend. This method is recommended for integrations that require full control and customization.

10.1 API Payment Flow (Step-by-Step)

1 – AccessToken is Purchased

/auth/api/token/connect

2 – Installment and POS Information is Returned

/b2c/paymentOptions

3 – Payment Starts

/b2c/payment

4 – (Optional) 3D Process

  • If use3D = true
  • redirectTo redirects to the URL
  • Bank verification is completed
  • User returns to returnUrl

10.2 PaymentOptions

Endpoint: GET /b2c/paymentOptions

Header

AreaTypeMandatoryDescription
Proxy-AuthorizationstringBearer {AccessToken}

Note: AccessToken is used in some implementations of API flow (difference from widget)

Query Parameters

AreaTypeMandatoryDescription
binNumberstringFirst 6-8 digits of the card
amountdecimalTransaction amount
currencystringPara birimi

Response Model

Root Object

AreaTypeDescription
idintKart program ID
namestringCard program name
postTitlestringPOS description
isDefaultPosbooleanDefault POS information
installmentsarrayInstallment options

installments Object

AreaTypeDescription
currencyIdstringPara birimi
amountdecimalTotal transaction amount
installment intNumber of installments
installmentAmountdecimalAmount per installment
tokenstringInstallmentToken (kritik)
processAmountdecimalTransaction amount
commRatedecimalCommission rate
posIdintPOS ID
commApplyTypeIdintKomisyon tipi

Critical Note

  • token field (InstallmentToken) is required at checkout
  • Without this token the /payment call will fail

10.3 Payment

Endpoint: POST /b2c/payment

Header

AreaTypeMandatoryDescription
AuthorizationstringBearer {AccessToken}

Request Body

card Object

AreaTypeMandatoryDescription
cardNumberstringCard number
cardHolderNamestringName on card
cvvstringCVV
expMonthintSon kullanma ay
expYearintExpiry year

Root Areas

AreaTypeMandatoryDescription
cardobjectKart bilgileri
returnUrlstring3D post redirect URL
clientReferenceCodestringMerchant order reference
use3DbooleanUsing 3D Secure
installmentTokenstringPaymentOptions’tan gelen token
customerIpAddressstringUser IP address

Request Example

{
"card": {
"cardNumber": "4155650100416111",
"cardHolderName": "Test Test",
"cvv": "000",
"expMonth": 12,
"expYear": 2026
},
"returnUrl": "https://merchant.com",
"clientReferenceCode": "ORDER123",
"use3D": true,
"installmentToken": "INSTALLMENT_TOKEN",
"customerIpAddress": "78.190.57.187"
}

Response Model

AreaTypeDescription
paymentTypestringRedirectUrl / DirectSale
redirectTostring3D redirect URL
orderIdstringFinrota transaction ID
clientReferenceCodestringMerchant reference
successbooleanTransaction result
errorstringError message

10.4 3D Secure Stream

Scenario

When use3D = true is sent:

Response

{
"paymentType": "RedirectUrl",
"redirectTo": "https://bank-3d-url",
"success": false
}

Flow

  1. Merchant backend → receives response
  2. Frontend → redirects the user to redirectTo
  3. User → verifies OTP at bank
  4. Bank → redirects the user to returnUrl
  5. Merchant → processes the result (success / failure)

Critical Points

  • redirectTo must be opened in the frontend
  • returnUrl endpoint must be idempotent
  • Duplicate check should be done for the same transaction

10.5 Direct Sale Flow

Response

{
"paymentType": "DirectSale",
"success": true
}

Flow

  • Payment is completed instantly
  • There are no additional redirects
  • The result is taken from the response

10.6 Error Scenarios

StatusDescription
401Token invalid
400Missing / faulty parameter
500System error
success=falseBank or payment error

10.7 API vs Widget Difference

KonuAPIWidget
Kart verisiBackendFrontend
PCI payloadMerchantFinrota
UXMerchant managesReady
TokenAccessTokenWidgetToken + AccessToken

14. API Payment Flow (Step-by-Step)

1 – AccessToken is Purchased

AccessToken is Purchased

2 – Installment and POS Information is Returned

Installment and POS Information is Returned

3 – Payment Starts

Payment Starts

4 – (Optional) 3D Process

3D Process - 1 3D Process - 2

Payment Cancellation

Payment Cancellation

Payment Refund

Payment Refund