Operations API
Subscriptions
Update Subscription
this api endpoint (post) (post) updates the billing plan of a subscription if the request succeeds, it returns a subscription object docid\ k0wuvfe yqdvzc3q awny permissions subscriptions edit webhook event subscription events docid v9nhlsjkke9ztmipzzh8 if you want to see which billing plans are available to use as upgrades and downgrades before making the request, see the retrieve upgrades docid aplqgai2c tr d8p1yhn endpoint path parameters id the id of the subscription to update body parameters id string the id of the new billing plan pricing model id string the id of the new pricing model prorations boolean determines whether any charges that might occur due to the upgrade will be prorated the default value is false require "uri" require "json" require "net/http" url = uri("https //api tamio com/v2/subscriptions/update/c121e306 b129 4289 a093 03d71700cee4") 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 token here" data = { id "957003bd dc98 422d 8dc7 44929e191a70", pricing model id "0eebfc41 62d7 47bb 9528 00dd165944e5" } request body = data to json response = https request(request) puts response read bodycurl location request post 'https //api tamio com/v2/subscriptions/update/c121e306 b129 4289 a093 03d71700cee4' \\ \ header 'accept application/json' \\ \ header 'authorization bearer your token here' \\ \ data raw '{ "id" "957003bd dc98 422d 8dc7 44929e191a70", "pricing model id" "0eebfc41 62d7 47bb 9528 00dd165944e5" }'var myheaders = new headers(); myheaders append("accept", "application/json"); myheaders append("authorization", "bearer your token here"); var data = { id "957003bd dc98 422d 8dc7 44929e191a70", pricing model id "0eebfc41 62d7 47bb 9528 00dd165944e5" }; var body = json stringify(data); var requestoptions = { method 'post', headers myheaders, body body }; fetch("https //api tamio com/v2/subscriptions/update/c121e306 b129 4289 a093 03d71700cee4", requestoptions) then(response => response text()) then(result => console log(result)) catch(error => console log('error', error));{ "subscription" { "id" "c121e306 b129 4289 a093 03d71700cee4", "object" "subscription", "next billing date" null, "cancellation date" null, "completion date" null, "resumes at" null, "customer" { "id" "0f60c860 ec5a 4a53 b730 9388eb7922d7", "name" "john", "last name" "doe", "email" "johndoe\@example com", "locale" "en" }, "products" \[ { "id" "957003bd dc98 422d 8dc7 44929e191a70", "name" "awesome billing plan" } ], "payment count" 13, "status" "paused", "gateway subscription id" "sub 1lhyvjgvhw7af69dgzqsqr9r", "type" "subscription", "gateway" "stripe", "billing cycle" "month", "interval" 1, "currency" "eur", "price" 100 }, "status" 200 }