curl --request POST \
--url https://vanilla-dev02-loyalty.fabric.zone/api/v2/earn/reverse \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"profileId": "67460e74-02e3-11e8-b443-00163e990bdb",
"entityReference": "LIBERTY_STORE",
"reverseTransactionExternalRef": "LOYALTY-12345",
"transactionTypeExternalReference": "RETURN",
"activityTimestamp": "2020-02-08 09:30:26",
"transactionExternalReference": "LOYALTY-8675",
"checkForDuplicateTransaction": 1,
"fetchUpdatedMemberPointTotals": 1,
"transactionGrossAmount": -100,
"discountValue": -20,
"totalAmountPaid": -80,
"totalTax": -10,
"netAmount": -70,
"discounts": [
{
"id": 2345,
"value": 20,
"type": "promotion",
"description": "Black Friday discount"
}
],
"issueAuditUser": "Joe",
"cancelAuditUser": "Mia",
"redemptionCode": [],
"setToPending": true,
"reasonCode": "9393",
"reasonDescription": "returning item",
"transactionItems": [
{
"grossAmount": 100,
"taxAmount": 10,
"totalAmountPaid": 100,
"netAmount": 90,
"itemPrice": 45,
"itemQuantity": 2,
"SKU": "12345",
"lineNumber": 1,
"discounts": [],
"categories": [
"Supplements"
],
"itemName": "demo item",
"UOM": "unit",
"couponCodes": []
}
],
"isCompanyUser": false
}
'import requests
url = "https://vanilla-dev02-loyalty.fabric.zone/api/v2/earn/reverse"
payload = {
"profileId": "67460e74-02e3-11e8-b443-00163e990bdb",
"entityReference": "LIBERTY_STORE",
"reverseTransactionExternalRef": "LOYALTY-12345",
"transactionTypeExternalReference": "RETURN",
"activityTimestamp": "2020-02-08 09:30:26",
"transactionExternalReference": "LOYALTY-8675",
"checkForDuplicateTransaction": 1,
"fetchUpdatedMemberPointTotals": 1,
"transactionGrossAmount": -100,
"discountValue": -20,
"totalAmountPaid": -80,
"totalTax": -10,
"netAmount": -70,
"discounts": [
{
"id": 2345,
"value": 20,
"type": "promotion",
"description": "Black Friday discount"
}
],
"issueAuditUser": "Joe",
"cancelAuditUser": "Mia",
"redemptionCode": [],
"setToPending": True,
"reasonCode": "9393",
"reasonDescription": "returning item",
"transactionItems": [
{
"grossAmount": 100,
"taxAmount": 10,
"totalAmountPaid": 100,
"netAmount": 90,
"itemPrice": 45,
"itemQuantity": 2,
"SKU": "12345",
"lineNumber": 1,
"discounts": [],
"categories": ["Supplements"],
"itemName": "demo item",
"UOM": "unit",
"couponCodes": []
}
],
"isCompanyUser": False
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
profileId: '67460e74-02e3-11e8-b443-00163e990bdb',
entityReference: 'LIBERTY_STORE',
reverseTransactionExternalRef: 'LOYALTY-12345',
transactionTypeExternalReference: 'RETURN',
activityTimestamp: '2020-02-08 09:30:26',
transactionExternalReference: 'LOYALTY-8675',
checkForDuplicateTransaction: 1,
fetchUpdatedMemberPointTotals: 1,
transactionGrossAmount: -100,
discountValue: -20,
totalAmountPaid: -80,
totalTax: -10,
netAmount: -70,
discounts: [{id: 2345, value: 20, type: 'promotion', description: 'Black Friday discount'}],
issueAuditUser: 'Joe',
cancelAuditUser: 'Mia',
redemptionCode: [],
setToPending: true,
reasonCode: '9393',
reasonDescription: 'returning item',
transactionItems: [
{
grossAmount: 100,
taxAmount: 10,
totalAmountPaid: 100,
netAmount: 90,
itemPrice: 45,
itemQuantity: 2,
SKU: '12345',
lineNumber: 1,
discounts: [],
categories: ['Supplements'],
itemName: 'demo item',
UOM: 'unit',
couponCodes: []
}
],
isCompanyUser: false
})
};
fetch('https://vanilla-dev02-loyalty.fabric.zone/api/v2/earn/reverse', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://vanilla-dev02-loyalty.fabric.zone/api/v2/earn/reverse",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'profileId' => '67460e74-02e3-11e8-b443-00163e990bdb',
'entityReference' => 'LIBERTY_STORE',
'reverseTransactionExternalRef' => 'LOYALTY-12345',
'transactionTypeExternalReference' => 'RETURN',
'activityTimestamp' => '2020-02-08 09:30:26',
'transactionExternalReference' => 'LOYALTY-8675',
'checkForDuplicateTransaction' => 1,
'fetchUpdatedMemberPointTotals' => 1,
'transactionGrossAmount' => -100,
'discountValue' => -20,
'totalAmountPaid' => -80,
'totalTax' => -10,
'netAmount' => -70,
'discounts' => [
[
'id' => 2345,
'value' => 20,
'type' => 'promotion',
'description' => 'Black Friday discount'
]
],
'issueAuditUser' => 'Joe',
'cancelAuditUser' => 'Mia',
'redemptionCode' => [
],
'setToPending' => true,
'reasonCode' => '9393',
'reasonDescription' => 'returning item',
'transactionItems' => [
[
'grossAmount' => 100,
'taxAmount' => 10,
'totalAmountPaid' => 100,
'netAmount' => 90,
'itemPrice' => 45,
'itemQuantity' => 2,
'SKU' => '12345',
'lineNumber' => 1,
'discounts' => [
],
'categories' => [
'Supplements'
],
'itemName' => 'demo item',
'UOM' => 'unit',
'couponCodes' => [
]
]
],
'isCompanyUser' => false
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://vanilla-dev02-loyalty.fabric.zone/api/v2/earn/reverse"
payload := strings.NewReader("{\n \"profileId\": \"67460e74-02e3-11e8-b443-00163e990bdb\",\n \"entityReference\": \"LIBERTY_STORE\",\n \"reverseTransactionExternalRef\": \"LOYALTY-12345\",\n \"transactionTypeExternalReference\": \"RETURN\",\n \"activityTimestamp\": \"2020-02-08 09:30:26\",\n \"transactionExternalReference\": \"LOYALTY-8675\",\n \"checkForDuplicateTransaction\": 1,\n \"fetchUpdatedMemberPointTotals\": 1,\n \"transactionGrossAmount\": -100,\n \"discountValue\": -20,\n \"totalAmountPaid\": -80,\n \"totalTax\": -10,\n \"netAmount\": -70,\n \"discounts\": [\n {\n \"id\": 2345,\n \"value\": 20,\n \"type\": \"promotion\",\n \"description\": \"Black Friday discount\"\n }\n ],\n \"issueAuditUser\": \"Joe\",\n \"cancelAuditUser\": \"Mia\",\n \"redemptionCode\": [],\n \"setToPending\": true,\n \"reasonCode\": \"9393\",\n \"reasonDescription\": \"returning item\",\n \"transactionItems\": [\n {\n \"grossAmount\": 100,\n \"taxAmount\": 10,\n \"totalAmountPaid\": 100,\n \"netAmount\": 90,\n \"itemPrice\": 45,\n \"itemQuantity\": 2,\n \"SKU\": \"12345\",\n \"lineNumber\": 1,\n \"discounts\": [],\n \"categories\": [\n \"Supplements\"\n ],\n \"itemName\": \"demo item\",\n \"UOM\": \"unit\",\n \"couponCodes\": []\n }\n ],\n \"isCompanyUser\": false\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://vanilla-dev02-loyalty.fabric.zone/api/v2/earn/reverse")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"profileId\": \"67460e74-02e3-11e8-b443-00163e990bdb\",\n \"entityReference\": \"LIBERTY_STORE\",\n \"reverseTransactionExternalRef\": \"LOYALTY-12345\",\n \"transactionTypeExternalReference\": \"RETURN\",\n \"activityTimestamp\": \"2020-02-08 09:30:26\",\n \"transactionExternalReference\": \"LOYALTY-8675\",\n \"checkForDuplicateTransaction\": 1,\n \"fetchUpdatedMemberPointTotals\": 1,\n \"transactionGrossAmount\": -100,\n \"discountValue\": -20,\n \"totalAmountPaid\": -80,\n \"totalTax\": -10,\n \"netAmount\": -70,\n \"discounts\": [\n {\n \"id\": 2345,\n \"value\": 20,\n \"type\": \"promotion\",\n \"description\": \"Black Friday discount\"\n }\n ],\n \"issueAuditUser\": \"Joe\",\n \"cancelAuditUser\": \"Mia\",\n \"redemptionCode\": [],\n \"setToPending\": true,\n \"reasonCode\": \"9393\",\n \"reasonDescription\": \"returning item\",\n \"transactionItems\": [\n {\n \"grossAmount\": 100,\n \"taxAmount\": 10,\n \"totalAmountPaid\": 100,\n \"netAmount\": 90,\n \"itemPrice\": 45,\n \"itemQuantity\": 2,\n \"SKU\": \"12345\",\n \"lineNumber\": 1,\n \"discounts\": [],\n \"categories\": [\n \"Supplements\"\n ],\n \"itemName\": \"demo item\",\n \"UOM\": \"unit\",\n \"couponCodes\": []\n }\n ],\n \"isCompanyUser\": false\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://vanilla-dev02-loyalty.fabric.zone/api/v2/earn/reverse")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"profileId\": \"67460e74-02e3-11e8-b443-00163e990bdb\",\n \"entityReference\": \"LIBERTY_STORE\",\n \"reverseTransactionExternalRef\": \"LOYALTY-12345\",\n \"transactionTypeExternalReference\": \"RETURN\",\n \"activityTimestamp\": \"2020-02-08 09:30:26\",\n \"transactionExternalReference\": \"LOYALTY-8675\",\n \"checkForDuplicateTransaction\": 1,\n \"fetchUpdatedMemberPointTotals\": 1,\n \"transactionGrossAmount\": -100,\n \"discountValue\": -20,\n \"totalAmountPaid\": -80,\n \"totalTax\": -10,\n \"netAmount\": -70,\n \"discounts\": [\n {\n \"id\": 2345,\n \"value\": 20,\n \"type\": \"promotion\",\n \"description\": \"Black Friday discount\"\n }\n ],\n \"issueAuditUser\": \"Joe\",\n \"cancelAuditUser\": \"Mia\",\n \"redemptionCode\": [],\n \"setToPending\": true,\n \"reasonCode\": \"9393\",\n \"reasonDescription\": \"returning item\",\n \"transactionItems\": [\n {\n \"grossAmount\": 100,\n \"taxAmount\": 10,\n \"totalAmountPaid\": 100,\n \"netAmount\": 90,\n \"itemPrice\": 45,\n \"itemQuantity\": 2,\n \"SKU\": \"12345\",\n \"lineNumber\": 1,\n \"discounts\": [],\n \"categories\": [\n \"Supplements\"\n ],\n \"itemName\": \"demo item\",\n \"UOM\": \"unit\",\n \"couponCodes\": []\n }\n ],\n \"isCompanyUser\": false\n}"
response = http.request(request)
puts response.read_body{
"status": 201,
"message": "earn reversed",
"errors": {},
"data": {
"profileId": "67460e74-02e3-11e8-b443-00163e990bdb",
"transactionNumber": "LOYALTY-8675",
"transactionType": "EARN_REVERSE",
"transactionCode": "62660e74-02e3-11e8-b443-00163e990abc",
"transactionDateTime": "2020-03-20T14:28:23.382748",
"activityTimestamp": "2020-03-20T14:28:23.382748",
"totalAmountPaid": -80,
"totalTax": -10,
"transactionNetAmount": -70,
"points": -70,
"basePoints": 70,
"bonusPoints": 0,
"promotionalPoints": 0,
"currentPointsBalance": 500,
"reasonCode": "9393",
"reasonDescription": "returning item",
"discounts": [
{
"id": 2345,
"value": 20,
"type": "promotion",
"description": "Black Friday discount"
}
],
"discountValue": 20,
"transactionItems": [
{
"grossAmount": 100,
"taxAmount": 10,
"netAmount": 90,
"categories": [
"Supplements"
],
"itemPrice": 45,
"itemQuantity": 2,
"SKU": "12345",
"lineNumber": 1,
"discounts": [],
"itemName": "demo item",
"UOM": "unit",
"couponCodes": []
}
],
"rewards": [],
"issueAuditUser": "Joe",
"cancelAuditUser": "Mia",
"deviceId": "D10626",
"transactionActivityType": "TRANS_CANCEL",
"transactionTypeExternalReference": "RETURN",
"transactionExternalReference": "LOYALTY-8675",
"transactionEntityReference": "LIBERTY_STORE"
}
}{
"message": "Error message string",
"errors": {
"ExceptionString": [
"Invalid Field"
]
},
"data": null,
"status": 400
}{
"detail": "Authentication Failed"
}Reverse Earned Points
When a member cancels a purchase transaction or returns an order, this endpoint cancels all the points earned in that transaction.
curl --request POST \
--url https://vanilla-dev02-loyalty.fabric.zone/api/v2/earn/reverse \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"profileId": "67460e74-02e3-11e8-b443-00163e990bdb",
"entityReference": "LIBERTY_STORE",
"reverseTransactionExternalRef": "LOYALTY-12345",
"transactionTypeExternalReference": "RETURN",
"activityTimestamp": "2020-02-08 09:30:26",
"transactionExternalReference": "LOYALTY-8675",
"checkForDuplicateTransaction": 1,
"fetchUpdatedMemberPointTotals": 1,
"transactionGrossAmount": -100,
"discountValue": -20,
"totalAmountPaid": -80,
"totalTax": -10,
"netAmount": -70,
"discounts": [
{
"id": 2345,
"value": 20,
"type": "promotion",
"description": "Black Friday discount"
}
],
"issueAuditUser": "Joe",
"cancelAuditUser": "Mia",
"redemptionCode": [],
"setToPending": true,
"reasonCode": "9393",
"reasonDescription": "returning item",
"transactionItems": [
{
"grossAmount": 100,
"taxAmount": 10,
"totalAmountPaid": 100,
"netAmount": 90,
"itemPrice": 45,
"itemQuantity": 2,
"SKU": "12345",
"lineNumber": 1,
"discounts": [],
"categories": [
"Supplements"
],
"itemName": "demo item",
"UOM": "unit",
"couponCodes": []
}
],
"isCompanyUser": false
}
'import requests
url = "https://vanilla-dev02-loyalty.fabric.zone/api/v2/earn/reverse"
payload = {
"profileId": "67460e74-02e3-11e8-b443-00163e990bdb",
"entityReference": "LIBERTY_STORE",
"reverseTransactionExternalRef": "LOYALTY-12345",
"transactionTypeExternalReference": "RETURN",
"activityTimestamp": "2020-02-08 09:30:26",
"transactionExternalReference": "LOYALTY-8675",
"checkForDuplicateTransaction": 1,
"fetchUpdatedMemberPointTotals": 1,
"transactionGrossAmount": -100,
"discountValue": -20,
"totalAmountPaid": -80,
"totalTax": -10,
"netAmount": -70,
"discounts": [
{
"id": 2345,
"value": 20,
"type": "promotion",
"description": "Black Friday discount"
}
],
"issueAuditUser": "Joe",
"cancelAuditUser": "Mia",
"redemptionCode": [],
"setToPending": True,
"reasonCode": "9393",
"reasonDescription": "returning item",
"transactionItems": [
{
"grossAmount": 100,
"taxAmount": 10,
"totalAmountPaid": 100,
"netAmount": 90,
"itemPrice": 45,
"itemQuantity": 2,
"SKU": "12345",
"lineNumber": 1,
"discounts": [],
"categories": ["Supplements"],
"itemName": "demo item",
"UOM": "unit",
"couponCodes": []
}
],
"isCompanyUser": False
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
profileId: '67460e74-02e3-11e8-b443-00163e990bdb',
entityReference: 'LIBERTY_STORE',
reverseTransactionExternalRef: 'LOYALTY-12345',
transactionTypeExternalReference: 'RETURN',
activityTimestamp: '2020-02-08 09:30:26',
transactionExternalReference: 'LOYALTY-8675',
checkForDuplicateTransaction: 1,
fetchUpdatedMemberPointTotals: 1,
transactionGrossAmount: -100,
discountValue: -20,
totalAmountPaid: -80,
totalTax: -10,
netAmount: -70,
discounts: [{id: 2345, value: 20, type: 'promotion', description: 'Black Friday discount'}],
issueAuditUser: 'Joe',
cancelAuditUser: 'Mia',
redemptionCode: [],
setToPending: true,
reasonCode: '9393',
reasonDescription: 'returning item',
transactionItems: [
{
grossAmount: 100,
taxAmount: 10,
totalAmountPaid: 100,
netAmount: 90,
itemPrice: 45,
itemQuantity: 2,
SKU: '12345',
lineNumber: 1,
discounts: [],
categories: ['Supplements'],
itemName: 'demo item',
UOM: 'unit',
couponCodes: []
}
],
isCompanyUser: false
})
};
fetch('https://vanilla-dev02-loyalty.fabric.zone/api/v2/earn/reverse', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://vanilla-dev02-loyalty.fabric.zone/api/v2/earn/reverse",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'profileId' => '67460e74-02e3-11e8-b443-00163e990bdb',
'entityReference' => 'LIBERTY_STORE',
'reverseTransactionExternalRef' => 'LOYALTY-12345',
'transactionTypeExternalReference' => 'RETURN',
'activityTimestamp' => '2020-02-08 09:30:26',
'transactionExternalReference' => 'LOYALTY-8675',
'checkForDuplicateTransaction' => 1,
'fetchUpdatedMemberPointTotals' => 1,
'transactionGrossAmount' => -100,
'discountValue' => -20,
'totalAmountPaid' => -80,
'totalTax' => -10,
'netAmount' => -70,
'discounts' => [
[
'id' => 2345,
'value' => 20,
'type' => 'promotion',
'description' => 'Black Friday discount'
]
],
'issueAuditUser' => 'Joe',
'cancelAuditUser' => 'Mia',
'redemptionCode' => [
],
'setToPending' => true,
'reasonCode' => '9393',
'reasonDescription' => 'returning item',
'transactionItems' => [
[
'grossAmount' => 100,
'taxAmount' => 10,
'totalAmountPaid' => 100,
'netAmount' => 90,
'itemPrice' => 45,
'itemQuantity' => 2,
'SKU' => '12345',
'lineNumber' => 1,
'discounts' => [
],
'categories' => [
'Supplements'
],
'itemName' => 'demo item',
'UOM' => 'unit',
'couponCodes' => [
]
]
],
'isCompanyUser' => false
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://vanilla-dev02-loyalty.fabric.zone/api/v2/earn/reverse"
payload := strings.NewReader("{\n \"profileId\": \"67460e74-02e3-11e8-b443-00163e990bdb\",\n \"entityReference\": \"LIBERTY_STORE\",\n \"reverseTransactionExternalRef\": \"LOYALTY-12345\",\n \"transactionTypeExternalReference\": \"RETURN\",\n \"activityTimestamp\": \"2020-02-08 09:30:26\",\n \"transactionExternalReference\": \"LOYALTY-8675\",\n \"checkForDuplicateTransaction\": 1,\n \"fetchUpdatedMemberPointTotals\": 1,\n \"transactionGrossAmount\": -100,\n \"discountValue\": -20,\n \"totalAmountPaid\": -80,\n \"totalTax\": -10,\n \"netAmount\": -70,\n \"discounts\": [\n {\n \"id\": 2345,\n \"value\": 20,\n \"type\": \"promotion\",\n \"description\": \"Black Friday discount\"\n }\n ],\n \"issueAuditUser\": \"Joe\",\n \"cancelAuditUser\": \"Mia\",\n \"redemptionCode\": [],\n \"setToPending\": true,\n \"reasonCode\": \"9393\",\n \"reasonDescription\": \"returning item\",\n \"transactionItems\": [\n {\n \"grossAmount\": 100,\n \"taxAmount\": 10,\n \"totalAmountPaid\": 100,\n \"netAmount\": 90,\n \"itemPrice\": 45,\n \"itemQuantity\": 2,\n \"SKU\": \"12345\",\n \"lineNumber\": 1,\n \"discounts\": [],\n \"categories\": [\n \"Supplements\"\n ],\n \"itemName\": \"demo item\",\n \"UOM\": \"unit\",\n \"couponCodes\": []\n }\n ],\n \"isCompanyUser\": false\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://vanilla-dev02-loyalty.fabric.zone/api/v2/earn/reverse")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"profileId\": \"67460e74-02e3-11e8-b443-00163e990bdb\",\n \"entityReference\": \"LIBERTY_STORE\",\n \"reverseTransactionExternalRef\": \"LOYALTY-12345\",\n \"transactionTypeExternalReference\": \"RETURN\",\n \"activityTimestamp\": \"2020-02-08 09:30:26\",\n \"transactionExternalReference\": \"LOYALTY-8675\",\n \"checkForDuplicateTransaction\": 1,\n \"fetchUpdatedMemberPointTotals\": 1,\n \"transactionGrossAmount\": -100,\n \"discountValue\": -20,\n \"totalAmountPaid\": -80,\n \"totalTax\": -10,\n \"netAmount\": -70,\n \"discounts\": [\n {\n \"id\": 2345,\n \"value\": 20,\n \"type\": \"promotion\",\n \"description\": \"Black Friday discount\"\n }\n ],\n \"issueAuditUser\": \"Joe\",\n \"cancelAuditUser\": \"Mia\",\n \"redemptionCode\": [],\n \"setToPending\": true,\n \"reasonCode\": \"9393\",\n \"reasonDescription\": \"returning item\",\n \"transactionItems\": [\n {\n \"grossAmount\": 100,\n \"taxAmount\": 10,\n \"totalAmountPaid\": 100,\n \"netAmount\": 90,\n \"itemPrice\": 45,\n \"itemQuantity\": 2,\n \"SKU\": \"12345\",\n \"lineNumber\": 1,\n \"discounts\": [],\n \"categories\": [\n \"Supplements\"\n ],\n \"itemName\": \"demo item\",\n \"UOM\": \"unit\",\n \"couponCodes\": []\n }\n ],\n \"isCompanyUser\": false\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://vanilla-dev02-loyalty.fabric.zone/api/v2/earn/reverse")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"profileId\": \"67460e74-02e3-11e8-b443-00163e990bdb\",\n \"entityReference\": \"LIBERTY_STORE\",\n \"reverseTransactionExternalRef\": \"LOYALTY-12345\",\n \"transactionTypeExternalReference\": \"RETURN\",\n \"activityTimestamp\": \"2020-02-08 09:30:26\",\n \"transactionExternalReference\": \"LOYALTY-8675\",\n \"checkForDuplicateTransaction\": 1,\n \"fetchUpdatedMemberPointTotals\": 1,\n \"transactionGrossAmount\": -100,\n \"discountValue\": -20,\n \"totalAmountPaid\": -80,\n \"totalTax\": -10,\n \"netAmount\": -70,\n \"discounts\": [\n {\n \"id\": 2345,\n \"value\": 20,\n \"type\": \"promotion\",\n \"description\": \"Black Friday discount\"\n }\n ],\n \"issueAuditUser\": \"Joe\",\n \"cancelAuditUser\": \"Mia\",\n \"redemptionCode\": [],\n \"setToPending\": true,\n \"reasonCode\": \"9393\",\n \"reasonDescription\": \"returning item\",\n \"transactionItems\": [\n {\n \"grossAmount\": 100,\n \"taxAmount\": 10,\n \"totalAmountPaid\": 100,\n \"netAmount\": 90,\n \"itemPrice\": 45,\n \"itemQuantity\": 2,\n \"SKU\": \"12345\",\n \"lineNumber\": 1,\n \"discounts\": [],\n \"categories\": [\n \"Supplements\"\n ],\n \"itemName\": \"demo item\",\n \"UOM\": \"unit\",\n \"couponCodes\": []\n }\n ],\n \"isCompanyUser\": false\n}"
response = http.request(request)
puts response.read_body{
"status": 201,
"message": "earn reversed",
"errors": {},
"data": {
"profileId": "67460e74-02e3-11e8-b443-00163e990bdb",
"transactionNumber": "LOYALTY-8675",
"transactionType": "EARN_REVERSE",
"transactionCode": "62660e74-02e3-11e8-b443-00163e990abc",
"transactionDateTime": "2020-03-20T14:28:23.382748",
"activityTimestamp": "2020-03-20T14:28:23.382748",
"totalAmountPaid": -80,
"totalTax": -10,
"transactionNetAmount": -70,
"points": -70,
"basePoints": 70,
"bonusPoints": 0,
"promotionalPoints": 0,
"currentPointsBalance": 500,
"reasonCode": "9393",
"reasonDescription": "returning item",
"discounts": [
{
"id": 2345,
"value": 20,
"type": "promotion",
"description": "Black Friday discount"
}
],
"discountValue": 20,
"transactionItems": [
{
"grossAmount": 100,
"taxAmount": 10,
"netAmount": 90,
"categories": [
"Supplements"
],
"itemPrice": 45,
"itemQuantity": 2,
"SKU": "12345",
"lineNumber": 1,
"discounts": [],
"itemName": "demo item",
"UOM": "unit",
"couponCodes": []
}
],
"rewards": [],
"issueAuditUser": "Joe",
"cancelAuditUser": "Mia",
"deviceId": "D10626",
"transactionActivityType": "TRANS_CANCEL",
"transactionTypeExternalReference": "RETURN",
"transactionExternalReference": "LOYALTY-8675",
"transactionEntityReference": "LIBERTY_STORE"
}
}{
"message": "Error message string",
"errors": {
"ExceptionString": [
"Invalid Field"
]
},
"data": null,
"status": 400
}{
"detail": "Authentication Failed"
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
Transaction details to reverse the earned points
Profile ID of the member. In an ecosystem, it acts as a primary ID to keep the various systems (apps, websites, etc.) in sync. profileId is generated as part of the Enroll Member endpoint - POST /members.
"67460e74-02e3-11e8-b443-00163e990bdb"
Unique name or ID of store (or entity) where the transaction took place.
3 - 15"LIBERTY_STORE"
External reference number of the transaction to be reversed
1 - 100"LOYALTY-12345"
External reference for transaction type such purchase, return, or exchange (configurable as per requirement).
3 - 15"RETURN"
Activity date (in UTC format). An activity could be enrolling a member, making a transaction, etc.
"2020-02-08 09:30:26"
Order ID or receipt ID for the transaction (received from the store). This is needed to cancel or return an order.
1 - 100"LOYALTY-8675"
0 indicates the system allows duplicate and 1 indicates there is a validation in place to identify duplicates.
1
A value of 1 indicates the total points (including the points earned in the latest transaction) are calculated and displayed to the member. A value of 0 indicates the total points are not calculated and the member is only notified if the earn is successful. The response is faster when the value is 0 because there is no calculations involved.
1
Transaction gross amount. For example, gross amount of item1 is 50.00 and gross amount of item2 is 100.00, then transactionGrossAmount is 150.00
-100
Discount amount applied on the transaction.
-20
Total amount paid for the items. For example, the amount paid for item1 is 100.00 and the amount of item2 is 200.00 so the total amount paid is 300.00.
-80
Final tax amount based on the number of items in the transaction. Example - the tax amount of item1 is 2.00; Tax amount of item2 is 2.00. The totalTax is 4.00.
-10
Net transaction amount. Example - the net amount of item1 is 100.00 and net amount of item2 is 200.00. So, the netAmount is 300.00.
-70
Discount details.
Show child attributes
Show child attributes
Representative who issued the earn transaction.
1 - 100"Joe"
Representative who cancelled the earn transaction.
1 - 100"Mia"
Redemption code used to identify and link the rewards used in a specific transaction. This code is generated in the response of the Issue Variable Rewards endpoint - POST /api/v1/redeem/reward/issue.
[]
true: Points in Pending status
false: Points in Active status. Note: The time period for Pending state is configurable.
Reason code to categorize transactions. A parent company can configure custom codes for their stores as required.
1 - 4"9393"
When reason codes are not configured, store can make use of the reason description.
1 - 20"returning item"
Details of the transaction items to be reversed.
Show child attributes
Show child attributes
true: Company user is running the endpoint
false: Client user is running the endpoint.
Response
OK
Metadata for the Earn Reverse response
Was this page helpful?
