Update Customer

Update a customer's information.

Request

use dodopayments_rust::{models::PatchCustomerRequest, 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 customer_id = "cus_xxxxxxxxxx";

    let resp = client
        .customers()
        .id(customer_id)
        .update()
        .body(PatchCustomerRequest {
            name: Some("Updated Name".to_string()),
            ..Default::default()
        })
        .send()
        .await?;

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

    Ok(())
}

Path Parameters

ParameterTypeDescription
customer_idstringCustomer Id

Body

FieldTypeDescription
emailobject
metadataobject
nameobject
phone_numberobject

Responses

200 Status

FieldTypeDescription
business_idstring
created_atstring
customer_idstring
emailstring
metadataMetadataAdditional metadata for the customer
namestring
phone_numberobject

422 Status

Invalid Request Object or Parameters

500 Status

Something went wrong :(