Create redemption order status
Add a status to your community's redemption order workflow, in one of the four fixed categories.
- Method
- POST
- Path
https://api.returning.ai / v1/ redemption-transactions/ status - Permission
- createRedemptionStatus
- Retries
- No Idempotency-Key; a repeat returns 409
When to use this
- Your fulfilment has a step the default statuses don't cover, such as
Awaiting Delivery. - You want separate refunded statuses for different reasons, such as out of stock or failed checks.
- You set up a new community's order workflow before you start updating orders.
Authentication#
- Header
Authorization: Bearer <API_KEY>- Permission
- createRedemptionStatusShown in the dashboard as “Create Redemption Status”
Use a Community API key with createRedemptionStatus, and keep it on your server. The key decides the community, so never send a communityId.
Behaviour#
The status is active as soon as you get a 201. It appears in List redemption statuses under its category, and you can move orders into it straight away. Its colour is #808080. It is never a category default, so new orders don't start in it unless a product or Store category is set to use it.
Names are unique across your community. The same name in any other category is rejected, matched exactly, and so is the same name with different capital letters in the same category. Statuses your team has switched off still count, even though the list doesn't show them.
The API can't change or remove a status. To recolour, rename, switch off or delete one, your team uses Settings > Store Management > Product Statuses in the dashboard. A status can't be deleted while it is the only one in its category. The dashboard only saves names of up to 50 characters, so a longer name created here blocks saving any change to that category there until it is shortened.
Request#
Headers#
Body#
Send name and category. Other fields, such as color or communityId, are ignored.
status. Must be unique in your community. Keep it to 50 characters so your team can still edit this category in the dashboard.Rule1-100 characters
Eg"Awaiting Delivery"
refunded statuses can return coins when you update an order.Rulenew_purchase, in_progress, completed or refunded
Eg"in_progress"
curl --request POST \
--url https://api.returning.ai/v1/redemption-transactions/status \
--header 'Authorization: Bearer <API_KEY>' \
--header 'Content-Type: application/json' \
--data '{
"name": "Awaiting Delivery",
"category": "in_progress"
}'
Response#
A 201 returns the new status in data. Save data._id: it is the statusID for Update redemption order status. Branch on the HTTP status and code, never on message.
Rulesuccess
RuleREDEMPTION_STATUS_CREATED
Eg"Redemption status created successfully"
Eg{ ... }
statusID to Update redemption order status.Eg"66f000000000000000000406"
Eg"Awaiting Delivery"
Eg"in_progress"
#808080 for a status created here.Eg"#808080"
Eg1
false. A created status is never a category's default.{
"status": "success",
"code": "REDEMPTION_STATUS_CREATED",
"message": "Redemption status created successfully",
"data": {
"_id": "66f000000000000000000406",
"name": "Awaiting Delivery",
"category": "in_progress",
"color": "#808080",
"order": 1,
"isDefault": false
}
}
Errors#
401 and 403 responses, and the authentication errors 404 COMMUNITY_NOT_FOUND and 500 AUTHENTICATION_FAILED, carry the code in meta.code; every other error carries it in code. No 400 or 409 creates a status.
Fix the request03
VALIDATION_FAILEDFix the requestname is missing, empty or over 100 characters, or category isn't one of the four categories. detail names the field. Nothing was created.AUTHENTICATION_REQUIREDFix the requestAuthorization: Bearer <API_KEY> with a current Community API key.API_KEY_PERMISSION_DENIEDFix the requestcreateRedemptionStatus, or it is a personal key. Use a Community API key and add the permission in Settings > Integration > API Keys.Fix the data02
REDEMPTION_STATUS_CONFLICTFix the datamessage names the category you sent, even when the existing status is in another one. Use the existing status, or choose another name.COMMUNITY_NOT_FOUNDFix the dataRetry with backoff02
INTERNAL_ERRORRetry with backoffAUTHENTICATION_FAILEDRetry with backoff{
"status": "fail",
"code": "VALIDATION_FAILED",
"message": "Create redemption status endpoint",
"detail": {
"category": "Category must be one of: new_purchase, in_progress, completed, refunded"
}
}