Skip to content

IF Transactions

Endpoint to add fan transactions to the system.

URLs

MethodURLActionDescription
POST/api/v2/IF_ID_BatchRegisterAdds fan transactions to the system

Production:

{connect-producao}/api/v2/IF_ID_Batch

Staging:

{connect-homologacao}/api/v2/IF_ID_Batch

Authentication

All requests require an access token obtained from the Security endpoint. The token must be sent in the AccessToken header.

Add Transactions

Request

Endpoint: POST {connect-producao}/api/v2/IF_ID_Batch

Headers:

AccessToken: {access_token}
Content-Type: application/json

Body:

json
[
  {
    "userCode": "12345678900",
    "userCodeType": 1,
    "system": 0,
    "name": "John Silva",
    "email": "john@example.com",
    "emailVerified": true,
    "cpf": "12345678900",
    "gender": "M",
    "birthday": "15/08/1980",
    "mobile": "+5511999999999",
    "phone": "+5511888888888",
    "addr1": "Example Street",
    "addr2": "Apt 101",
    "addrNumber": 123,
    "addr3": "Downtown",
    "addrCity": "São Paulo",
    "addrState": "SP",
    "addrZip": "01234567",
    "addrCountry": "31",
    "transactions": [
      {
        "externalCode": "SALE-001",
        "date": "2025-09-20T18:41:31.219Z",
        "type": 1,
        "productType": 1,
        "productDesc": "Example Product",
        "productExternalCode": "PROD-001",
        "qty": 2,
        "value": 100.00,
        "channel": "Online Store",
        "deliveryMode": "Delivery",
        "priceType": "Normal",
        "cupon": "DISCOUNT10",
        "paymentMode": "Credit Card",
        "complement": "{\"line\": 1}",
        "discount": "Discount coupon",
        "discountValue": 10.00
      }
    ]
  }
]

Body Fields

Buyer Data

FieldTypeRequiredDescription
userCodestringYesBuyer's CPF or email
userCodeTypenumberYesCode type: 1 for CPF, 4 for email
systemnumberYesSource system (defined by Fanbase)
namestringYesBuyer's name
emailstringYesBuyer's email
emailVerifiedbooleanYesIndicates if email was verified
cpfstringYesBuyer's CPF
genderstringNoGender: M/F/O/null
birthdaystringNoDate of birth (format DD/MM/YYYY)
mobilestringNoMobile phone
phonestringNoAlternative phone
addr1stringNoStreet
addr2stringNoComplement
addrNumbernumberNoHouse number
addr3stringNoNeighborhood
addrCitystringNoCity
addrStatestringNoState (2 digits: SP/DF/etc)
addrZipstringNoZIP code
addrCountrystringNoCountry numeric code

Transactions

FieldTypeRequiredDescription
externalCodestringYesUnique transaction code in source system
datedatetimeYesTransaction date (ISO 8601)
typenumberYesType: 1 (sale), 2 (return), 161 (coupon used), 162 (coupon not used)
productTypenumberYesType: 1 (product), 2 (service)
productDescstringYesProduct description
productPricenumberNoObsolete - ignore
productExternalCodestringYesProduct code in source system
qtynumberYesQuantity
valuenumberYesProduct unit value
channelstringYesSales channel (e.g., store name)
deliveryModestringYesDelivery mode
priceTypestringYesPrice type
cuponstringNoDiscount coupon code
paymentModestringYesPayment mode (e.g., Credit Card, Pix)
complementstringNoComplementary data (JSON string)
discountstringNoDiscount reason
discountValuenumberNoDiscount value

Success Response

Status: 200 OK

json
{
  "header": {
    "codigo": 1,
    "msg": "Transactions processed successfully"
  },
  "data": {
    "total": 1,
    "processadas": 1,
    "erros": 0
  }
}

Implementation Example

javascript
async function addTransactions(transactions, accessToken) {
  const response = await fetch('{connect-producao}/api/v2/IF_ID_Batch', {
    method: 'POST',
    headers: {
      'AccessToken': accessToken,
      'Content-Type': 'application/json'
    },
    body: JSON.stringify(transactions)
  });

  if (!response.ok) {
    throw new Error(`Error ${response.status}: ${response.statusText}`);
  }

  return await response.json();
}

Fanbase API Documentation