Update Product

Update a product's details.

Request

use dodopayments_rust::{models::PatchProductRequest, 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 product_id = "prod_xxxxxxxxxx";

    let resp = client
        .products()
        .id(product_id)
        .update()
        .body(PatchProductRequest {
            name: Some("Updated Product".to_string()),
            ..Default::default()
        })
        .send()
        .await?;

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

    Ok(())
}

Path Parameters

ParameterTypeDescription
idstring``

Body

FieldTypeDescription
addonsobjectAvailable Addons for subscription products
brand_idobject
credit_entitlementsobjectCredit entitlements to update (replaces all existing when present) Send empty array to remove all, omit field to leave unchanged
descriptionobjectDescription of the product, optional and must be at most 1000 characters.
digital_product_deliveryobject
image_idobjectProduct image id after its uploaded to S3
license_key_activation_messageobjectMessage sent to the customer upon license key activation. Only applicable if license_key_enabled is true. This message contains instructions for activating the license key.
license_key_activations_limitobjectLimit for the number of activations for the license key. Only applicable if license_key_enabled is true. Represents the maximum number of times the license key can be activated.
license_key_durationobject
license_key_enabledobjectWhether the product requires a license key. If true, additional fields related to license key (duration, activations limit, activation message) become applicable.
metadataobject
nameobjectName of the product, optional and must be at most 100 characters.
priceobject
tax_categoryobject

Responses

200 Status

Product Updated Successfully

422 Status

Invalid Request Object or Parameters

500 Status

Something went wrong :(