const options = {method: 'PUT', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.thanks.io/api/v2/order/{order_id}/cancel', options)
.then(response => response.json())
.then(response => console.log(response))
.catch(err => console.error(err));
{
"order": {
"id": 37294,
"user_id": 2,
"sub_account_id": 66,
"type": "postcard",
"message": "Dear %FIRST_NAME%\r\n\r\nHope all is well\n\n-John Doe",
"message_template_id": null,
"style": 4,
"handwriting_color": null,
"size": "6x9",
"addons": null,
"envelope_id": null,
"front_image": "https://s3.amazonaws.com/cdn.thanks.io/user_image_library/1533645532.png",
"back_image": null,
"high_quality_preview": null,
"is_dynamic": 0,
"append_or_current_resident": 0,
"dynamic_image_url": null,
"custom_background_url": null,
"additional_letter_pages": null,
"additional_letter_pages_count": 0,
"giftcard_brand": null,
"giftcard_image": null,
"giftcard_amount": null,
"qrcode_url": null,
"share_image": null,
"mailing_lists": null,
"mailing_list_ids_used": null,
"campaign_id": null,
"total_estimated_recipients": 3,
"sales_tax_total": 0,
"authorization_total": 267,
"total_recipients": 0,
"grand_total": 0,
"leads_fee": 0,
"transaction_id": 38080,
"settled": 1,
"status": "cancelled",
"method": "api",
"email_cc": null,
"notifications": null,
"return_name": null,
"return_address": null,
"return_address2": null,
"return_city": null,
"return_province": null,
"return_postal_code": null,
"allow_share": 0,
"session_id": null,
"created_at": "2020-04-06 00:20:31",
"updated_at": "2023-10-04 02:46:14",
"display_addons": "",
"display_status": "Cancelled",
"display_trigger": "API",
"display_type": "Postcard-6x9",
"handwriting_image": null,
"share_url": "https://dashboard.thanks.io/share/order/37294",
"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.
const options = {method: 'PUT', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.thanks.io/api/v2/order/{order_id}/cancel', options)
.then(response => response.json())
.then(response => console.log(response))
.catch(err => console.error(err));
{
"order": {
"id": 37294,
"user_id": 2,
"sub_account_id": 66,
"type": "postcard",
"message": "Dear %FIRST_NAME%\r\n\r\nHope all is well\n\n-John Doe",
"message_template_id": null,
"style": 4,
"handwriting_color": null,
"size": "6x9",
"addons": null,
"envelope_id": null,
"front_image": "https://s3.amazonaws.com/cdn.thanks.io/user_image_library/1533645532.png",
"back_image": null,
"high_quality_preview": null,
"is_dynamic": 0,
"append_or_current_resident": 0,
"dynamic_image_url": null,
"custom_background_url": null,
"additional_letter_pages": null,
"additional_letter_pages_count": 0,
"giftcard_brand": null,
"giftcard_image": null,
"giftcard_amount": null,
"qrcode_url": null,
"share_image": null,
"mailing_lists": null,
"mailing_list_ids_used": null,
"campaign_id": null,
"total_estimated_recipients": 3,
"sales_tax_total": 0,
"authorization_total": 267,
"total_recipients": 0,
"grand_total": 0,
"leads_fee": 0,
"transaction_id": 38080,
"settled": 1,
"status": "cancelled",
"method": "api",
"email_cc": null,
"notifications": null,
"return_name": null,
"return_address": null,
"return_address2": null,
"return_city": null,
"return_province": null,
"return_postal_code": null,
"allow_share": 0,
"session_id": null,
"created_at": "2020-04-06 00:20:31",
"updated_at": "2023-10-04 02:46:14",
"display_addons": "",
"display_status": "Cancelled",
"display_trigger": "API",
"display_type": "Postcard-6x9",
"handwriting_image": null,
"share_url": "https://dashboard.thanks.io/share/order/37294",
"giftcard_brand_longname": ""
}
}
Bearer authentication header of the form Bearer <token>
, where <token>
is your auth token.
OK
The response is of type object
.
Was this page helpful?