Transactions API
Validate Coupons
this api endpoint (post) (post) checks if the coupons are valid and can be used when creating a transaction body parameters currency string appendix docid\ kfbmx4q3dxjtduqf75yx1 the currency of the future transaction coupons array of strings an array of strings, each representing a coupon that you want to validate products array of strings an array of uuid, each representing a product associated with the future transaction customer country ( appendix docid\ kfbmx4q3dxjtduqf75yx1 ) an array of countries to use during coupon validation require "uri" require "json" require "net/http" url = uri("https //api tamio com/v2/transactions/validate coupons") https = net http new(url host, url port) https use ssl = true request = net http post new(url) request\["accept"] = "application/json" request\["authorization"] = "bearer your publishable token here" data = { products \[ "1bf4e94c fe47 49e9 862c fa83733c1618" ], coupons \[ "blcgr1opdo6" ], currency "eur" } request body = data to json response = https request(request) puts response read bodycurl location request post 'https //api tamio com/v2/transactions/validate coupons' \\ \ header 'accept application/json' \\ \ header 'authorization bearer your publishable token here' \\ \ data raw '{"products" \["1bf4e94c fe47 49e9 862c fa83733c1618"], "coupons" \[ "blcgr1opdo6"],"currency" "eur"}'var myheaders = new headers(); myheaders append("accept", "application/json"); myheaders append("authorization", "bearer your publishable token here"); var data = { products \[ "1bf4e94c fe47 49e9 862c fa83733c1618" ], coupons \[ "blcgr1opdo6" ], currency "eur" }; var body = json stringify(data); var requestoptions = { method 'post', headers myheaders, body body }; fetch("https //api tamio com/v2/transactions/validate coupons", requestoptions) then(response => response text()) then(result => console log(result)) catch(error => console log('error', error));{ "status" 200, "coupons" \[ { "valid" true, "amount off" 0, "percent off" 2 0, "shipping amount off" 0, "shipping percent off" 2 0, "currency" "eur", "coupon" "blcgr1opdo6", "requirements" null } ] }