❔ Need some help with payment processing and stripe
So... to my understanding, it's quite important to reserve/create the purchase before charging the customer since it's trivial to undo a purchase but not so to refund the customer.
How is this usually done, though? Let's say I have a CreateReservation endpoint (think airbnb)...
Byt this seems like way too much work for one endpoint, but also a public facing payment endpoint with a reservationid passed in doesn't seem that great from a security perspective so the last option seems to me the safest and most logical.
or none of the above and i should approach this differently
Bonus question: Do i separate the endpoints/handlers for the different payment options (klarna, bank transfer, card)?
How is this usually done, though? Let's say I have a CreateReservation endpoint (think airbnb)...
- Do I do all the payment processing inside this endpoint?
I don't like this because teh endpoint is already big, and there are multiple different payment options and methods so there's a lot of code and potentially "different" responses
- Do I create a separate endpoint for PaymentProcessing and make a chain call to a separate PaymentProcessing endpoint in react after CreateReservation is successful and return the reservation Id?.
This seems unsafe, I'm not sure how to guarantee that the id isnt manipulated. Or maybe i should pass a secure token here?
- Do I create a mediatr handler to process payment and call it from witihn the CreateReservation endpoint after creating hte reservation?
Byt this seems like way too much work for one endpoint, but also a public facing payment endpoint with a reservationid passed in doesn't seem that great from a security perspective so the last option seems to me the safest and most logical.
or none of the above and i should approach this differently
Bonus question: Do i separate the endpoints/handlers for the different payment options (klarna, bank transfer, card)?