Billing App APIs
Invoice Actions
Cancel specific invoice
1 min
code examples curl location globoff request post 'https //{tenant id} {stack base domain}/tms/api/v1/billing/transporter/cancel invoice/{invoice id}' \\ \ header 'accept application/json' \\ \ header 'content type application/json'var myheaders = new headers(); myheaders append("accept", "application/json"); myheaders append("content type", "application/json"); var requestoptions = { method 'post', headers myheaders, redirect 'follow' }; fetch("https //{tenant id} {stack base domain}/tms/api/v1/billing/transporter/cancel invoice/{invoice id}", requestoptions) then(response => response text()) then(result => console log(result)) catch(error => console log('error', error));require "uri" require "json" require "net/http" url = uri("https //{tenant id} {stack base domain}/tms/api/v1/billing/transporter/cancel invoice/{invoice id}") https = net http new(url host, url port) https use ssl = true request = net http post new(url) request\["accept"] = "application/json" request\["content type"] = "application/json" response = https request(request) puts response read body import requests import json url = "https //{tenant id} {stack base domain}/tms/api/v1/billing/transporter/cancel invoice/{invoice id}" payload = {} headers = { 'accept' 'application/json', 'content type' 'application/json' } response = requests request("post", url, headers=headers, data=payload) print(response text) responses // invoice cancelled successfully { "data" { "success" true, "message" "invoice cancelled successfully", "invoiceid" "inv 20241201 001" }, "message" "success", "status" "success" }// bad request invalid invoice id { "message" "invalid charge id provided", "status" "error", "errorcode" "invalid charge id" }// unauthorized invalid authentication { "message" "invalid charge id provided", "status" "error", "errorcode" "invalid charge id" }// forbidden cannot cancel this invoice { "message" "invalid charge id provided", "status" "error", "errorcode" "invalid charge id" }// invoice not found { "message" "invalid charge id provided", "status" "error", "errorcode" "invalid charge id" }// internal server error { "message" "invalid charge id provided", "status" "error", "errorcode" "invalid charge id" }
