Create Addon

Create a new addon product that can be attached to subscription products.

Request

use dodopayments_rust::{models::CreateAddonRequest, to_pretty_json, DodoPaymentsClientBuilder};

#[tokio::main]

async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let api_key = std::env::var("DODO_API_KEY")?;

    let client = DodoPaymentsClientBuilder::new()
        .bearer_token(&api_key)
        .enviroment("test_mode")
        .build()?;

    let resp = client
        .addons()
        .create()
        .body(CreateAddonRequest {
            name: "Premium Support".to_string(),
            price: 99,
            ..Default::default()
        })
        .send()
        .await?;

    println!("{}", to_pretty_json(&resp)?);

    Ok(())
}

Body

FieldTypeDescription
currencyCurrencyThe currency of the Addon
descriptionobjectOptional description of the Addon
namestringName of the Addon
priceintegerAmount of the addon
tax_categoryTaxCategoryTax category applied to this Addon

Responses

200 Status

FieldTypeDescription
business_idstringUnique identifier for the business to which the addon belongs.
created_atstringCreated time
currencyCurrencyCurrency of the Addon
descriptionobjectOptional description of the Addon
idstringid of the Addon
imageobjectImage of the Addon
namestringName of the Addon
priceintegerAmount of the addon
tax_categoryTaxCategoryTax category applied to this Addon
updated_atstringUpdated time

Create a new addon

422 Status

Invalid Request Object or Parameters

500 Status

Something went wrong :(