#rehman - PaymentLink fulfillment

1 messages ยท Page 1 of 1 (latest)

vague parrot
#

Hello, can you tell me a bit more about how your flow is supposed to work? How are you currently trying to update the custom page of your website?

bright mason
#

So what I'm doing is I created a payment link on stripe dashboard > payemnts section and I'm using that link on My website for user to make the payment
I have used the option on stripe payment's like to redirect user to my custom thank you page after payment.
which works fine but I was expecting to receieve some kind of POST data in response so that i know that customer has successfully paid or not

vague parrot
#

Is this POST a request you coded in to your webpage or are you listening for this event via a webhook?

bright mason
#

nope, I didn't code anything
I just created a Link on stripe dashboard
So i think it's not possible to get response if i use the stripe payment link create from dashboard?

#

what i want to achieve is redirect user to stripe created link and make the payment there and then return to me with response aginst that payment

vague parrot
#

Did you specify a redirect URL to go to when the payment is complete?

bright mason
#

yes

#

i have given my website url here

vague parrot
#

That can tell your system overall if the payment has been made so you can fulfill your user's order. And your question here is about displaying this information on the redirect page after the user has paid?

bright mason
#

yes exactly, I want to get all the information of the user who comes back to my site after payment

vague parrot
#

Essentially, you will include {CHECKOUT_SESSION_ID} in you success URL like so:

#

Then, when the user is redirected, that will become the ID of the Checkout Session that the link created, and you can use that to look up information on the payment

bright mason
#

so do you mean with every payment I'll have to update the url with session ID on stripe dashboard?

vague parrot
#

Yes, for the payment links that variable needs to be there for the ID to be passed on

bright mason
#

how am i suppose to achieve this programatically? Is it possible?

vague parrot
bright mason
#

ummm, what i have concurrent requests of payment the latest url will get listen only, wont it?

vague parrot
#

Not sure I understand your question. Are you asking about the payments already made with those links?

bright mason
#

sorry, never mind
I am trying to wrap my head around it, what I mean is when we update the payment link, how is it going to get connected with the custom thankyou page link we have put there?

Because in my mind as you said we'll have to update the custom thank you page with the session ID everytime we expect a user to pay.

So in this context i though i'll have to update the payment thankyou page with new session everytime

But if we are updating the payment link (not the confirmation link) with the request you showed above how will the thankyou page work for it?

#

hope i make sense now

vague parrot
#

You will only need to update the link once. The {CHECKOUT_SESSION_ID} is a variable that tells Stripe to put the checkout session ID there

#

Stripe will replace that string with the actual ID before redirecting your users

bright mason
#

Now I understand,
just repeating it so that I confirm I got it right.
So when we put {CHECKOUT_SESSION_ID} stripe will automatically inject the SESSION_ID and redirect to the custom page which we have given , say localhost/thankyou/123124213
and based on that 123124213 I can retrieve the payment information?
Sorry I lost why do we need to update payment link then

vague parrot
#

The link config needs to be updated because now it sounds like you do not have {CHECKOUT_SESSION_ID} in the URL at all

#

We won't add the Session ID automatically unless {CHECKOUT_SESSION_ID} is part of the URL

bright mason
#

okay so that update payment link was suppose to update confirmation link not the stripe payment link where user will enter the info for the payment

dusky sorrel
#

Hey there ๐Ÿ‘‹ @vague parrot needs to step away so I'm hopping in. Just getting caught up on the thread real quick.

bright mason
#

hi toby

#

so this is the last thing which i am trying to understand, then i think i'll get my flow straight forward @vague parrot was very helpful

dusky sorrel
#

Glad to hear they were helpful!

#

Bear with me while I do a quick recap just to make sure I'm understanding where things are:
You're leveraging payment links
After the customer completes the checkout you want to direct them to your page
On that page you want to be able to retrieve the customer's info so you're trying to pass {CHECKOUT_SESSION_ID} to that page
And right now, it's just adding that tag to the confirmation page URL that needs to be completed?

bright mason
#

yea not just that, as the CHECKOUT_SESSION_ID will be unique, Pompey gave me the link about updating the payment link everytime we want a new user to pay, at the same time he said that {CHECKOUT_SESSION_ID} wont be added by stripe automatically so i want to understand how can i do that by program that's where I don't understand the flow

dusky sorrel
#

Ah, I think there is a bit of confusion, but please bear with me a moment while I double check one thing and then I'll try to clear that confusion up.

bright mason
#

what i want to achieve is redirect user to stripe created link and make the payment there and then return to me with response aginst that payment

dusky sorrel
#

Alright, just did my testing to confirm.

#

Are you alright with providing me with the URL of the confirmation page that you want to use?

#

(We can use an example URL if you'd prefer, but I'd like to walk through how to customize it to do what you're looking for)

bright mason
#

it's a localhost link at the moment,
http://localhost:8000/accounts/checkout-thanks/

dusky sorrel
#

Gotcha, so we'll use that as our base. Now {CHECKOKUT_SESSION_ID} is a string that we're going to add to that URL. When this flow is actually triggered we'll replace that placeholder/tag string with the actual checkout session ID.

#

Now you have two choices on how to use that, you can either use it as part of your path like this:
http://localhost:8000/accounts/checkout-thanks/{CHECKOKUT_SESSION_ID}

I'm not entirely familiar with the framework you're using, but I assume the above would be tricky since the path would be dynamic, instead I'd pass the ID as a query param like this:
http://localhost:8000/accounts/checkout-thanks/?checkout_session={CHECKOKUT_SESSION_ID}

bright mason
#

I'm using Python3.8 Django3.2

dusky sorrel
#

For example, this is what I used as the confirmation page in my testing:
https://www.example.com/?checkout_session={CHECKOUT_SESSION_ID}

And you can see that when I completed the checkout this is the URL that I was directed to:

#

Your page could then consume that query param and use it to retrieve info about the customer.

bright mason
dusky sorrel
#

It's automatically added. When the customer finishes the checkout, we replace {CHECKOUT_SESSION_ID} with the ID of the checkout session.

Here you can see exactly how I entered the URL for the confirmation page:

#

I think the confusion from before is that we don't automatically add the Checkout Session ID to every confirmation URL, but if you include {CHECKOUT_SESSION_ID}in your URL then that string will be dynamically replaced with the Checkout Session ID.

bright mason
#

so for example,
I gave my payment link to 3 customer and they will see the custom thank you page with unique ID each.
I just need to replace my url with the parameter {CHECKOUT_SESSION_ID}
is that correct?

dusky sorrel
#

Not replace your URL, but add that string to your URL.
Something like this:
http://localhost:8000/accounts/checkout-thanks/?checkout_session={CHECKOKUT_SESSION_ID}

bright mason
#

yes yes, that's it right?

dusky sorrel
#

Yup, give that a try and see how it behaves.

bright mason
#

Alrighty, On i

#

Didin't work ๐Ÿ˜ฆ

#

i got back the URL same as it is

#

http://localhost:8000/accounts/checkout-thanks/?checkout_session={CHECKOKUT_SESSION_ID}

dusky sorrel
#

Looks like there is a typo there (sorry about that, just realized it's wrong in the line I provided)

Revised:
http://localhost:8000/accounts/checkout-thanks/?checkout_session={CHECKOUT_SESSION_ID}

bright mason
#

ah this gave some hope, let me checkout again

#

hurrayy! I got the ID

#

I'm so happy, Thank you so much

dusky sorrel
#

Always happy to help!

bright mason
#

worth spending 5 hours on it ๐Ÿ˜„

#

2 hours on chat ๐Ÿ˜„

dusky sorrel
#

Thank you so much for your patience while we walked through that.

bright mason
#

You are always welcome, I wish I can get a job in Stripe I love this community