Deactivate License

Deactivate a license for the user.

Request

use dodopayments_rust::{
    models::DeactivateLicenseKeyRequest, 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
        .licenses()
        .deactivate()
        .body(DeactivateLicenseKeyRequest {
            license_key: "lic_xxxxxxxxxx".to_string(),
            license_key_instance_id: "lki_xxxxxxxxxx".to_string(),
        })
        .send()
        .await?;

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

    Ok(())
}

Body

FieldTypeDescription
license_keystring
license_key_instance_idstring

Responses

200 Status

License key instance deactivated successfully

403 Status

License key instance not found or does not belong to this license key

404 Status

License key not found

500 Status

Something went wrong :(