Transaction Request Body (Earn)

In this chapter, we will explain how to fill the body of transaction requests.

Minimal Transaction Body (Mandatory Fields)

The minimal set of receipt information (containing only mandatory fields) is the following:

{
"transactionType": "EARNTRANSACTION",
"amount": 99.90
}

with mandatory attributes

AttributeDescription
transactionTypeType of the transaction. For digital receipt, always use the value EARNTRANSACTION
amountTotal amount of the bon.

Maximal Transaction Body (Optional Fields)

The minimal setup is only providing the minimal functionality (i.e. store purchase-totals and connect them with loyalty-accounts). In order to benefit from a range of modules in the Convercus system, it may be necessary to add optional attributes.

The following example will give a maximal set of receipt information. The relevant fields for your implementation depend on the system and program setup and need to be coordinated with the program manager.

{
"transactionType": "EARNTRANSACTION",
"transactionTime": "2020-04-30T10:50:00+02:00",
"valueTime": "2020-04-30T10:50:00+02:00",
"externalId": "UniqueBonID",
"amount": 99.90,
"currencyCode": "EUR",
"lineItems": \[...],
"tenderItems": \[...],
"linkedTransaction": \{...}
"receiptImageData": "iVBORw0KGgoA...."
"receiptImageUrl": "[https://www..../receit1.png](https://www..../receit1.png)",
"reason": "Thank you for your purchase"
}

The following attributes may be used (if not stated otherwise, every attribute may only be used once):

AttributeDescriptionRelevance
transactionTypeType of the transaction. For digital receipt, also use the value EARNTRANSACTIONMandatory
transactionTimeISO 8601 datetime, when the transaction was created (i.e. datetime of the receipt). Either give the datetime in UTC (eg. 2020-04-08T10:50:00Z or in local-time with timezone (e.g. 2020-04-08T10:50:00+02:00 for CET with daylight-saving-time or 2020-01-08T10:50:00+01:00CET).Optional
valueTimeISO 8601 value datetime of the transaction (i.e. the datetime, when the booked transaction-points become active). Note: If this field is missing, the valueTime will be set to the time, when the transaction is processed in Convercus system. Do not fill this field unless you don’t want to have this standard-situation.Optional
externalIdUnique (over the program) Bon-ID. As a security measure (don’t incentivate the same bon twice), reoccuring bons with the same externalID are rejected by the system, so make sure that every bon-id is unique.Optional
amountTotal amount of the bon. Important: This amount should always be the same as the sum of all purchases and returns of the bon. Convercus-system rejects bons, where the amount is less the sum of lineItems. Any deviation should be checked before sending the bon as there may be an error in the bon-structure (e.g. missing positions).Mandatory
taxRateDEPRECIATED - is now at lineItem levelDepreciated
currencyCodeCurrency Code (e.g. EUR) of the total amount.Optional
lineItemsList of purchased line items of the bon. This attribute will be explained in more Detail in the respective subchapter.Optional
tenderItemsList of payment items of the bon. This attribute will be explained in more Detail in the respective subchapter.Optional
linkedTransactionLink to an existing transaction. This attribute will be explained in more Detail in the respective subchapter.Optional
receiptImageDataThe image resource encoded as Base64 string.Optional
receiptImageUrlOptional
reasonThis is a freetext, used to display the list of purchases in the Convercus app, and also visible in the Admin Portal. Example: “Thank you for your purchase.”Optional

lineItems Attribute

The minimal required set of information for a line-item is the following:

"lineItems": \[
\{
"sequenceNumber": 1,
"type": "SALE",
"itemID": "2758221",
"extendedAmount": 199.80
},
...
]

with mandatory attributes:

AttributeDescription
sequenceNumberSequence number of the line-item. This value is incremented with every line-item, starting at 1.
typeType of the transaction. The values SALE and RETURN are used to differentiate the processes of purchase and cancellation / return.
itemIDThis is the unique identifier of the product. Usually this is the article code in an external system (e.g. barcode). Note about Incentivation: On the level of this ID, it is possible to define incentivation rules (i.e. exclusion or multiple points). Thus, the set of IDs for this should be consistent over the whole program.
extendedAmountThis is the actual amount, this item was sold for. Accordingly, this value has to incorporate all given discounts. Note: Depending on the type of line-item, one has to keep track of the signs of this amount: SALE-transactions have positive signs, RETURN-transactions have negative signs.

Like before, the minimal setup is only providing the minimal functionality, which may be extended by adding optional attributes. For example, in order to be able to make special incentivation for certain line-items (e.g. exclusion from incentivation, extra-points), it’s important to provide a detailed and consistent set of information about the product itself.

In the following we will show maximal sets of information, also stressing the difference between SALE- and RETURN-transactions a little more.

Maximal SALE-lineItem

The SALE is most common and most important line-item-type as this is classic purchase line-item. Every purchase, which is printed on the bon should also be added to the lineItem-list.

Note, that Discounts should not produce a line-item for themselves. It is possible to track original pricing in the lineItem-element itself.

The following example will give a maximal set of SALE-line-item-information. The relevant fields for your implementation depend on the system and program setup and need to be coordinated with the program manager.

"lineItems": \[

\{

"sequenceNumber": 1,

"type": "SALE",

"itemID": "2758221",

"merchandiseGroupCode": "1201",

"merchandiseGroupName": "Shoes",

"merchandiseSubGroupCode": "120103",

"merchandiseSubGroupName": "Sneakers",

"brandCode": "10543280-CODE 123",

"description": "Test-Shoe",

"actualSalesUnitPrice": 99.90,

"quantity": 2,

"extendedAmount": 199.80,

"currencyCode": "EUR",

"taxRate": 19.00

}

]

The following attributes may be used (if not stated otherwise, every attribute may only be used once):

AttributeDescriptionRelevance
sequenceNumberSequence number of the line-item. This value is incremented with every line-item, starting at 1.Mandatory
typeType of the transaction. For purchases, the value is SALE.Mandatory
itemIDThis is the unique identifier of the product. Usually this is the article code in an external system (e.g. barcode). Note about Incentivation: On the level of this ID, it is possible to define incentivation rules (i.e. exclusion or multiple points). Thus, the set of IDs for this should be consistent over the whole program.Mandatory
merchandiseGroupCodeThis is the unique identifier of the product's merchandise group. Note about Incentivation: On the level of the ID, it is possible to define incentivation rules (i.e. exclusion or multiple points). Thus, the set of IDs for this should be consistent over the whole program.Optional
merchandiseGroupNameThis is the name of the product’s merchandise group.Optional
merchandiseSubGroupCodeThis is the unique identifier of the product's merchandise subgroup. Note about Incentivation: On the level of the ID, it is possible to define incentivation rules (i.e. exclusion or multiple points). Thus, the set of IDs for this should be consistent over the whole program.Optional
merchandiseSubGroupNameThis is the name of the product’s merchandise subgroup.Optional
brandCodeThis is the unique identifier for the product’s brand. The BrandCode can be used in coupon rules and as a trigger for checkout coupons.Optional
descriptionThis is the name or description of the product.Optional
actualSalesUnitPriceThis is the amount, a single item was sold for. So this value is equal to the regular unit price - all discounts on the level of this product. Note: For SALE-transaction, this value is always positive.Optional
quantityThis is the number of units, that were sold in this line-item.Optional
extendedAmountThis is the actual amount, this item was sold for. Accordingly, this value has to incorporate all given discounts. Note: For SALE-transaction, this value is always positive.Mandatory
currencyCodeCurrency Code (e.g. EUR) of the extendedAmount.Optional
taxRatePercentage of tax applied for this line-item.Optional

Maximal Return-lineItem

As it is also pretty common to have negative bookings in a bon, as products may be returned or cancelled altogether. Such line-items may be added as a RETURN-line-item. However, there are a few things, to be minded.

Note about the difference between Cancellation and Returns
The Convercus system does not differentiate between cancellation and return as both do basically the same: They refer to a previous, positive purchase / booking and negate it by adding a negativ purchase / booking.

Thus, all negative bookings (i.e. returns and cancellations) shall be mapped to a RETURN-line-item.

Note about the setup of Return line-items
RETURN-line-items have to have the exact same setup as the corresponding SALE-Line-item had. This secures the same treatment of the return while processing in order to rebook points. Therefore, especially all discounts given to the initial booking have to be added to the RETURN-item as well (so that the price is correct). Furthermore, the same product information has to be given (so that incentivation exclusion and extra-points are handled correctly). Note however, that RETURN-line-amounts have to have negative signs.

The following example will give a maximal set of RETURN-line-item-information. The relevant fields for your implementation depend on the system and program setup and need to be coordinated with the program manager.

"lineItems": [

{

"sequenceNumber": 1,

"type": "RETURN",

"itemID": "2758221",

"merchandiseGroupCode": "1201",

"merchandiseGroupName": "Shoes",

"merchandiseSubGroupCode": "120103",

"merchandiseSubGroupName": "Sneakers",

"brandCode": "10543280-CODE 123",

"description": "Test-Shoe",

"currencyCode": "EUR",

"actualSalesUnitPrice": -99.90,

"quantity": 1,

"extendedAmount": -99.90,

"taxRate": 19.00

}

]

The following attributes may be used (if not stated otherwise, every attribute may only be used once):

AttributeDescriptionRelevance
sequenceNumberSequence number of the line-item. This value is incremented with every line-item, starting at 1.Mandatory
typeType of the transaction. For cancellations and returns, the value is RETURN.Mandatory
itemIDThis is the unique identifier of the product. Usually this is the article code in an external system (e.g. barcode). Note about Incentivation: On the level of this ID, it is possible to define incentivation rules (i.e. exclusion or multiple points). Thus, the set of IDs for this should be consistent over the whole program.Mandatory
merchandiseGroupCodeThis is the unique identifier of the product's merchandise group. Note about Incentivation: On the level of the ID, it is possible to define incentivation rules (i.e. exclusion or multiple points). Thus, the set of IDs for this should be consistent over the whole program.Optional
merchandiseGroupNameThis is the name of the product’s merchandise group.Optional
merchandiseSubGroupCodeThis is the unique identifier of the product's merchandise subgroup. Note about Incentivation: On the level of the ID, it is possible to define incentivation rules (i.e. exclusion or multiple points). Thus, the set of IDs for this should be consistent over the whole program.Optional
merchandiseSubGroupNameThis is the name of the product’s merchandise subgroup.Optional
brandCodeThis is the unique identifier for the product’s brand. The BrandCode can be used in coupon rules and as a trigger for checkout coupons.Optional
descriptionThis is the name or description of the product.Optional
actualSalesUnitPriceThis is the amount, a single item was returned for. So this value is equal to the rebooked regular unit price - all discounts on the level of this product. Note: For RETURN-transaction, this value is always negative.Optional
quantityThis is the number of units, that were returned in this line-item.Optional
extendedAmountThis is the actual amount, this item was returned for. Accordingly, this value has to incorporate all given discounts. Note: For RETURN-transaction, this value is always negative.Mandatory
currencyCodeCurrency Code (e.g. EUR) of the extendedAmount.Optional
taxRatePercentage of tax applied for this line-item.Optional

Excluding lineItem from point incentivation

add description here

Blacklisting: lineItems can be excluded from points incentivation by referencing the itemID, merchandiseGroupCode or merchandiseSubGroupCode

tenderItems Attribute

In addition to the purchased articles, it may also be reasonable to document payment-methods - especially, for the tracking of gift-cards and pay-with-points transactions. These payment methods may be added to a list of tenderItems.

Minimal tenderItem

The minimal required set of information for a tender-item is the following:

"tenderItems": [
{
"sequenceNumber": 3,
"amount": 10.00
}
]

with mandatory attributes:

AttributeDescription
sequenceNumberSequence number of the line-item. This value is incremented with every item. It may start with 1 or continue the line-item sequence numbering.
amountThis is the amount, that was paid in the format of the respective payment method.

Maximal tenderItem

Again, the minimal setup is only providing the minimal functionality, which may be extended by adding optional attributes. For example, it is common to allow multiple payment-methods at the same time, which may be documented.

In the following, we will show maximal set of information, where also multiple payment methods were used. The relevant fields for your implementation depend on the system and program setup and need to be coordinated with the program manager.

"tenderItems": [

{
"sequenceNumber": 3,
"tenderType": "Loyalty",
"tenderId": "PayWithPoints",
"amount": 10.00,
"currencyCode": "EUR",
"taxRate": 19.00
},
{
"sequenceNumber": 4,
"tenderType": "GiftCard",
"tenderId": "Geschenkkarte50",
"amount": 50.00,
"currencyCode": "EUR",
"taxRate": 19.00
},
{
"sequenceNumber": 5,
"tenderType": "Cash",
"tenderId": "Barzahlung",
"amount": 39.90,
"currencyCode": "EUR",
"taxRate": 19.00
}
]

The following attributes may be used (if not stated otherwise, every attribute may only be used once):

AttributeDescriptionRelevance
sequenceNumberSequence number of the line-item. This value is incremented with every item. It may start with 1 or continue the line-item sequence numbering.Mandatory
tenderTypeThis attribute defines the payment method description in the third party system. It should be secured, that these descriptions are consistent.Optional
tenderIdThis attribute defines the payment method ID in the third party system. It should be secured, that these IDs are consistent.Optional
amountThis is the amount, that was paid in the format of the respective payment method.Mandatory
currencyCodeCurrency Code (e.g. EUR) of the amount. Note: Always use real currencies (or the equivalent of a pseudo-currency in a real currency) here. Example: If a amount of 5,00 EUR was paid with Loyalty points, give the amount of 5,00 EUR (and not the amount of burned points).Optional
taxRatePercentage of tax applied for this payment method.Optional

Note:
Always keep in mind, that the sum of all payment-amounts should get the same value as the bon-total-amount.

linkedTransaction

If a transaction has to be linked to an older transaction (e.g. a return, which is mapped to the original sale), the following attribute can be added:

"linkedTransaction": \{
"linkType": "EXTERNALID",
"linkValue": "bon\_id\_123456"
}

with mandatory attributes:

AttributeDescription
linkTypeIdentifier-Type (corresponding to the linkValue). Available values: TRANSACTIONID Convercus-ID of original transaction e.g. db1234b5-67fd-8912-3c4e-56789ac57595 EXTERNALID Original-ID of the transaction e.g. bon_id_123456
linkValueValue of the above linkType.

Maximal Example JSON

Summarising everything, this is an example maximal JSON, with incorporates almost all previous settings (valueTime was omitted as here, the booking is to be expected after processing).

{
"transactionType": "EARNTRANSACTION",
"transactionTime": "2020-04-08T10:50:00+02:00",
"externalId": "UniqueBonID",
"amount": 99.90,
"currencyCode": "EUR",
"reason": "Thank you for your purchase",
"lineItems": [
{
"sequenceNumber": 1,
"type": "SALE",
"itemID": "2758221",
"merchandiseGroupCode": "1201",
"merchandiseGroupName": "Shoes",
"merchandiseSubGroupCode": "120103",
"merchandiseSubGroupName": "Sneakers",
"brandCode": "10543280-CODE 123",
"description": "Test-Shoe",
"actualSalesUnitPrice": 99.90,
"quantity": 2,
"extendedAmount": 199.80,
"currencyCode": "EUR",
"taxRate": 19.00
},
{
"sequenceNumber": 2,
"type": "RETURN",
"itemID": "2758221",
"merchandiseGroupCode": "1201",
"merchandiseGroupName": "Shoes",
"merchandiseSubGroupCode": "120103",
"merchandiseSubGroupName": "Sneakers",
"brandCode": "10543280-CODE 123",
"description": "Test-Shoe",
"actualSalesUnitPrice": -99.90,
"quantity": 1,
"extendedAmount": -99.90,
"currencyCode": "EUR",
"taxRate": 19.00
}
],
"tenderItems": [
{
"sequenceNumber": 3,
"tenderType": "Loyalty",
"tenderId": "PayWithPoints",
"amount": 10.00,
"currencyCode": "EUR",
"taxRate": 19.00
},
{
"sequenceNumber": 4,
"tenderType": "GiftCard",
"tenderId": "Geschenkkarte50",
"amount": 50.00,
"currencyCode": "EUR",
"taxRate": 19.00
},
{
"sequenceNumber": 5,
"tenderType": "Cash",
"tenderId": "Barzahlung",
"amount": 39.90,
"currencyCode": "EUR",
"taxRate": 19.00
}
],
"linkedTransaction": {
"linkType": "EXTERNALID",
"linkValue": "bon_id_123456"
}
"receiptImageData": "iVBORw0KGgoAAAAN.......",
}