This documentation outlines how to update existing transactions using our API. By following these steps, you can easily modify transaction details as needed.
Sign in to the portal
Before you can update transactions via the API, you need to sign in to the portal.
Find your API token
Each user is given a unique API token. Click your avatar in the top right corner and select "Profile". Your API token is displayed there and can be copied with one click.
Authentication
To authenticate your API requests, include your API token in the Authorization header of your HTTP request. Here's an example of how to do it:
curl -X POST "https://retrack.refunder.com/api/transactions" \
-H "Authorization: Bearer DbV6KYhMm7firiNtgfOCEmRohglfAQUTUy4FudGOKtetC0yYSaKtOXIedfNX" \
-H "Content-Type: application/json"
Find the existing transaction
To update an existing transaction, you first need to identify it by its UUID (Universally Unique Identifier). You can retrieve the UUID by querying our API with the order number you initially created the transaciton with. Use the byOrderNumber parameter.
API Endpoint
https://retrack.refunder.com/api/v2/transactions?byOrderNumber={ORDER_NUMBER}
Here is an example response where you can locate uuid for later use.
{
"data": {
"uuid": "3afc4a82-93c3-423f-8ee8-542ccb315931",
"order_number": "test1234",
"order_sum": 200000,
"vat_sum": 40000,
"commission": 4000,
"currency": "SEK",
"vouchers": [],
"created_at": "2020-11-04 11:09:31",
"click": {
"uuid": "59d08c54-18e6-4e0d-9c06-d18be3510e43",
"ref": "38315327",
"ref2": null,
"ref3": null,
"deeplink": null,
"ip_address": "80.216.223.143",
"browser": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.121 Safari/537.36",
"referer": "https://www.refunder.se/",
"country": "SE",
"created_at": "2020-10-08 08:13:43"
},
"publisher": {
"uuid": "e5adcbc6-31a8-4e1b-8351-835dddc16921",
"name": "Refunder SE",
"created_at": "2020-05-19 15:44:36"
},
"advertiser": {
"uuid": "4062146a-9078-4e9a-8a88-2b9066c562d2",
"name": "Store Name SE",
"created_at": "2020-05-19 15:46:02"
},
"program": {
"uuid": "7649bf56-4345-46e4-8c77-04bbd2f3bcd3",
"title": "Store Name SE",
"created_at": "2020-05-19 15:47:02"
},
"event": {
"uuid": "1f80e399-6f55-4cef-b8b0-0f74752c1ceb",
"title": "Sale Whole Store",
"commission": "20.00",
"created_at": "2020-05-19 15:48:46"
},
"status": {
"name": "pending",
"reason": null,
"created_at": "2020-11-04 11:09:31"
},
"products": [
{
"reference": "testabc123",
"name": "Testprodukt",
"price": 200000,
"vat": 40000,
"created_at": "2020-11-04 11:09:31"
}
]
}
}
Update the transaction
Once you have obtained the UUID, you can proceed to update the transaction with the desired changes. The following information outlines how to update transaction details.
API Endpoint
https://retrack.refunder.com/api/v2/transactions/{UUID}
Here is an example of the input JSON payload for updating a transaction:
{
"orderNumber": "test1234",
"orderSum": 10100,
"vatSum": 2000,
"currency": "SEK",
"status": "rejected",
"products": [
{
"reference": "testabc123",
"quantity": 1,
"name": "Testprodukt",
"price": 10100,
"vat": 2000
}
]
}
The structure of the JSON input is similar to creating a new transaction. Please refer to the relevant documentation for additional information. The key difference is that the click and event parameters are not required when updating an existing transaction. Additionally, this endpoint allows you to change the transaction status via the status parameter.
Notes about status
Transactions can be updated until the status reaches approved. Once approved the transaction will be locked.
Possible values for the status:
- pending
- rejected
- approved
Notes about required input
The input validation is dynamic and will allow you to update single values where possible. See examples below.
Updating the transaction status:
{
"status": "rejected"
}
Updating the order sum (assuming same currency):
{
"orderSum": 10100,
"vatSum": 2000
}
Product data is only required if the order has mixed events, ie. different commission levels for different products. It is however encouraged try to keep the product data in sync if it changes over time (part returns for example). Note that if you include product input to the API, the system will remove any products that are NOT present in the input.
After successfully updating the transaction, you will receive a response containing the updated transaction details. Here is an example response:
{
"data": {
"uuid": "3afc4a82-93c3-423f-8ee8-542ccb315931",
"order_number": "test1234",
"order_sum": 200000,
"vat_sum": 40000,
"commission": 4000,
"currency": "SEK",
"vouchers": [],
"created_at": "2020-11-04 11:09:31",
"click": {
"uuid": "59d08c54-18e6-4e0d-9c06-d18be3510e43",
"ref": "38315327",
"ref2": null,
"ref3": null,
"deeplink": null,
"ip_address": "80.216.223.143",
"browser": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.121 Safari/537.36",
"referer": "https://www.refunder.se/",
"country": "SE",
"created_at": "2020-10-08 08:13:43"
},
"publisher": {
"uuid": "e5adcbc6-31a8-4e1b-8351-835dddc16921",
"name": "Refunder SE",
"created_at": "2020-05-19 15:44:36"
},
"advertiser": {
"uuid": "4062146a-9078-4e9a-8a88-2b9066c562d2",
"name": "Store Name SE",
"created_at": "2020-05-19 15:46:02"
},
"program": {
"uuid": "7649bf56-4345-46e4-8c77-04bbd2f3bcd3",
"title": "Store Name SE",
"created_at": "2020-05-19 15:47:02"
},
"event": {
"uuid": "1f80e399-6f55-4cef-b8b0-0f74752c1ceb",
"title": "Sale Whole Store",
"commission": "20.00",
"created_at": "2020-05-19 15:48:46"
},
"status": {
"name": "pending",
"reason": null,
"created_at": "2020-11-04 11:09:31"
},
"products": [
{
"reference": "testabc123",
"name": "Testprodukt",
"price": 200000,
"vat": 40000,
"created_at": "2020-11-04 11:09:31"
}
]
}
}
The API will return an HTTP 200 OK status code if the transaction update is successful. For all other responses, you can retry the operation as needed. Feel free to reach out if you have any further questions or require assistance with updating transactions through our API.