Reverse Reward Transaction
curl --request POST \
--url https://rewardservice-staging.withbenji.com/transactions/{id}/reverse \
--header 'x-api-key: <api-key>'import requests
url = "https://rewardservice-staging.withbenji.com/transactions/{id}/reverse"
headers = {"x-api-key": "<api-key>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {'x-api-key': '<api-key>'}};
fetch('https://rewardservice-staging.withbenji.com/transactions/{id}/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://rewardservice-staging.withbenji.com/transactions/{id}/reverse",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"x-api-key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://rewardservice-staging.withbenji.com/transactions/{id}/reverse"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("x-api-key", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://rewardservice-staging.withbenji.com/transactions/{id}/reverse")
.header("x-api-key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://rewardservice-staging.withbenji.com/transactions/{id}/reverse")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"code": "ok",
"data": {
"reward_transaction_id": 1,
"transaction_status": "REVERSED"
}
}
{
"error": "invalid_token",
"message": "Invalid token"
}
{
"error": "unauthorized_request",
"message": "Token is not authorized to make this request"
}
{
"error": "transaction_does_not_exist",
"message": "The transaction does not exist"
}
Reverse Reward Transaction
Endpoint to reverse a reward transaction
POST
/
transactions
/
{id}
/
reverse
Reverse Reward Transaction
curl --request POST \
--url https://rewardservice-staging.withbenji.com/transactions/{id}/reverse \
--header 'x-api-key: <api-key>'import requests
url = "https://rewardservice-staging.withbenji.com/transactions/{id}/reverse"
headers = {"x-api-key": "<api-key>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {'x-api-key': '<api-key>'}};
fetch('https://rewardservice-staging.withbenji.com/transactions/{id}/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://rewardservice-staging.withbenji.com/transactions/{id}/reverse",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"x-api-key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://rewardservice-staging.withbenji.com/transactions/{id}/reverse"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("x-api-key", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://rewardservice-staging.withbenji.com/transactions/{id}/reverse")
.header("x-api-key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://rewardservice-staging.withbenji.com/transactions/{id}/reverse")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"code": "ok",
"data": {
"reward_transaction_id": 1,
"transaction_status": "REVERSED"
}
}
{
"error": "invalid_token",
"message": "Invalid token"
}
{
"error": "unauthorized_request",
"message": "Token is not authorized to make this request"
}
{
"error": "transaction_does_not_exist",
"message": "The transaction does not exist"
}
The
x-api-key header value to be used on this API is your partner API key, which can be generated through the dashboard.integer
required
The Benji Platform ID of the reward transaction
Return values
object
A reward_transaction object property
Hide properties
Hide properties
integer
Benji Platform reward transaction identifier
string
String representing one of the transaction status values:
Show possible transaction status values
Show possible transaction status values
- REVERSED (1) : Indicating a transaction was successfully reversed
- FAILED (2) : Indicating a transaction failed to reverse since it has already been completed
- PENDING (3) : Indicating a transaction is pending and has not been reversed yet
- INITIATED (4) : Indicating a transaction was initiated but not yet reversed
{
"code": "ok",
"data": {
"reward_transaction_id": 1,
"transaction_status": "REVERSED"
}
}
{
"error": "invalid_token",
"message": "Invalid token"
}
{
"error": "unauthorized_request",
"message": "Token is not authorized to make this request"
}
{
"error": "transaction_does_not_exist",
"message": "The transaction does not exist"
}
Note that you will only receive data that you as a loyalty partner or merchant partner are allowed to see based on the permissions in the access token you provide to the API.
Was this page helpful?