Burn Interface (PayWithPoints)
The possibility to make (partial) payments with earned points is a common feature in Loyalty programs. In this chapter, we will explain how to implement this payment method using Convercus API.
Getting current Account Balance
Before payments with points can be made, it is necessary to get the current account balance. There are two ways to get the balance.
The following request will respond the current amount of points on a certain account:
curl --location --request GET '{{api_url}}/accounts/{{accountId}}/balance' \
--header 'Authorization: {{jwt_token}}' \
--header 'interaction-id: {{interactionId}}' \
--header 'id-type: {{idType}}' \
--header 'Content-Type: application/json' \
whereas the following request (note the difference in the url) will respond the value of those points in Euro as amount.
curl --location --request GET '{{api_url}}/accounts/{{accountId}}/balance/EUR' \
--header 'Authorization: {{jwt_token}}' \
--header 'interaction-id: {{interactionId}}' \
--header 'id-type: {{idType}}' \
--header 'Content-Type: application/json' \
The ladder option offers a shortcut for payment implementation as the (possibly not static) calculation of the account balances financial value is already performed by the Convercus System.
The used variables in the requests are the following
Variable | Description |
---|---|
api_url | Endpoint of the API. https://staging.convercus.io (Staging) https://api.convercus.io (Production) |
accountId | ID of the account that will receive the transaction. The ID has to be given in the format, that is dictated by the idType, |
jwt_token | The JWT-token, which has been generated by authentication. |
interactionId | Unique Identifier of the cash machine (or virtual equivalent, e.g. online-shop), which produced the receipt. This ID has to be listed in the Convercus System as with this ID, the connection bon-to-store is made. |
idType | Identifier-Type (corresponding to the accountId). Available values: APPCODE (e.g. A1B2C3D4E5) CARDCODE (e.g. V1W2X3Y4Z5) EXTERNALCODE (e.g. 123456780123) ID (account-identifier, e.g. 7d123457-bfa1-4a83-8213-123456789763 ) |
PayWithPoints-Transaction
Like all API-bookings, paying with points is also handled via account-transaction. Analogously, the following request has to be sent to burn points by paying with them:
curl --location --request POST '{{api_url}}/accounts/{{accountId}}/transactions' \
--header 'Authorization: {{jwt_token}}' \
--header 'interaction-id: {{interactionId}}' \
--header 'id-type: {{idType}}' \
--header 'Content-Type: application/json' \
--data-raw '{{body}}'
where again
Variable | Description |
---|---|
api_url | Endpoint of the API. https://staging.convercus.io (Staging) https://api.convercus.io (Production) |
accountId | ID of the account that will receive the transaction. The ID has to be given in the format, that is dictated by theidType, |
jwt_token | The JWT-token, which has been generated by authentication. |
interactionId | Unique Identifier of the cash machine (or virtual equivalent, e.g. online-shop), which produced the receipt. This ID has to be listed in the Convercus System as with this ID, the connection bon-to-store is made. |
idType | Identifier-Type (corresponding to the accountId). Available values: APPCODE (e.g. A1B2C3D4E5) CARDCODE (e.g. V1W2X3Y4Z5) EXTERNALCODE (e.g. 123456780123) ID (account-identifier, e.g. 7d123457-bfa1-4a83-8213-123456789763 ) |
body | Body with PayWithPoints information as explained in the next subchapter. |
PAYWITHPOINTSTRANSACTION-Body
The minimal set of body information about payments with points is the following
{
"transactionType": "PAYWITHPOINTSTRANSACTION",
"amount": 5.00
}
with the following mandatory attributes
Attribute | Description |
---|---|
transactionType | Type of the transaction. For paying with points, always use the value PAYWITHPOINTSTRANSACTION. |
amount | Total amount, that should be paid with the corresponding amount of points. Important Note: The value of this attribute is always given in terms of a currency (as this is a payment method). It is not an amount of points. Be sure to implement a way to convert points to financial value or get the account balance in your currency via GET accounts/balance/EUR. |
Once again, the minimal setup is only providing the minimal functionality (i.e. burn the amount of points that’s worth the amout you want to pay with).
The following example will give a maximal set of PayWithPoints information. The relevant fields for your implementation depend on the system and program setup and need to be coordinated with the program manager.
{
"transactionType": "PAYWITHPOINTSTRANSACTION",
"reason": "Paying with Points",
"transactionTime": "2020-04-30T10:50:00+02:00",
"valueTime": "2020-04-30T10:50:00+02:00",
"externalId": "UniqueBonID",
"amount": 5.00,
"currencyCode": "EUR",
"linkedTransaction": {
"linkType": "EXTERNALID",
"linkValue": "bon_id_123456"
}
}
The following attributes may be used (if not stated otherwise, every attribute may only be used once):
Attribute | Description | Relevance |
---|---|---|
transactionType | Type of the transaction. For paying with points, always use the value PAYWITHPOINTSTRANSACTION. | Mandatory |
reason | Additional booking text for the transaction. This value can be set to anything and may be used to transmit an internal description / wording of the process (e.g. PayWithPoints). | Optional |
transactionTime | ISO 8601 datetime, when the payment was made (usually this is the same as the datetime of the corresponding 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 |
valueTime | ISO 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 |
externalId | Unique (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. Note: As an exception to the rule, PAYWITHPOINTSTRANSACTION can have the same externalId as the EARN-transaction they are connected to. This allows to use the same bon-ID for the same receipt, even if EARN und BURN are two separate requests. | Optional |
amount | Total amount, that should be paid with the corresponding amount of points. Important Note: The value of this attribute is always given in terms of a currency (as this is a payment method). It is not an amount of points. Be sure to implement a way to convert points to financial value or get the account balance in your currency via GET accounts/balance/EUR. | Mandatory |
currencyCode | Currency Code (e.g. EUR) of the total amount. | Optional |
linkedTransaction | Link to an existing transaction, e.g. the original earn transaction where the payment was made. | Optional |
linkedTransaction / linkType | Identifier-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 | Mandatory (if linkedTransaction is used) |
linkedTransaction / linkValue | Value of the above linkType. | Mandatory (if linkedTransaction is used) |
Note, that the basic setup is similar to the EARN-case above. However, the usage of lineItems and tenderItems is not meaningful here.
Connection between EARN and BURN transactions
It is very important to note, that receipts where a (partial) payment is made with points requires two transaction requests - one for the payments with points (BURN) and one for the bon as a whole (EARN). If payments are tracked in the EARN-bon, make sure to add the correct amount of the PAYWITHPOINTSTRANSACTION to the bon, e.g. add
"tenderItems": [
{
"sequenceNumber": 3,
"tenderType": "Loyalty",
"tenderId": "PayWithPoints",
"amount": 10.00,
"currencyCode": "EUR",
"taxRate": 19.00
},
...
]
Updated 2 months ago