Skip to content

ProductData name field not accepting % character in 1.0.0-rc #922

Description

@joepragma

Describe the bug

Hey, we recently upgraded our project's version of this async-stripe dependency from 0.41 to 1.0.0-rc.5. We had a working flow that would create a checkout session with a custom line item (using product_data) that had a name like "Custom %20 Fee". After upgrading the request to build the checkout session started giving us the error below and after commenting out piece by piece, I narrowed it down to the name field on the product_data in one of the line_items.

Error we would get on checkout session creation response:

Invalid request (check your POST parameters): For assistance, contact support at https://support.stripe.com/contact/.\

My AI believes it might be related to upgrading serde_qs from 0.x to 1.x between 0.41 and 1.0.0-rc.5, and potentially could be fixed by using .use_form_encoding(true) when configuring serde_qs.

To Reproduce

Attempt to create a CheckoutSession with a % in a product_data's name field, e.g.:

stripe_api::CreateCheckoutSession::new()
    .line_items(vec![
        stripe_api::CreateCheckoutSessionLineItems {
            price_data: Some(stripe_api::CreateCheckoutSessionLineItemsPriceData {
                unit_amount: Some(10000),
                currency: stripe_api::Currency::USD,
                product_data: Some(stripe_api::CreateCheckoutSessionLineItemsPriceDataProductData {
                    name: "Custom %20 Fee".to_string(),
                    tax_code: Some("txcd_10103001".to_string()),
                    description: None,
                    images: None,
                    metadata: None,
                    unit_label: None,
                }),
                product: None,
                recurring: None,
                tax_behavior: None,
                unit_amount_decimal: None,
            }),
            quantity: Some(1),
            ..Default::default()
        },
    ])

Expected behavior

It would accept the checkout session request with a line item whose name contains a % sign

Code snippets

OS

Windows 11

Rust version

rustc 1.95.0 (59807616e 2026-04-14)

Library version

async-stripe 1.0.0-rc.5

API version

Not sure what this is, sorry.

Additional context

Also unrelated, the CreateCheckoutSessionLineItemsPriceData and CreateCheckoutSessionLineItemsPriceDataProductData types don't derive the Default trait which would be nice for us :D

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions