Add/Return Transaction in Bulk

Add Transaction API

Use this API to add a customer transaction to the loyalty system. Supports regular purchases, returns, and not-interested transactions.

Example request

curl --location 'https://eu.api.capillarytech.com/v2/transactions/bulk' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic VjMT' \
--data '[
    {
        "identifierType": "mobile",
        "identifierValue": "919999988886",
        "source": "INSTORE",
        "accountId": "",
        "type": "REGULAR",
        "billNumber": "test00transact087",
        "billingDate": "2025-04-11T11:00:00+05:30",
        "discount": "",
        "billAmount": "6000.0",
        "note": "Transaction number 87",
        "grossAmount": "110",
        "deliveryStatus": "PLACED",
        "paymentModes": [
            {
                "mode": "CardPayment",
                "value": "6000.0",
                "notes": "SPay",
                "attributes": {
                    "card_type": "Visa"
                }
            }
        ],
        "lineItemsV2": [
            {
                "itemCode": "model_id_001",
                "amount": 2000.0,
                "description": "Steel Bottle",
                "discount": 0,
                "rate": 500.0,
                "qty": 4,
                "value": 2000.0,
                "extendedFields": {
                    "MetalRate": "22.02",
                    "GrossWeight": "10.50"
                }
            },
            {
                "itemCode": "model_id_002",
                "amount": 2000.0,
                "description": "Sports Shoe",
                "discount": 0,
                "rate": 1000.0,
                "value": 2000.0,
                "qty": 2,
                "extendedFields": {
                    "MetalRate": "22.02",
                    "GrossWeight": "10.50"
                }
            },
            {
                "itemCode": "model_id_003",
                "amount": 2000.0,
                "rate": 2000.0,
                "qty": 1,
                "value": 2000.0,
                "extendedFields": {
                    "gender": "Male",
                    "marital_status": "Married"
                },
                "customFields": {
                    "cashierid": "jim2345",
                    "city": "Bangalore"
                }
            } 
        ]
    },
    {
        "identifierType": "mobile",
        "identifierValue": "919999988886",
        "source": "INSTORE",
        "accountId": "",
        "type": "REGULAR",
        "billNumber": "test00transact086",
        "billingDate": "2025-04-11T11:00:00+05:30",
        "discount": "1000",
        "billAmount": "6000.0",
        "note": "Transaction number 86",
        "grossAmount": "7000",
        "deliveryStatus": "PLACED",
        "paymentModes": [
            {
                "mode": "CardPayment",
                "value": "6000.0",
                "notes": "SPay",
                "attributes": {
                    "card_type": "Visa"
                }
            }
        ],
        "lineItemsV2": [
            {
                "itemCode": "model_id_001",
                "amount": 2000.0,
                "description": "Steel Bottle",
                "discount": 1000.0,
                "rate": 750.0,
                "qty": 4,
                "value": 3000.0,
                "extendedFields": {
                    "MetalRate": "22.02",
                    "GrossWeight": "10.50"
                }
            },
            {
                "itemCode": "model_id_002",
                "amount": 2000.0,
                "description": "Sports Shoe",
                "discount": 0,
                "rate": 1000.0,
                "value": 2000.0,
                "qty": 2,
                "extendedFields": {
                    "MetalRate": "22.02",
                    "GrossWeight": "10.50"
                }
            },
            {
                "itemCode": "model_id_003",
                "amount": 2000.0,
                "rate": 2000.0,
                "qty": 1,
                "value": 2000.0,
                "extendedFields": {
                    "gender": "Male",
                    "marital_status": "Married"
                },
                "customFields": {
                    "cashierid": "jim2345",
                    "city": "Bangalore"
                }
            }    
        ]
    }
]'

Prerequisites

  • Authentication details
  • Authorization/access group details
🚧

You cannot register a customer with this API. Pass only registered customer identifiers.

Header information

Header nameDescription
SKIP-DOWNSTREAMWhen set to true, the transaction is written directly to the database without notifying downstream systems (Loyalty Engine/EMF or event notification services). No loyalty actions or event triggers are executed. Use this to import transaction data without generating side effects.

Path parameters

Not applicable.

Query parameters

Not applicable.

Body parameters

Transaction (top level)

FieldTypeRequiredDescription
identifierTypeenumYesRegistered identifier type of the customer. Values: mobile, email, externalId, wechat, martjackId, fbId, id.
identifierValuestringYesValue for the specified identifierType. This field is mandatory when identifierType is mobile. For example, if identifierType is mobile, pass the mobile number. If missing or empty, the API returns a 400 Bad Request error.
sourceenumYesSource from which the transaction originates. Values: INSTORE, WECHAT, MARTJACK, WEB_ENGAGE, ECOMMERCE, JD, TAOBAO, TMALL, FACEBOOK, WEBSITE, OTHERS.
accountIdstringOptionalFor multi-account sources such as MARTJACK and WECHAT, pass the respective account ID.
typeenumYesTransaction type. Values: REGULAR, RETURN, NOT_INTERESTED, NOT_INTERESTED_RETURN.
notInterestedReasonstringOptionalReason the customer declined loyalty enrollment. Applicable when type is NOT_INTERESTED. Max 255 characters.
returnTypeenumConditionalReturn type. Required when type is RETURN. Values: AMOUNT, FULL, LINE_ITEM, CANCELLED.

Note: For NOT_INTERESTED_RETURN transactions, only AMOUNT, FULL, and LINE_ITEM are valid. CANCELLED is not supported for this type.
billNumberstringYesUnique transaction number. For return transactions, pass the original transaction's bill number. Max 50 characters. Uniqueness scope (till, store, or org) is org-configured.
idlongOptionalTransaction ID of the transaction to return. Use when CONF_LOYALTY_BILL_NUMBER_UNIQUE_ONLY_STORE is enabled and the same bill number exists across multiple stores, to identify which specific transaction to return.
billAmountdoubleYesNet transaction amount. Negative values are not accepted.
billingDatedate-timeOptionalDate and time of the transaction. ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ.
discountdoubleOptionalDiscount amount applied at the transaction level. Negative values are not accepted.
grossAmountdoubleOptionalTransaction amount before discount.
outlierStatusenumOptionalTransaction-level outlier status. Overrides configured outlier settings. Values: NORMAL, INTERNAL, FRAUD, OUTLIER, TEST, DELETED, FAILED, OTHER.
notestringOptionalAdditional information about the transaction.
deliveryStatusenumOptionalDelivery status of the item. Values: PLACED, PROCESSED, SHIPPED, DELIVERED, RETURNED. Update this field using v2/transaction/update.
purchaseTimedate-timeConditionalBilling time of the original transaction for which a return is being made. Required when type is RETURN. ISO 8601: YYYY-MM-DDTHH:MM:SSZ.
currencyCodestringOptionalISO currency code for transactions in local currency. Examples: INR, SGD, EUR, IQD. The currency must be enabled in InTouch > Organization Setup and a conversion ratio must be set via v2/currencyratio.
addWithLocalCurrencybooleanOptionalPass true to add the transaction in local currency.
promotionEvaluationIdstringOptionalPromotion evaluation code (cart or catalog) applied to the transaction.
appliedPromotionIdentifiersarrayOptionalBase64-encoded cart or catalog promotion identifiers applied to the transaction. Each entry contains: promotionId, discount, amount, discountAppliedQty, promotionAppliedQty, redemptionCount, sku, version.
loyaltyPromotionIdentifiersarrayOptionalIdentifiers of loyalty promotions to tag to the transaction.
extendedFieldsobjectOptionalTransaction-level extended field details as name-value pairs.
lineItemsV2objectOptionalLine item details. See lineItemsV2 object.
attributionobjectOptionalMaps the transaction to a different user or till. See attribution object.
redemptionsobjectOptionalPoints and coupon redemption details. See redemptions object.
paymentModesobjectOptionalPayment mode details. See paymentModes object.

User group parameters

Use these parameters to associate the transaction with a user group. At least one userGroup2 parameter is required to make the association.

FieldTypeRequiredDescription
userGroup2IdintConditionalUnique ID of the user group.
userGroup2PrimaryUserIdlongConditionalUser ID of the primary group member.
userGroup2ExternalIdstringConditionalExternal ID of the user group.
userGroup2PrimaryUserIdentifierTypeenumConditionalIdentifier type for the group primary member. Values: mobile, email, externalId, wechat, martjackId, fbId, id.
userGroup2PrimaryUserIdentifierValuestringConditionalValue for the specified group identifier type.
userGroup2PrimaryUserSourceenumConditionalSource in which the group primary member's identifier is registered. Values: INSTORE, WECHAT, MARTJACK, WEB_ENGAGE, ECOMMERCE, JD, TAOBAO, TMALL, FACEBOOK, WEBSITE, OTHERS.
userGroup2PrimaryUserAccountIdstringConditionalAccount ID for multi-account sources such as WECHAT.

attribution object

FieldTypeRequiredDescription
createDatedate-timeOptionalDate of the transaction. ISO 8601 format.
createdByobjectOptionalUser ID or store entity (till, store) to associate with the transaction.
createdBy.codestringOptionalUnique code of the entity.
createdBy.typeenumOptionalType of the attribution entity. Values: ZONE, CONCEPT, STORE, TILL, STR_SERVER, ADMIN_USER, ASSOCIATE, RULE, OU.

lineItemsV2 object

📘

Note

Custom fields are supported only at the customer, bill, and redemption levels. Only extended fields are supported at the line item level.

FieldTypeRequiredDescription
amountdoubleOptionalNet line item amount (value minus discount).
descriptionstringOptionalShort description of the line item.
discountintOptionalDiscount applied to the line item.
itemCodestringOptionalUnique code of the line item.
qtydoubleOptionalQuantity of the line item.
ratedoubleOptionalPrice per unit.
serialstringOptionalSerial number of the line item.
valuedoubleOptionalGross amount of the line item (rate multiplied by qty).
returnablebooleanOptionalPass true if the item is eligible for return.
returnableDaysintOptionalMaximum number of days within which the item can be returned.
customFieldsobjectOptionalTransaction or line item-level custom field details.
imgUrlstringOptionalURL of the product image.
attributesobjectOptionalAttributes of combo, bundle, or split items.
comboDetailsobjectOptionalDetails of combo or bundle items.
addOnDetailsobjectOptionalDetails of add-on items.
splitDetailsobjectOptionalDetails of split items.
parentBillNumberstringOptionalOriginal transaction bill number for return line items in a mixed transaction (one that contains both purchase and return items).
purchaseTimedate-timeConditionalBilling time of the original transaction for which a return is being made. Required for return line items. ISO 8601: YYYY-MM-DDTHH:MM:SSZ.
returnTypeenumOptionalReturn type for the line item. Values: AMOUNT, FULL, LINE_ITEM. Not applicable when the transaction-level returnType is FULL or AMOUNT.
typeenumOptionalType of the line item. Values: REGULAR, NOT_INTERESTED, RETURN, NOT_INTERESTED_RETURN.
appliedPromotionIdentifiersarrayOptionalBase64-encoded cart or catalog promotions applied to the line item. Same structure as the transaction-level appliedPromotionIdentifiers.
extendedFieldsobjectOptionalLine item-level extended field details.

redemptions object

FieldTypeRequiredDescription
pointsRedemptionsarrayOptionalUnique points redemption IDs to apply to the transaction. Example: [727272, 237878].
couponRedemptionsarrayOptionalUnique coupon redemption IDs to apply to the transaction. Example: [727272, 237878].

paymentModes object

FieldTypeRequiredDescription
modestringOptionalPayment mode.
valuedoubleOptionalAmount paid via this mode.
notesstringOptionalAdditional payment mode information. Max 250 characters.
attributesobjectOptionalPayment mode attributes as name-value pairs.

Example response

{
    "response": [
        {
            "entityId": 884796252,
            "result": {
                "identifierType": "mobile",
                "identifierValue": "919999988886",
                "source": "INSTORE",
                "accountId": "",
                "deliveryStatus": "PLACED",
                "type": "REGULAR",
                "billAmount": 6000.0,
                "billNumber": "test00transact087",
                "grossAmount": 110.0,
                "note": "Transaction number 87",
                "lineItemsV2": [
                    {
                        "amount": 2000.0,
                        "description": "Steel Bottle",
                        "discount": 0.0,
                        "itemCode": "model_id_001",
                        "qty": 4.0,
                        "rate": 500.0,
                        "value": 2000.0,
                        "returnable": true,
                        "returnableDays": -1,
                        "comboDetails": [],
                        "addOnDetails": [],
                        "splitDetails": [],
                        "extendedFields": {
                            "GrossWeight": 10.5,
                            "MetalRate": 22.02
                        }
                    },
                    {
                        "amount": 2000.0,
                        "description": "Sports Shoe",
                        "discount": 0.0,
                        "itemCode": "model_id_002",
                        "qty": 2.0,
                        "rate": 1000.0,
                        "value": 2000.0,
                        "returnable": true,
                        "returnableDays": -1,
                        "comboDetails": [],
                        "addOnDetails": [],
                        "splitDetails": [],
                        "extendedFields": {
                            "GrossWeight": 10.5,
                            "MetalRate": 22.02
                        }
                    },
                    {
                        "amount": 2000.0,
                        "itemCode": "model_id_003",
                        "qty": 1.0,
                        "rate": 2000.0,
                        "value": 2000.0,
                        "returnable": true,
                        "returnableDays": -1,
                        "customFields": {
                            "cashierid": "jim2345",
                            "city": "Bangalore"
                        },
                        "comboDetails": [],
                        "addOnDetails": [],
                        "splitDetails": [],
                        "extendedFields": {}
                    }
                ],
                "notInterestedReason": "",
                "sideEffects": [
                    {
                        "entityType": "USER",
                        "rawAwardedPoints": 1.000,
                        "customerId": 564703252,
                        "awardedPoints": 1,
                        "type": "points"
                    }
                ],
                "isUseDefaultUserGroup2": false,
                "paymentModes": [
                    {
                        "mode": "CardPayment",
                        "value": 6000.0,
                        "notes": "SPay",
                        "attributes": {
                            "card_type": "Visa"
                        }
                    }
                ],
                "billingDate": "2025-04-11T05:30:00Z",
                "useDefaultUserGroup2": false
            },
            "errors": [],
            "warnings": [
                {
                    "status": false,
                    "code": 91016,
                    "message": "Extended field name gender is invalid."
                },
                {
                    "status": false,
                    "code": 91016,
                    "message": "Extended field name marital_status is invalid."
                }
            ],
            "loyaltyDetails": []
        },
        {
            "entityId": 884796253,
            "result": {
                "identifierType": "mobile",
                "identifierValue": "919999988886",
                "source": "INSTORE",
                "accountId": "",
                "deliveryStatus": "PLACED",
                "type": "REGULAR",
                "billAmount": 6000.0,
                "billNumber": "test00transact086",
                "discount": 1000.0,
                "grossAmount": 7000.0,
                "note": "Transaction number 86",
                "lineItemsV2": [
                    {
                        "amount": 2000.0,
                        "description": "Steel Bottle",
                        "discount": 1000.0,
                        "itemCode": "model_id_001",
                        "qty": 4.0,
                        "rate": 750.0,
                        "value": 3000.0,
                        "returnable": true,
                        "returnableDays": -1,
                        "comboDetails": [],
                        "addOnDetails": [],
                        "splitDetails": [],
                        "extendedFields": {
                            "GrossWeight": 10.5,
                            "MetalRate": 22.02
                        }
                    },
                    {
                        "amount": 2000.0,
                        "description": "Sports Shoe",
                        "discount": 0.0,
                        "itemCode": "model_id_002",
                        "qty": 2.0,
                        "rate": 1000.0,
                        "value": 2000.0,
                        "returnable": true,
                        "returnableDays": -1,
                        "comboDetails": [],
                        "addOnDetails": [],
                        "splitDetails": [],
                        "extendedFields": {
                            "GrossWeight": 10.5,
                            "MetalRate": 22.02
                        }
                    },
                    {
                        "amount": 2000.0,
                        "itemCode": "model_id_003",
                        "qty": 1.0,
                        "rate": 2000.0,
                        "value": 2000.0,
                        "returnable": true,
                        "returnableDays": -1,
                        "customFields": {
                            "cashierid": "jim2345",
                            "city": "Bangalore"
                        },
                        "comboDetails": [],
                        "addOnDetails": [],
                        "splitDetails": [],
                        "extendedFields": {}
                    }
                ],
                "notInterestedReason": "",
                "sideEffects": [],
                "isUseDefaultUserGroup2": false,
                "paymentModes": [
                    {
                        "mode": "CardPayment",
                        "value": 6000.0,
                        "notes": "SPay",
                        "attributes": {
                            "card_type": "Visa"
                        }
                    }
                ],
                "billingDate": "2025-04-11T05:30:00Z",
                "useDefaultUserGroup2": false
            },
            "errors": [],
            "warnings": [
                {
                    "status": false,
                    "code": 91016,
                    "message": "Extended field name gender is invalid."
                },
                {
                    "status": false,
                    "code": 91016,
                    "message": "Extended field name marital_status is invalid."
                }
            ],
            "loyaltyDetails": []
        }
    ],
    "totalCount": 2,
    "failureCount": 0
}

Error and warning codes

CodeTypeDescription
Time mismatch between billing time and response timeErrorTimezone conversion is not disabled. Enable CONF_ORG_DISABLE_MACHINE_TIME_CONV to store the time from the payload without UTC offset conversion. See Timezone Management.
624ErrorInvalid return transaction time. Return transaction should happen after add transaction. Include purchaseTime in the request payload.
400ErroridentifierValue is missing or empty when identifierType is mobile. The API returns a 400 Bad Request error in this case.

Configurations

To enable or disable any of the following configurations, raise a Jira ticket to the Capillary Product Support team.

ConfigurationDefaultDescription
CONF_ORG_DISABLE_MACHINE_TIME_CONVDisabledWhen enabled, stores the time from the payload without UTC offset conversion, for all clusters. See Timezone Management.
CONF_ALLOW_TRANSACTION_RETURN_AFTER_GROUP_TRANSITIONDisabledWhen enabled, allows returns for former group members. When a return is performed for a user who has left the group, points allocated to the group as part of the original transaction are also reverted.
CONF_POINTS_RETURN_ENABLEDEnabledWhen disabled, earned points are not reversed when a transaction is returned. To reverse points manually, use the Manual Points Adjustment API.
CONF_LOYALTY_BILL_NUMBER_UNIQUE_ONLY_STOREDisabledWhen enabled, bill number uniqueness is scoped to the store level. Use the id parameter in return transactions to disambiguate identical bill numbers across stores.
CONFIG_SKIP_SECONDARY_ID_ON_PRIMARY_MISMATCHDisabledWhen enabled, if the primary identifier differs but a secondary identifier matches, a new customer is registered with the primary identifier, ignoring the secondary. Configurable at InTouch > Organization Settings > Miscellaneous > Registration Page.