#emmann_48287
1 messages · Page 1 of 1 (latest)
Hello! We'll be with you shortly. Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.
- emmann_48287, 5 days ago, 25 messages
Hello
You would need to calculate that just before you actually create the Checkout Session.
hii
You can't set a variable in your Checkout Session URLs
what you suggest instead?
Actually wait... I think that should work fine -- are you seeing an error?
yes i see error on the callback when it return seller url DOMAIN on CANCEL and SUCCESS
but with platform url it works fine
as i allow seller to have their domain
now it becomes a problem
you get it?
i'm using NODEJS
i mean to let you know the payment was successfull
but the callback not wokring because it's not dynamic
you get it?
in my head i'm wondering if Stripe save partially the origin REQUEST URL
No sorry, I don't get it. Do you mean that the redirect doesn't contain the Checkout Session ID?
Like we just use whatever you pass to your Checkout Session creation request
if so i could use it for dynamic callback
okay
but is there a way to make dynamic callback
that is my question
success_url: ${process.env.BASE_URL}/payment/success,
cancel_url: ${process.env.BASE_URL}/payment/cancel,
based on origin URL?
OR SOURCE
Yes that should work fine. As long as ${process.env.BASE_URL}/payment/success actually outputs an HTTPS URL then there should be no issue
no you don't get it
i would like to change this part of the code: ${process.env.BASE_URL} to make it dynamic
so that the callback success or cancel return in the URTL that sent the request
Can you give me an example of exactly what you are trying to do? I think we are speaking past each other.
okay let me grab the code
//direct charges to a standard connected account
exports.directChargesStandardAccount = async (req, res) => {
try {
const session = await stripe.checkout.sessions.create({
mode: 'payment',
line_items,
customer_email: req?.user?.email,
client_reference_id: req?.user?._id.toString(),
payment_intent_data: {
application_fee_amount: calculateApplicationFeeAmount(plan, itemsPrice),
},
metadata: {
shippingAddress: req?.body?.cart?.shippingAddress,
slug: req?.body?.cart?.slug,
sendingMethod: req?.body?.cart?.sendingMethod
},
shipping_options: [
{
shipping_rate_data: {
type: 'fixed_amount',
fixed_amount: {
amount: req.body.cart.shippingPrice * 100,
currency: 'brl',
},
display_name: 'Frete',
},
},
],
success_url: `${process.env.BASE_URL}/payment/success`,
cancel_url: `${process.env.BASE_URL}/payment/cancel`,
},
{ stripeAccount: req.body.cart.stripeAccountId }
);
res.send({ url: session.url })
} catch (error) {
console.log(error);
}
}
i'm interested in dynamic callback URL
instead of hard coded URL using .env
which is this part of the code: ${process.env.BASE_URL}
What is that BASE_URL? What would be an example of it?
EX: https://exemple.com as BASE_URL works fine when seller is using our BASE_URL however when seller is using https://hisdomain.com i don' t have a callback for it
This website is for sale! exemple.com is your first and best source for all of the information you’re looking for. From general topics to more of what you would expect to find here, exemple.com has it all. We hope you find what you are searching for!
you get it now?
Yeah okay we have been talking about the same thing all along. Yeah I mean that is totally up to how you want to handle the confirmation page. If the success URL is a page that you don't control then indeed you aren't going to be able to handle anything there in terms of what you display to the customer. However, you can still just use Webhooks for fulfillment purposes.
i'm using webhooks for managing confirmation payment and generate order
but im my head i would like to return based on the example i gave you: https://hisdomain.com/ payment/cancel or https://hisdomain.com/ payment/success
dynamically
That works totally fine. You can use any legitimate HTTPS URL for the success and cancel URLs... you don't have to directly control that URL yourself. You just won't be able to action that page.
So yeah now we are back to the beginning
humm, it would be nicer to me and to end user
you suggest to achieve that with webhooks i don't see how
because striope direct checkout remember the callback registred
You use Webhooks for your own internal processes server-side.
Not for client-side actions.
yes
how it should be handle in a webhooks context
i just don't know and don't see how
What is "it"?