#Jun Takeshita
1 messages · Page 1 of 1 (latest)
Hi there, there's no customer param for after_completion.
Can you tell me what you want to achieve here? so that I can advise the best possible solution.
I tried to create the following payment flow using Stripe links api,
- A customer come to my site
- My backend service create the customer data and hash data
- And create link using api and set the hash to after_completion with redirect url
- the site shows payment link and enter payment data
- the customer payment completed and customer browser access my site as the redirect url
- Then my backend site update the customer data
But the above way, I can't stop the customer payment when the customer selected not one time payment and quit our service
Actually, I think the flow is not matched normal payment links usage.....
So let me know your payment flow for the above my case
I would like to no management for any customer payment data example card number, email, and their address
But the above way, I can't stop the customer payment when the customer selected not one time payment and quit our service -> I don't quite understand this sentence, can you share with me an example so that I can better understand?
well, I would like to control my customer data other than payment detail
Actually I want to know price, product name, and one time or not
it
It's enught the above items
Sorry I don't really understand you. Can you tell me an use case which you want to stop your customer from payment?
Sorry, my mentioned puzzled you
I would like to know payment links normal usage fast
Actually, I create payment link each customer payment... if followed my flow
The payment link is designed to be reused among your customers, you should just create one and let all your customers use it.
I believe Checkout Session is more suitable if you intend to create dedicated one for each of your customer
I see I thought it
Let me think...
Do you have any example to use Checkout sessions for my payment flow?
To be honest I still have difficulty understand your requirement, but you can check out this page https://stripe.com/docs/payments/checkout/how-checkout-works to learn about stripe checkout
Payment Link and Checkout session are two different products and I don't see how you can use a payment link in checkout session
I understood cancel.html and success.html in sample source code are redirect urls
Is it correct?
And can I use price id in payment link product also
Hey! Taking over for my colleague. Let me catch up.
You are referring to what sample code, could you share a link please ?
def get_checkout_session_link(self, id: int, pricetype: int): price = self.__set_price_id(pricetype) obj = stripe.checkout.Session.create( line_items=[{"price": price, "quantity": 1}], mode='payment', success_url=f"{{completed_url}}success.html", cancel_url="{{completed_url}}cancel.html", ) return obj.session.url
Yes, you can set the price Id in line_items.price attribute, when you create the Payment Link
https://stripe.com/docs/api/payment_links/payment_links/create#create_payment_link-line_items-price
but happend the following error for this test code
stripe.error.InvalidRequestError: Request req_Vg6ZEBMvzta4tr: Not a valid URL
Yes indeed, the success_url and the cancel_url are redirect urls:
https://stripe.com/docs/api/checkout/sessions/create#create_checkout_session-cancel_url
https://stripe.com/docs/api/checkout/sessions/create#create_checkout_session-success_url
I think there is a typo here success_url=f"{{completed_url}}success.html", probably you should remove the "f"
Can I append url parameters to each recirect url?
oops, thanks
I got payment site, thanks
by the way, how can I to confirm the customer data?
hello?
well, test code was success
but redirect url doesn't have any parameters...
I just understand my data, not stripe cutomer hash? (customer id)
You can customize you success checkout page, by adding the {CHECKOUT_SESSION_ID} template variable to the success_url
then you can fetch the related checkout session with all related data by your integration
https://stripe.com/docs/payments/checkout/custom-success-page
I see
I should save checkout session id for each customer payment control
How to stop customer payment using the checkout session?
I would like you show the sample
You can expire the checkout session then:
https://stripe.com/docs/api/checkout/sessions/expire
I see
I got understand all of usage for my user service flow
thanks