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

account_tax_ids expecting txi instead of atxi #448

Closed Dreaming-Codes closed 9 months ago

Dreaming-Codes commented 10 months ago

Describe the bug

Stripe returns an array of strings starting with "atxi", but this library expects "txi" instead.

To Reproduce

  1. Create a subscription product.
  2. Enter a tax ID at https://dashboard.stripe.com/settings/billing/invoice.
  3. Create a subscription using that product setting latest_invoice.payment_intent in the expand field.
  4. bad id is: atxi... (expected: "txi") for TaxIdId

Expected behavior

It doesn't produce an error.

Code snippets

let mut subscription_args = CreateSubscription::new(stripe_id);
            subscription_args.items = Some(vec![CreateSubscriptionItems {
                price: Some('your price id'),
                ..Default::default()
            }]);
            subscription_args.payment_behavior= Some(SubscriptionPaymentBehavior::DefaultIncomplete);
            subscription_args.payment_settings = Some(CreateSubscriptionPaymentSettings {
                save_default_payment_method: Some(CreateSubscriptionPaymentSettingsSaveDefaultPaymentMethod::OnSubscription),
                ..Default::default()
            });
            subscription_args.automatic_tax = Some(CreateSubscriptionAutomaticTax {
                enabled: false,
            });
            subscription_args.expand = &["latest_invoice.payment_intent"];

            let subscription = Subscription::create(&stripe, subscription_args).await.unwrap();

            let latest_invoice = subscription.latest_invoice.unwrap().into_object().unwrap();

            let payment_intent = latest_invoice.payment_intent.unwrap().into_object().unwrap();

OS

linux

Rust version

1.73.0

Library version

0.25.2

API version

2023-10-16

Additional context

No response