/subscriptions/addons/create/{uuid}
| 1 | const response = await fetch("https://api.tamio.com/v2/subscriptions/addons/create/{uuid}", { |
| 2 | method: "POST", |
| 3 | headers: { |
| 4 | "Authorization": "Bearer YOUR_API_KEY", |
| 5 | "Content-Type": "application/json" |
| 6 | }, |
| 7 | body: JSON.stringify({ |
| 8 | "description": "Premium Support Package", |
| 9 | "cost": 1500, |
| 10 | "duration": "recurring", |
| 11 | "number_of_payments": null, |
| 12 | "vat_classification": "digital", |
| 13 | "tax_calculation": "exclusive", |
| 14 | "tax_rate": { |
| 15 | "label": "VAT 21%", |
| 16 | "rate": 21 |
| 17 | } |
| 18 | }) |
| 19 | }); |
| 20 | const data = await response.json(); |
| 1 | require "uri" |
| 2 | require "net/http" |
| 3 | require "json" |
| 4 | |
| 5 | url = URI("https://api.tamio.com/v2/subscriptions/addons/create/{uuid}") |
| 6 | |
| 7 | https = Net::HTTP.new(url.host, url.port) |
| 8 | https.use_ssl = true |
| 9 | |
| 10 | request = Net::HTTP::Post.new(url) |
| 11 | request["Accept"] = "application/json" |
| 12 | request["Authorization"] = "Bearer YOUR_API_KEY" |
| 13 | request["Content-Type"] = "application/json" |
| 14 | request.body = { |
| 15 | description: "Premium Support Package", |
| 16 | cost: 1500, |
| 17 | duration: "recurring", |
| 18 | number_of_payments: nil, |
| 19 | vat_classification: "digital", |
| 20 | tax_calculation: "exclusive", |
| 21 | tax_rate: { |
| 22 | label: "VAT 21%", |
| 23 | rate: 21 |
| 24 | } |
| 25 | }.to_json |
| 26 | |
| 27 | response = https.request(request) |
| 28 | puts response.read_body |
Responses
{
"status": 200,
"subscription": {
"id": "999e4567-e89b-12d3-a456-426614174000",
"object": "subscription",
"next_billing_date": 1735689600,
"cancellation_date": null,
"completion_date": null,
"resumes_at": null,
"products": [
{
"id": "bbb24567-e89b-12d3-a456-426614174000",
"name": "Pro Plan"
}
],
"payment_count": 12,
"status": "active",
"has_discount": false,
"gateway_subscription_id": "sub_1PaBcDeFgHiJkLmN",
"type": "subscription",
"gateway": "stripe",
"billing_cycle": "month",
"interval": 1,
"currency": "EUR",
"invoice_id": "aaa14567-e89b-12d3-a456-426614174000",
"price": 2990,
"lifetime_revenue": 35880,
"management_link": "https://billing.example.com",
"instalments_count": 0,
"customer": {
"id": "ccc34567-e89b-12d3-a456-426614174000",
"name": "John",
"first_name": "John",
"last_name": "Doe",
"email": "[email protected]",
"locale": "en",
"client_id": null,
"address_id": null
},
"imported": false,
"has_notes": false
},
"upcoming_invoice": {},
"addon": {
"id": "fff64567-e89b-12d3-a456-426614174000",
"object": "addon",
"description": "Premium Support Package",
"amount": 1500,
"currency": "eur",
"duration": "recurring",
"type": "subscription_addon",
"subscription_id": "999e4567-e89b-12d3-a456-426614174000",
"payment_count": 3,
"number_of_payments": null
}
}