Skip to content

Commit

Permalink
#106 backend
Browse files Browse the repository at this point in the history
  • Loading branch information
fdhhhdjd committed Nov 5, 2022
1 parent a205997 commit 19a5f7c
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion backend/src/v1/user_api/controllers/payment.controllers.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ const paymentCtrl = {
paymentStripeSuccess: async (req, res) => {
try {
let payment_id = req.params.id;
let user_id = req.params.user_id;
let user_id = req.user.id || req.user.user_id;

const { status, success, element } = await handlePaymentStripeSuccess({
payment_id,
Expand Down
4 changes: 2 additions & 2 deletions backend/src/v1/user_api/routes/payment.routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ router.post("/payment/paypal", VerifyAcceptToken, paymentCtrl.paymentPaypal);
router.post("/payment/stripe", VerifyAcceptToken, paymentCtrl.paymentStripe);

//* Payment Success
router.get("/payment/stripe/success/:id/:user_id", paymentCtrl.paymentStripeSuccess);
router.get("/payment/stripe/success/:id", VerifyAcceptToken, paymentCtrl.paymentStripeSuccess);

//* Payment Cancel
router.get("/payment/cancel", paymentCtrl.paymentStripeCancel);
router.get("/payment/cancel", VerifyAcceptToken, paymentCtrl.paymentStripeCancel);



Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -229,10 +229,10 @@ module.exports = {
};
}),

success_url: `${req.protocol}://${req.get("host")}/api/payment/stripe/success/{CHECKOUT_SESSION_ID}/${UserId._id}`,
cancel_url: `${req.protocol}://${req.get("host")}/api/payment/cancel`,
// success_url: `http:localhost:3000/api/payment/stripe/success/{CHECKOUT_SESSION_ID}/${UserId._id}`,
// cancel_url: `http:localhost:3000/api/payment/cancel`,
// success_url: `${req.protocol}://${req.get("host")}/api/payment/stripe/success/{CHECKOUT_SESSION_ID}/${UserId._id}`,
// cancel_url: `${req.protocol}://${req.get("host")}/api/payment/cancel`,
success_url: `http:localhost:3000/payment/stripe/success/{CHECKOUT_SESSION_ID}`,
cancel_url: `http:localhost:3000/payment/cancel`,
};
// Create Checkout Sessions from body params.
const session = await stripe.checkout.sessions.create(params);
Expand Down

0 comments on commit 19a5f7c

Please sign in to comment.