Skip to content

Using payment intents to make payments#14

Open
mutthias wants to merge 6 commits into
mainfrom
Stripe
Open

Using payment intents to make payments#14
mutthias wants to merge 6 commits into
mainfrom
Stripe

Conversation

@mutthias
Copy link
Copy Markdown

If needed I can of course walk through in a call what I did/how what I did works.

(Assuming this is Austin reviewing) This works from /checkout. I have a super basic credit card info form to make payments since the checkout form already has stuff like address. From last time we created a checkout form on the backend with:

const session = await auth_stripe.checkout_session.create({})

But for this, I swapped it (as well as the params) to:

const session = await auth_stripe.paymentIntents.create

Everything seems to be plug and play. I hardcoded billing info name, email, as well as the amounts for the payment intent, but when it all goes through I console.log everything from the payment intent. The payment intent doesn't directly give me the payment method, but it gives me a payment method ID, which I used to fetch payment methods to get stuff like the last 4 digits of someone's credit card (this is all console.logged).

Copy link
Copy Markdown
Contributor

@Austin2Shih Austin2Shih left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good! There are a few things we can do to clean up the code but I think it'll be best if you start working on integrating your stuff with the GraphQL API to be able to update order status or like createOrders when we get pinged. Both the CreateOrder and UpdateOrder stuff should already be made.

You can start with unhardcoding this stuff first though.

A few things:
- Moved PaymentForm to ShippingInfo.tsx to be able to pass billing info as props
- The billing info form is wrapped as a div instead of a form to prevent nested forms, and also because there's no button connected to it
- A few components have been changed to accept a handful of props for billing info

In summary, the billing info is not hardcoded and uses whatever information is inputted in our form 👍
Just wrote out a mutation for posting billing info to our own database rathe than having to hop on Stripe to manage orders. This is done ONLY after the order successfully goes through Stripe.

Also I made two queries for grabbing all the orders or just one order from our database.

Only thing is that everything isn't tested because I couldn't see if my branch had a way for me to run a server (if that's setup already)

(Austin or Brandon please save me tomorrow in meeting if you see this before)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants