#Adi - redirect to checkout
1 messages · Page 1 of 1 (latest)
Hello. One moment
For the customer portal, are you just making a request to your backend to retrieve the URL?
yes
sorry from backend I am just sending customer billing portal session id
I don't see any redirect to customer portal mentioned here in the doc https://stripe.com/docs/billing/subscriptions/integrating-customer-portal?platform=billing#redirect
My goal is to navigate user to customer billing portal in reactjs. I am sending session id from nodejs
like this
router.post('/create-customer-portal-session', isAuth, async (req, res) => {
const user_id = req.userId;
const sessionData = req.body;
console.log("sessionData", sessionData)
// Authenticate your user.
const session = await stripe.billingPortal.sessions.create({
customer: sessionData.customerId,
return_url: 'http://localhost:3000/upgrade',
});
res.send({ id: session.id });
});
You should return session.url and then use javascript to redirect
ok let me check once from my end
thanks a lot session.url worked for me.
I have one question:
I have added 3 plans for my application.
$0 -> free plan
$10 -> basic plan + 7 day trial period
$20 -> standard plan + 7 day trial period
If user starts with free plan on 1st March and on 2nd March if user upgrades to $10 plan then trial period will get over on 9th March. Now what if user just cancels subscription on 8th March then he will not be charged is that correct? So in my application if subscription is cancelled then he will automatically be switched to free plan $0 per month this logic I have added. But next day i.e 9th March if user again come up and tries to subscribe $10 plan then will trial period again start? or he will be charged immediately because last time he started trial period but cancelled it later?
is it possible to disable billing address?
I am using this test card https://stripe.com/docs/checkout/quickstart 42424......
HI 👋 I'm stepping in for @indigo pulsar let me get caught up
I did not get what this message is Non-INR transactions in India should have shipping/billing address outside India. More info here: https://stripe.com/docs/india-exports
on dashboard do I need to update export information on dashboard?
this is current dashboard setting
This is a known error relating to the default billing features of our US test cards
while using built in checkout I dont get this message but on customer billing portal I get this
so which test cards should I use?
You can review more details about it here: https://stripe.com/docs/india-accept-international-payments
can you also check this question
I think, in this case, your system would need to keep track of this user's behavior and specifically eliminate the free trial period when creating the second subscription. Since it is a new subscription as far as Stripe is concerned.
ok got it
so does this issue happen only for test cards? in live mode it will not happen?
what if I don't want to take customers billing address, name & description?
or is that mandatory?
I am facing this issue in customer billing portal only. For pre built checkout it does not happen i.e upgrade/downgrading plan
Firs I would try testing with the India specific payment method you can find here: https://stripe.com/docs/testing#international-cards
Or setting a different country
setting different country did not work
I tried Indian card but after 3D secure it shows same msg
with USA card 3D secure was also not coming
Was it this card? 4000003560000008
yes
And this was a customer portal, you were tying to update a payment method?
yes correct
I have 3 plans free plan basic and standard plan
Initially when user is on free plan for first time I force user to go through stripe prebuilt checkout and it works fine for me I have done testing. Now on every subsequent plan upgrade or downgrade I dont force user to go through prebuilt stripe checkout but instead I navigate user to customer billing portal and there I am facing this issue
Right, that makes sense.
is this default behaviour of stripe or am I missing something from my end?
Can you send me the ID for the customer portal session?
or the request you made to create the customer portal session?
Can you send me the ID for the customer portal session?
I have not written any code for this I have configured directly from dashboard
You can find the request ID in the dashboard
Here's how you can find a request ID: https://support.stripe.com/questions/finding-the-id-for-an-api-request
req_LAyZnGZ94uxptR
Let me share code snippet for better understanding:
router.post('/create-customer-portal-session', isAuth, async (req, res) => {
const sessionData = req.body;
// Authenticate your user.
const session = await stripe.billingPortal.sessions.create({
customer: sessionData.customerId,
return_url: 'http://localhost:3000/upgrade',
});
res.send({ url: session.url });
});
any update?
Yes, a question. Which customer are you making this portal for? Do you always select India as the country when you are updating?
yes India country selected
And the customer?
customer is dummy I don't have customer billing address only using customer id and email
see this code #948250010418569296 message
I am only using customer here i.e customer id
Yes, but even if it's a customer you created just for testing having the customer ID to look at on our end will still be helpful. Also, if you select a different country (not India) from the dropdown do you still see the same error?
wait let me explain what I am doing
- User A register on my application & there are 3 plans: free $0 , basic $14 and standard $24 plan
- on successful register in DB I am storing user details and priceId of $0 plan
- Now user wants to upgrade or downgrade plan i.e switch to basic or standard now this is for first time so I dont navigate user to customer billing portal instead I navigate him to prebuilt checkout session there after successful checkout I add user and payment data in DB after checkout completed event. From this step I also have customer id with me.
- Next time user comes back he is navigated to customer billing portal and not prebuilt checkout why customer portal ?? because this time I have customer id which is used in above nodejs code.
- Now for customer portal checkout I am facing issues which I explained earlier
^^^ Please let me know if you have any questions
Yes, this all makes sense - but my question is why are you selecting India as the country when updating the Payment Method? Based on the error message it sounds like this is a non-INR subscription, so I'm wondering if you still see the same error if you don't select India in the dropdown
let me confirm once again
this is customer id cus_LF0bo9Nx4f8h0Y incase you want to check something
I checked did not worked for me I tried India country also tried another country did not work
Is this issue specific to test cards?
or am I missing something from customer billing portal?
Hmm.. let me do some more digging - give me a few minutes
only changing of plans i.e downgrade upgrade not working. Cancel subscription of customer billing portal working fine'
How did you create this customer? It looks like you created it with an India-based address, and so actually attempting to charge the customer is failing because you can't have an India billing address with a non-INR payment
How did you create this customer?
It gets automatically created if I use prebuilt checkout I just use that customer id later for customer billing portal
Gotcha - so I don't think we should've allowed you to save a India billing address in that Checkout Session (I'll flag this to the team). In the meantime, you should update that Customer to a non-India billing address (which you can do through the API, dashboard, or billing customer portal)
oh ok got it
so does that mean if customer is from India then prebuilt checkout will work for him but customer billing portal will not work for him because amount is in USD is this correct understanding?
Kind of - I think the only reason your India customer was able to work with Checkout was because the subscription was starting with a trial (so no payment was actually collected). I believe it should have actually failed at that point, but that's someting I need to take up with the team.
Essentially, you should never have an India based customer paying for things in USD
Then what would you suggest if I want to accept international as well as domestic payments?
Why not Indian customer can pay in USD actually he should be able to pay in USD even if billing address is India right?
On your frontend you should be prompting your customer for their country and then based on that information you can subscribe them to a price of the correct currency
And no, we wouldn't allow an Indian customer (with an India billing address) to pay in USD at all
But how will USD to INR conversion happen?? Do I need to handle that logic?? Or will stripe handle it?
What conversion are you specifically talking about? If you're talking about needing to have an INR price to charge your India customers, that would be something you create yourself (you'd create a new price object specifically in INR). If you're talking about the conversion of USD funds to INR in your Stripe account that would be something that happens automatically
No my question is using prebuilt checkout and customer billing portal will I be able to accept payments from Indian customers in USD or not?
No, as I said earlier - if your customer has an India billing address you will not be able to accept payment in USD from them. You would need to charge them in INR
So that means I will have to create another product with pricing in INR instead of USD right??
Correct
If I charge $14 USD then how should I do conversion in INR for entering value on stripe product dashboard ?? 1USD = 74 or sometimes more or less than that so there will be some price variation always
That's something you'd have to do yourself - you'd do the conversion on your end (there should be various tools for this online) and then create a price based on that
This thread has been archived. If you need help with anything else please ask in #dev-help or contact Stripe Support: https://support.stripe.com/contact
Find help and support for Stripe. Our support center provides answers on all types of situations, including account information, charges and refunds, and subscriptions information. Get your questions answered and find international support for Stripe.
Actually I did talk to support but they said it is currently not possible