Created on 6th October 2022
•
Stripe Payment: Provides APIs to integrate with the stripe API to checkout a product on an e-commerce page (imagine the APIs are being called from a frontend)
Stripe Webhooks: Accepts webhooks from Stripe and stashes metadata in a embedded postgres db
A way for the package to be updated on the fly, any CI/CD steps that you require Dockerfiles / Github Actions / CircleCI scripts
Problem it solves is , if there is an ecommerce product and you customer wants to buy it, so you can integrate the API provided and it will set the rest of payment process for you.
Challenges : 1. Creation of stripe payment intent
2. When payment succeeded get the webhook event data back and put it in postgres db asynchronously
Solution : I studied the stripe api documentation very thoroughly after that, Writing the code for creation of payment intent was tough but I looked into other resources and medium documentation. After that I started developing REST endpoints and functions which will help me to create stripe payment intent. Payment intent is a type of whole lifecycle of the payment from begin to end. This is very necessary for the payment to succeed. Then after that I wrote the java code line by line understanding it and testing it live on the go. It worked after lots of debugging and testing.
Solution : To webhook event data, now webhook are asynchronous events which are sent by stripe server to the frontend server on a post request made to listen if there is any updates on the payments done, whether it is successfull, failed or processing at the moment. So here I need to update whatever the data of webhook comes into postgres db.
It was not easy to do this as this should only be done if the payment succeeds . So I need to create a webhook event and listener for that purpose and a REST endpoint where it would listent these events.
After developing REST endpoint, I was not able to understand how to put data into postgres, Then I setup the postgres with my project, but still how to put data. Then i learnt about flyway migration from some resource i use that to create table on the go whenever the data comes and then to put data I used jdbcTemplate autowired and used sql.update() command with the refrence of this jdbcTemplate. I was able to do it.