#procrastination_inc
1 messages ยท Page 1 of 1 (latest)
Hello ๐
Have you looked at this guide already?
https://stripe.com/docs/tax/subscriptions
If not, I'd recommend looking through it briefly, as it provides step by step instructions
Yes, I've looked at it. And what is strange, is when I create a link, it offers to enter the country and the postal code, which in turn is adding taxes. So I know the taxes are well set.
It's when I use the link already in Invoice that it down work.
Ah, hosted invoice page doesn't collect billing address so I don't think it would know what taxes to add on and so.
Great. So is there another way to pay subscription with taxes?
You can use Stripe Checkout to create these subscriptions with automatic taxes
We have a guide here for that
https://stripe.com/docs/billing/subscriptions/build-subscriptions
Quick question, are you using the APIs OR just trying to do this via the dashboard?
I'm using API. And your right, it worker, in some way. I had to setup like this:
$stripe->checkout->sessions->create([
'success_url' => 'https://example.com/success',
'customer' => $customer,
'automatic_tax' => [
'enabled' => 'true',
],
'customer_update' => [
'address' => 'auto',
],
'line_items' => [
[
'price' => $price,
'quantity' => 1,
],
],
'mode' => 'subscription',
]);
with automatic taxes, and customer update. I have one last problem. I never receive the subscrition number associater with that. I need it someplace else in my code.
Where exactly are you looking for the subscription ID?
Usualy, when I did the other way around, as a response, it gave me a subscription ID, that I stored in my database, so I can check later, when the customer return, with a subscription retreive, if the subscription was active. But now, in the response of the checkout, there is a subscription field, but it's empty...
[status] => open
[submit_type] =>
[subscription] =>
[success_url] => https://example.com/success
[total_details] => Stripe\StripeObject Object
(
[amount_discount] => 0
[amount_shipping] => 0
[amount_tax] => 0
)
[url] => https://checkout.stripe.com/c/pay/cs_test_a1WMZGyyedbxuJNXVZsqdgqjzo68cY7WamY7gp3N9HZ1CQkgdli2cG5l2c#fidkdWxOYHwnPyd1blpxYHZxWjA0SWp0TWBHaUxkcX1KY0tNX05mVFRIMTxNdDF0amx3U21VYHZ9djF0NnVRQ1RtSUhOQnNJcVI9R2xOSmN0bj1WMWRfY3w2VjZ1T3B%2FRlY8M05cR319QUlKNTUwcFM9RzQ9VycpJ2N3amhWYHdzYHcnP3F3cGApJ2lkfGpwcVF8dWAnPyd2bGtiaWBabHFgaCcpJ2BrZGdpYFVpZGZgbWppYWB3dic%2FcXdwYHgl
)
How do I get the subscription number when the guy actually checked out?
Two options, you can either retrieve the Checkout Session by calling the API OR You can listen to checkout.session.completed webhook event
Once the checkout is complete and subscription is created then the subscription property on the checkout object should have its ID
https://stripe.com/docs/api/checkout/sessions/object#checkout_session_object-subscription
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Thanks. In fact, we found something that will help us in the way we want:
https://stripe.com/docs/payments/checkout/custom-success-page
So if the client succeed in paying he will be return in a page success with a GET with the value {CHECKOUT_SESSION_ID}.
I guess that if we retreive the checkout session, with this ID, and that the subscription is paid, we will get the subscription ID, and then all is okay... Am I correct to assume that?
Hi ๐
Yes this is correct. The Checkout Session object will include the subscription ID if the subscription was successful.
Great, is seems to work. greatly so far... We'll do some more checkups...
Question, just like that, On checkout, is there a way, for the client, to see what would the price in his/her currency?