#gecko-question
1 messages ยท Page 1 of 1 (latest)
ok thanks.
I am trying to setup a stripe payment mechanism for use within a Discord environment. My thinking is pretty simple: use a command in discord, which creates a URL, that goes to Stripe hosted checkout page. User does payment, and an event is created, which I need to watch for, so I can take action based on their payment.
most of the sample app code works within a webpage construct. my webpage/front is discord.
so...my thinking is I can create a session from node environment, which builds a URL to stripe hosted payment site....so first question: is there anything wrong with this approach?
hmm interesting workflow
unfortunately I don't have any experience integrating apps with discord so can't really say if this flow would work or not
discord is really just my UI....there's a bot running on node
seems straightforward to me....
Ah okay! the Checkout side of things do make sense.
but what I want to confirm, is that I can generate a checkout session (sample code implies this) in node.
I can have a product, with multiple prices, already created, and then just use a product/price ID in the checkout URL creation, to send to the user
they click on that, and off they go to stripe hosted...yes?
yes! you can definitely create a checkout session in node which would return an object with url that they can visit and make the payment
https://stripe.com/docs/api/checkout/sessions/create?lang=node
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
great. so assuming I get my product(s) and price(s) setup (once), then the checkout session refers to them, and also sends some customer-specific info to the URL, so that I can receive it in the response once payment occurs. ( I need a user id/server info type thing to flow along)
the sample code refers to generating web pages for success and failure cases in payments...all in the context of a localhost'ed web server. I assume actually, that within a Stripe hosted checkout, a "success" or "fail" page is included as part of the hosting, is it not?
I assume actually, that within a Stripe hosted checkout, a "success" or "fail" page is included as part of the hosting, is it not?
You'd have to build these pages. I'm almost very sure we don't have a success or failure page that can be used in this case.
so what happens in the stripe hosted environment, when a payment completes, and no successURL is given?
Typically, it'd be a 404 or an error that page wasn't found.
ok so I must have a success/fail redirects as part of the session creation.
how do I pass custom values into this URL, which stripe will pass back? Do I simply build them as things like "..?user=suzie&server=123456"? or is there anything I need to pass as optinoal info to the checkout session itself?
You pass in the success and cancel URLs as strings at the time of session creation:
https://stripe.com/docs/payments/accept-a-payment?platform=web&ui=checkout#redirect-customers
You can use any method of string interpolation you want to build the URLs
ok, so any info I need to flow through, need to be included in the sucess/fail URLs...and the rest of the payment details I can get from Stripe APIs?
The checkout process fires several webhook events relating to the processing of the payments. They are a useful way of capturing details for follow up actions by your app.
https://stripe.com/docs/payments/handling-payment-events
I am trying to keep things simple, if I can....I want to know when payment succeeds. Do I really have to monitor the multiple stages of payment processing events?
You can pick a single event to monitor. charge.succeeded would be a good place to start. But because authorizations from card issuers are asynchronous we cannot easily return whether the payment was successful in a synchronous call.