const options = {method: 'PUT', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.thanks.io/api/v2/orders/{orderId}/cancel', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"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://d2md0c8rpvzmz5.cloudfront.net/letter-backgrounds/bg0.png",
"back_image": "",
"preview_images": [
"https://d2md0c8rpvzmz5.cloudfront.net/letter-backgrounds/bg0.png"
],
"thumbnail_images": [
"https://d2md0c8rpvzmz5.cloudfront.net/letter-backgrounds/bg0.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 options = {method: 'PUT', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.thanks.io/api/v2/orders/{orderId}/cancel', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"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://d2md0c8rpvzmz5.cloudfront.net/letter-backgrounds/bg0.png",
"back_image": "",
"preview_images": [
"https://d2md0c8rpvzmz5.cloudfront.net/letter-backgrounds/bg0.png"
],
"thumbnail_images": [
"https://d2md0c8rpvzmz5.cloudfront.net/letter-backgrounds/bg0.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": ""
}
}Was this page helpful?