Hasimbola
Add stripe for payment in Phoenix site
Hello everyone, I would like to add stripe in my project to make payments,
Could someone help me please?
Thanks! ![]()
Most Liked
arrowsmith
Hi Hasimbola,
It’s hard to give advice without knowing more about what specifically you’re trying to do. Do you need people to make one-off payments, or subscriptions? Is there a range of products they can choose from? What happens after they pay - does it create a user account? Grant access to a specific part of the site? Send them an email with the product attached?
The simplest approach is to use a Stripe-hosted checkout page: Accept a payment | Stripe Documentation
The flow would work roughly like this:
- Users visit a path on your site e.g.
/checkout. - On the backend you generate a Checkout object using the
stripity_stripepackage, which contains a URL. You redirect them to this URL. - They’ll see a Stripe-hosted page where they can enter their payment information etc.
- On successful payment, they’ll be redirected back to a URL on your site e.g.
/checkout_completewhich will have asession_idparam. - You use this
session_idparam to pull information from Stripe about the checkout session and what they purchased - you can use this this to update your site accordingly e.g. grant them access to the product.
Remember that anyone can type /checkout_complete into their address bar so you can’t trust this URL blindly. You need to pull information from Stripe using your API keys to verify that people have actually paid.
You probably also want to set up a webhook endpoint so that Stripe can send you information about all activity on your account e.g. subscription cancellations and renewals. Again, you need to verify this endpoint so you can be sure that the requests are actually coming from Stripe and not from an attacker - Stripe’s docs have information about how to do this.
Other than that I can’t really give any more advice without knowing more about the details of what you want to do, but I hope that helps.
EDIT: wait, I only just noticed that this thread is from 2022. Oh well, I hope someone still finds the above helpful.
crova
I recently integrated Stripe on an application I’m working on and Stripity Stripe was pretty straightforward to use and had all we needed.
Even if you’re using Stripe checkout (which I also recommend) you can easily create the session with Stripity Stripe.
To OP: your question is to vague. What exactly you need help with on the integration?
karlosmid
Hi! The first thing to check is not related to Elixir. Is Stripe available in your country?
Popular in Questions
Other popular topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #advent-of-code
- #elixirconf-us
- #distillery
- #processes
- #forms
- #api
- #metaprogramming
- #security
- #performance










