Data Migration

Use the Transaction Processing endpoint to migrate historical data: POST /api/v1/client/transaction-process

This endpoint serves two purposes:

  1. Risk scoring — calculates a fraud score for each transaction
  2. Data storage — saves transaction data in the antifraud system

Each transaction requires a separate API call.


Example: ACCEPT Status

curl -X POST 'https://api.embermind.ch/api/v1/client/transaction-process' \
  -H 'Content-Type: application/json' \
  -H 'x-api-key: xxx-yyy-zzz' \
  -d '{
    "externalId": "txn_12345",
    "status": "ACCEPT",
    "type": "PAYMENT",
    "dateStart": "2024-01-15T10:30:00.000Z",
    "dateEnd": "2024-01-15T10:31:00.000Z",
    "currency": "EUR",
    "amount": "100.50",
    "merchantExternalId": "merchant_001",
    "merchantTitle": "My Merchant",
    "merchantAccountExternalId": "account_001",
    "merchantAccountTitle": "Main Account",
    "email": "[email protected]",
    "phone": "+79998887766",
    "cardToken": "card_token_hash",
    "cardBin": "411111",
    "cardCountry": "DE",
    "cardLastFourDigit": "1234",
    "cardExpireDate": "08/28",
    "cardHolder": "John Doe",
    "ipAddress": "1.2.3.4",
    "ipAddressCountry": "DE",
    "fingerprint": "fp_abc123",
    "cascade": {
      "externalId": "cascade_001",
      "title": "Main Cascade",
      "gateList": [
        {
          "externalId": "gate_001",
          "title": "Gate 1",
          "bankExternalId": "bank_001",
          "bankTitle": "Bank 1",
          "currency": "EUR",
          "serialNumber": 1,
          "status": "ACCEPT"
        }
      ]
    }
  }'

Example: DECLINE Status

When a transaction is declined, you must specify declineBy to indicate whether it was rejected by the bank or the system.

curl -X POST 'https://api.embermind.ch/api/v1/client/transaction-process' \
  -H 'Content-Type: application/json' \
  -H 'x-api-key: xxx-yyy-zzz' \
  -d '{
    "externalId": "txn_12346",
    "status": "DECLINE",
    "type": "PAYMENT",
    "dateStart": "2024-01-15T10:32:00.000Z",
    "dateEnd": "2024-01-15T10:33:00.000Z",
    "currency": "EUR",
    "amount": "250.00",
    "merchantExternalId": "merchant_001",
    "merchantTitle": "My Merchant",
    "merchantAccountExternalId": "account_001",
    "merchantAccountTitle": "Main Account",
    "email": "[email protected]",
    "cardToken": "card_token_hash",
    "cardBin": "411111",
    "cardCountry": "DE",
    "cardLastFourDigit": "1234",
    "ipAddress": "1.2.3.4",
    "cascade": {
      "externalId": "cascade_001",
      "title": "Main Cascade",
      "gateList": [
        {
          "externalId": "gate_001",
          "title": "Gate 1",
          "bankExternalId": "bank_001",
          "bankTitle": "Bank 1",
          "currency": "EUR",
          "serialNumber": 1,
          "status": "DECLINE",
          "declineBy": "BANK",
          "errorReason": "DO_NOT_HONOUR_PROCESSING_ERROR"
        }
      ]
    }
  }'

Response Example

Response (200 OK):

{
  "transactionId": "69e45d20-98a9-4c75-ab60-1188d64d510a",
  "transactionExternalId": "txn_12345",
  "isNeedCheckReturnUrl": false,
  "scoreResultList": [
    {
      "gateExternalId": "gate_001",
      "scoreValue": 15,
      "badScoreBorder": 41,
      "scoreItemList": [
        {
          "type": "CARD_COUNT_PER_ONE_FINGERPRINT",
          "scoreValue": 5
        },
        {
          "type": "EMAIL_COUNT_PER_CUSTOMER",
          "scoreValue": 10
        }
      ]
    }
  ]
}

Request Parameters

Core Fields

ParameterTypeDescription
externalIdstringRequired. Unique transaction identifier in your system. Must be unique within a single company.
statusstringRequired. Transaction status: NEW, PENDING, ACCEPT, or DECLINE.
typestringRequired. Transaction type: PAYMENT or WITHDRAW.
dateStartstringTransaction start timestamp (ISO 8601).
dateEndstringTransaction end timestamp (ISO 8601).
currencystringTransaction currency (ISO 4217).
amountstringTransaction amount.
descriptionstringTransaction description.
paymentMethodstringPayment method information.

Merchant Information

ParameterTypeDescription
merchantExternalIdstringMerchant identifier in your system. Created automatically if not exists.
merchantTitlestringMerchant display name.
merchantAccountExternalIdstringMerchant account identifier. Created automatically if not exists.
merchantAccountTitlestringMerchant account display name.
mccIdstringMerchant Category Code.

Order Information

ParameterTypeDescription
merchantOrderIdstringMerchant order identifier.
processingOrderIdstringProcessing order identifier.
externalOrderIdstringExternal order identifier.
rrnstringRetrieval Reference Number.

Customer Information

ParameterTypeDescription
customerExternalIdstringCustomer identifier in your system.
emailstringCustomer email address.
phonestringCustomer phone number.
phoneCountrystringCustomer phone country code.
dateOfBirthdaystringCustomer date of birth.
isFtdbooleanFlag indicating customer's first transaction.
isKycPassedbooleanKYC verification status.
registrationDatestringCustomer registration date.
lastLoginDatestringCustomer last login date.
withdrawalCountnumberNumber of customer withdrawals.
depositCountnumberNumber of customer deposits.

Card Information

ParameterTypeDescription
cardTokenstringTokenized card identifier.
cardBinstringCard BIN (first 6 digits).
cardCountrystringCard issuing country code.
cardLastFourDigitstringLast 4 digits of card number.
cardExpireDatestringCard expiration date (MM/YY).
cardHolderstringCardholder name.

Device & Location Information

ParameterTypeDescription
ipAddressstringCustomer IP address.
ipAddressCountrystringCountry code derived from IP.
fingerprintstringBrowser fingerprint identifier.
browserTimezonestringCustomer timezone (e.g., UTC+4).
browserDataobjectRaw browser data from SDK.

Address Information

ParameterTypeDescription
addressFullstringFull customer address.
address1stringAddress line 1.
address2stringAddress line 2.
citystringCustomer city.
countrystringCustomer country.
postalCodestringPostal code.
regionstringCustomer region/state.
langstringCustomer language code.

Return URLs

ParameterTypeDescription
successReturnUrlstringURL for redirect after successful payment.
failReturnUrlstringURL for redirect after failed payment.

Additional Data

ParameterTypeDescription
customDataobjectArbitrary JSON data for your reference.

Cascade Object

ParameterTypeDescription
cascade.externalIdstringCascade identifier. Created if not exists.
cascade.titlestringCascade display name.
cascade.gateListarrayArray of gates in the cascade.

Gate Object (inside cascade.gateList)

ParameterTypeDescription
externalIdstringGate identifier. Created if not exists.
titlestringGate display name.
bankExternalIdstringBank identifier. Created if not exists.
bankTitlestringBank display name.
currencystringGate currency.
serialNumbernumberGate position in cascade sequence.
statusstringGate status: NEW, ACCEPT, or DECLINE. If DECLINE, declineBy is required.
declineBystringWho rejected: BANK or SYSTEM. Required when status=DECLINE.
errorReasonstringDecline reason code (see values below).
commissionInfo.amountGateCurrencystringCommission amount in gate currency.
commissionInfo.amountTransactionCurrencystringCommission amount in transaction currency.

Error Reason Values

ValueDescription
PROCESSING_ERRORGeneral processing error
AUTHENTICATION_PROCESSING_ERRORAuthentication failed
DO_NOT_HONOUR_PROCESSING_ERRORDo not honour
EMITTER_DENIAL_PROCESSING_ERRORIssuer denial
FORM_TIMEOUT_PROCESSING_ERRORPayment form timeout
INSUFFICIENT_FUNDS_PROCESSING_ERRORInsufficient funds
LIMIT_PROCESSING_ERRORLimit exceeded
PROCESSOR_DENIAL_PROCESSING_ERRORProcessor denial
THREEDS_REDIRECT_TIMEOUT_PROCESSING_ERROR3DS redirect timeout
THREEDS_TIMEOUT_PROCESSING_ERROR3DS timeout
TECHNICAL_PROCESSING_ERRORTechnical error
VALIDATION_PROCESSING_ERRORValidation error
CARD_TEMPORARILY_BLOCKEDCard temporarily blocked
PLATFORM_ERROR_CARD_BRAND_UNAVAILABLECard brand unavailable
PLATFORM_ERROR_GATE_SKIPPEDGate skipped

Transaction Status Flow

Transactions progress through statuses in one direction only:

NEW → PENDING → ACCEPT
                   or
             → DECLINE

Status cannot be reverted. Once a transaction reaches ACCEPT or DECLINE, it cannot be changed.


Update Rules

  • All fields can be updated except dateStart
  • Data is additive — the API only adds data, never deletes
    • Example: If you submit a transaction with 10 gates, then resubmit with 10 different gates, the system stores all 20 gates

Currency Conversion

  • All transaction amounts are automatically converted and stored in USD
  • Exchange rates are sourced from openexchangerates.org

Post-Migration: Enable Scoring

After data migration is complete:

  1. Contact your manager to activate the required score generators
  2. Start sending real-time transaction data using the same endpoint