#fedoraus
1 messages · Page 1 of 1 (latest)
Hi look at my function
exports.getCustomerPortalLink = functions.https.onRequest(async (req, res) => {
try {
const uid = req.query.uid;
// Проверяем, что пользователь аутентифицирован
if (!uid) {
res.status(401).send('User must be authenticated.');
return;
}
// Получаем данные пользователя из Firestore
const userSnapshot = await firestore.doc(uid).get();
const userData = userSnapshot.data();
if (!userData || !userData.customer_id) {
res.status(404).send('Customer ID not found.');
return;
}
const customerId = userData.customer_id;
// Генерируем ссылку на портал покупателя
const session = await stripeTest.billingPortal.sessions.create({
customer: customerId,
returnUrl: 'https://www.google.com/',
});
res.send({
portalLink: session.url,
});
} catch (error) {
console.error(error);
res.status(500).send('Server error occurred.');
}
});
im using firebase cloud fuctions to create custom portal session for user
firebase returns me a link, and i put uid of user like query param, i check my logs and stripe send me error w code unknown param
but i put param in my firebase function, like in request link, it doesnt matter
Not sure I fully understand. Can you find a request ID where you're seeing the above mentioned error?
https://support.stripe.com/questions/finding-the-id-for-an-api-request
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.
my bad
i wrote returnUrl
but not return_url
ty, logs page helped me
they wrote like: may be you mean return_url? XD
ah nice 😄 glad you figured it out
return url is required param?
Based on the API ref, it looks like it is optional
https://stripe.com/docs/api/customer_portal/sessions/create
👍
invalid_request_error
You can’t create a portal session in test mode until you save your customer portal settings in test mode at https://dashboard.stripe.com/test/settings/billing/portal
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
how i can save my customer portal settings??
Try going to the link above