const url = 'https://api.thanks.io/api/v2/orders/{orderId}/cancel';
const options = {method: 'PUT', headers: {Authorization: 'Bearer <token>'}, body: undefined};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
{
"order": {
"id": 42708,
"user_id": 2,
"sub_account_id": null,
"type": "postcard",
"message": "Hey %FIRST_NAME%!,\n\nTHANK YOU for allowing us the opportunity to HELP you with your plan!",
"message_template_id": 116,
"image_template_id": 195091,
"style": 1,
"handwriting_color": "#000001",
"font_size": "auto",
"realism": 40,
"size": "4x6",
"addons": {
"standardmail": "on"
},
"front_image": "https://s3.amazonaws.com/cdn.thanks.io/user_image_library/gFBaJJJWRp60op3ZOoK7UaO5I7zi33rdKQGgHylR.png",
"back_image": "",
"preview_images": [
"https://s3.amazonaws.com/cdn.thanks.io/user_image_library/gFBaJJJWRp60op3ZOoK7UaO5I7zi33rdKQGgHylR.png"
],
"thumbnail_images": [
"https://s3.amazonaws.com/cdn.thanks.io/user_image_library/gFBaJJJWRp60op3ZOoK7UaO5I7zi33rdKQGgHylR.png"
],
"high_quality_preview": "",
"custom_background_url": null,
"additional_letter_pages": null,
"skip_creative_generation": 0,
"giftcard_brand": null,
"giftcard_image": null,
"giftcard_amount": null,
"qrcode_url": null,
"mailing_list_ids_used": "3047",
"total_estimated_recipients": 1,
"authorization_total": 73,
"total_recipients": 1,
"grand_total": 73,
"status": "fulfilled",
"method": "drip",
"email_cc": null,
"total_scans": 0,
"unique_scans": 0,
"last_scan": null,
"return_name": null,
"return_address": null,
"return_address2": null,
"return_city": null,
"return_province": null,
"return_postal_code": null,
"display_addons": "+Standard Mail",
"display_status": "Fulfilled",
"display_trigger": "Campaign",
"display_type": "Postcard-4x6",
"giftcard_brand_longname": ""
}
}
If Order is in Reviewing Status, then this will cancel the order and refund the credits for the order back to your account. If the order can be successfully canceled, the status will be updated to cancelled.
const url = 'https://api.thanks.io/api/v2/orders/{orderId}/cancel';
const options = {method: 'PUT', headers: {Authorization: 'Bearer <token>'}, body: undefined};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
{
"order": {
"id": 42708,
"user_id": 2,
"sub_account_id": null,
"type": "postcard",
"message": "Hey %FIRST_NAME%!,\n\nTHANK YOU for allowing us the opportunity to HELP you with your plan!",
"message_template_id": 116,
"image_template_id": 195091,
"style": 1,
"handwriting_color": "#000001",
"font_size": "auto",
"realism": 40,
"size": "4x6",
"addons": {
"standardmail": "on"
},
"front_image": "https://s3.amazonaws.com/cdn.thanks.io/user_image_library/gFBaJJJWRp60op3ZOoK7UaO5I7zi33rdKQGgHylR.png",
"back_image": "",
"preview_images": [
"https://s3.amazonaws.com/cdn.thanks.io/user_image_library/gFBaJJJWRp60op3ZOoK7UaO5I7zi33rdKQGgHylR.png"
],
"thumbnail_images": [
"https://s3.amazonaws.com/cdn.thanks.io/user_image_library/gFBaJJJWRp60op3ZOoK7UaO5I7zi33rdKQGgHylR.png"
],
"high_quality_preview": "",
"custom_background_url": null,
"additional_letter_pages": null,
"skip_creative_generation": 0,
"giftcard_brand": null,
"giftcard_image": null,
"giftcard_amount": null,
"qrcode_url": null,
"mailing_list_ids_used": "3047",
"total_estimated_recipients": 1,
"authorization_total": 73,
"total_recipients": 1,
"grand_total": 73,
"status": "fulfilled",
"method": "drip",
"email_cc": null,
"total_scans": 0,
"unique_scans": 0,
"last_scan": null,
"return_name": null,
"return_address": null,
"return_address2": null,
"return_city": null,
"return_province": null,
"return_postal_code": null,
"display_addons": "+Standard Mail",
"display_status": "Fulfilled",
"display_trigger": "Campaign",
"display_type": "Postcard-4x6",
"giftcard_brand_longname": ""
}
}
Bearer token authentication using your thanks.io API key
OK
The response is of type object
.
Was this page helpful?