#bmizerany-subscription-tax
1 messages · Page 1 of 1 (latest)
I've seen that.
Which is why I'm confused. :/
f the transaction is tied to a payment method with full billing details we use that billing address.
But it doesn't
I mean no
We use the first viable item in the list below to determine your customer’s location:
oh also this is a SubscriptionSchedule update not a net new subscription
bmizerany-subscription-tax
Can you reproduce simply with a less advanced use-case and just a simple Subscription creation first to make debugging this a lot easier?
Let me try
I'll try in the dashboard. Rewriting the logic for this might take a bit longer
ultimately: that Customer has an address so we use that, that's what the doc says right?
The dashboard seems to pick it up
oh
Sorry. That is the customer I manually entered an address for. Let me try another.
I removed the billing address, and attempted the same subscription
now:
At the top: "needs address". At the bottom: "attached payment method with billing address"
Yeah sorry this is a picture with no info. I'm happy to help, but I need you to share exact code, exact ids, etc. I don't really know much/anything about the Dashboard
would be great to solely focus on the simplest case possible and not touch Schedules at all. They are a lot more advanced and confusing, so while you try tp debug this just focus on a simple Subscription creation
they are confusing
but we need them
I'll see if I can use the cli to replicate with a subscription only
our app creates subscriptions through schedules though
Sounds good, though writing quick code to reproduce this in your favourite language and making this an end to end reproducible test case would be super helpful
there is nothing quick about working with the stripe API 🙂 I'm working on something though
ouch
that is so complex, going through Checkout and all that
Checkout handles tax differently too so I'm quite confused
how is that complex?
sorry
trying to make this easy
Am I using stripe in ways it says not to?
I went through checkout to collect the payment_method
I can't do that via the API
and didn't want to setup my own stripe elements stuff 🙂
to checkout, I need a customer ID
to create the subscription, I need a price
so, this is the bare minimum
Fair. All I need is one request that creates a Subscription with an existing Customer and PaymentMethod that exhibits the issue mostly
are you saying that if you try with a Subscription it "just works" and it might be a Schedule issue?
or is it that your Customer is now set up differently?
not sure
related as I keep moving: https://stripe.com/docs/api/subscription_schedules/create says start_date is optional... it is not according to the production API
Yup
It's a schedule thing
It seems
"error": {
"code": "customer_tax_location_invalid",
"doc_url": "https://stripe.com/docs/error-codes/customer-tax-location-invalid",
"message": "The customer cus_NVGEtUe9fAq6mr's location isn't recognized by the tax engine. Set an `address` on the customer object and verify with the `tax[automatic_tax]` status.",
"request_log_url": "https://dashboard.stripe.com/test/logs/req_oV0RO3KhLAWWep?t=1678492277",
"type": "invalid_request_error"
}
}```
getting a request ID
for record keeping https://gist.github.com/bmizerany/31649bcf4c038b6b2bc5d94630b7f446
Request ID req_oV0RO3KhLAWWep
okay so on the same exact customer creating a Subscription works and a Schedule fails with the same details?
let's try
yes
same customer ID and same PM == works with subscriptions, not with schedules: https://gist.github.com/bmizerany/31649bcf4c038b6b2bc5d94630b7f446
Can I ask for the exact request id for each one?
is it req_oV0RO3KhLAWWep is the Schedule failure and in your gist the whole thing is the same Customer/PaymentMethod?
yeah no it's not the same customer nor payment method id on both
I'm sorry, I'm really struggling to help you without actionable repro/details right now. That's why I tried to explain that writing the code to create the objects directly was the best option
1/ Setup a Customer however you prefer
2/ After that, create a Subscription with automatic tax -> see what happens
3/ Same exact customer, create a SubscriptionSchedule with automatic tax -> see what happens
Techincally, I did write code
The script above does what you're asking for sans request_IDS
I'll work on getting the request ids
sounds good. I'm also trying to reproduce now that I see better what you are trying to do based on those requests.
running the script sh x.sh with stripe and jq installed will repro
yeah I don't really use the CLI and it requires going through Checkout and all that so it's too slow
req_TpS2m4zwVk6FXW // create price
req_jRd0wDGyoOjI8k // create customer
req_sw2ZNU1BUAV4tH // checkout session
req_zHelFIo6SAqBpM // list payment methods
req_O4bU2BBVn25Tbs // payment pages? not part of the script
req_iqkGOSN54q2z4I // create subscription
req_E1cMaDparqJQ1M // create subscription schedule
thanks the last 2 is what I needed since my own end to end code doesn't reproduce the bug. Let me dig into what's different
did you add a billing address to the payment and ensure the customer has no billing/shipp[ing/any address and attach the payment method on creating the schedule?
and attach the payment method on creating the schedule?
I don't know what that sentence could mean. A PaymentMethod is attached separately
I'm creating a schedule with a specific payment method for a customer that has a payment method, but not one that is the default. In fact they have no default payment method, by design
yeah but in both requests you force the same default
but let me try without a default
I do that on purpose
oh wow
I want a specific pament method for that specific subscription
Okay so I think the problem is basically that the default_payment_method applies at the phase level. And I assume we have a bug where we ignore that and look for a valid "global" address somewhere
And so on the Schedule we basically go "well you don't have an address on the customer, your Customer doesn't have a default PM with an address => error
in my opinion we shouldn't error we should see the default PM id for the first phase and use that
require_once('config.php');
$paymentMethod = $stripe->paymentMethods->retrieve('pm_card_visa');
$customer = $stripe->customers->create([
'email' => 'remi@stripe.com',
'payment_method' => $paymentMethod->id,
'invoice_settings' => [
'default_payment_method' => $paymentMethod->id,
],
]);
$paymentMethod = $stripe->paymentMethods->update(
$paymentMethod->id,
[
'billing_details' => [
'address' => [
'line1' => '18th street',
'city' => 'City',
'postal_code' => '90210',
'state' => 'CA',
'country' => 'US',
],
],
]
);
$schedule = $stripe->subscriptionSchedules->create([
'customer' => $customer->id,
'start_date' => 'now',
'phases' => [
[
'default_payment_method' => $paymentMethod->id,
'automatic_tax' => [
'enabled' => true,
],
'items' => [
['price' => 'price_1JpxpOCCAL7IFULREt1tCMcc'],
],
'iterations' => 1,
],
],
'expand' => ['subscription'],
]);
here's my end to end code in PHP to reproduce. Basically if I remove invoice_settings from the Customer creation, I get the same error you do
and I just paired with a colleague who agrees that's the issue
I didn't notice at first because I have lots of code snippets I re-use and so whenever I create a customer with a PM I always make it the default to avoid issues 😅
even your requests looked identical until you said
In fact they have no default payment method, by design
that's the one thing I didn't catch when I looked at your logs
We would prefer to avoid using default payment method
there are other things going on with subsriptions and not all customers want the pay for each on the same card
yeah I mean there's no much you can do here, this is a real bug IMO but it will take a while to fix
so constantly updatding the global default payment method causes issues with race conditions
ah okay. well at least we know its a bug
its hug bummer of one too
really cool shit 🙂
we want to sell packages that auto ramp up over time
or down
also, customers want to change their CC in the future, and (well the docs say) we can do that with schedules: )
but alas
okay so technically you could
1/ Start a Subscription with automatic tax and the first phase
2/ Right after, turn this into a Schedule with the right future phases
a bit convoluted but it'd solve your problem
rihgt
I was going to do that
I already have the code to create schedules frmo subsscriptions that do not have them
that only kicked in if there was not schedule, but there existed a subscription. Now I'll just make that the default behavior when creating or updating
is there an issue/ticket/tracking # I can have to inquire about the status of this after some time?
no I would highly recommend writing to our support team: https://support.stripe.com/contact and flagging. Mention you talked to me.
But I'm reporting the bug too so that it gets fixed at least
Thank you
I'll do that
You have been extremely helpful. I appreciate it. Thank you so very much!!!!!
Of course, thanks for the patience reproducing this with me, I know it's tough sometimes to write end to end code that does it all