arlyon / async-stripe

Async (and blocking!) Rust bindings for the Stripe API
https://payments.rs
Apache License 2.0
436 stars 127 forks source link

invalid `TokenId`, expected unknown id prefix #423

Closed thelmuxkriovar closed 11 months ago

thelmuxkriovar commented 1 year ago

Describe the bug

When using stripe::Token::create and creating an account token, async-stripe fails to deserialize the request and returns the following Err:

Err(JSONSerialize(Error { path: Path { segments: [Map { key: "id" }] }, original: Error("invalid `TokenId`, expected unknown id prefix", line: 2, column: 37) })

I have verified that the request went through correctly on stripe's end, as you can see from the following screenshot of stripe's requests log

image

To Reproduce

Simplest code to reproduce this:

let stripe_account_token = stripe::Token::create(
        &stripe_client,
        stripe::CreateToken {
            account: Some(stripe::CreateTokenAccount {
                business_type: Some(stripe_create_token_business_type),
                company: company_params.clone(),
                individual: Some(individual_params.clone()),
                tos_shown_and_accepted: Some(true),
            }),
            card: None,
            customer: None,
            cvc_update: None,
            expand: &[],
            person: None,
            pii: None,
        },
    )
    .await?;

Expected behavior

I expect the token to be parsed correctly

Code snippets

No response

OS

irrelevant

Rust version

1.70.0

Library version

0.22.2

API version

2022-11-15

Additional context

No response

arlyon commented 1 year ago

Thanks for this! Looks like we are missing that prefix in the list of ids. I will open a PR asap.

arlyon commented 11 months ago

PR merged and released, closing