SGFGOV / medusa-payment-razorpay

A basic implementation for medusajs payment with razorpay
https://github.com/SGFGOV/medusa-payment-razorpay
13 stars 17 forks source link

Unable to switch from Razorpay to Stripe #2

Closed Hemann55 closed 1 year ago

Hemann55 commented 1 year ago

I using Stripe and Razorpay but not able to switch from Razorpay to Stripe at checkout using setPaymentSession as described here - https://docs.medusajs.com/api/store#tag/Cart/operation/PostCartsCartPaymentSession

Setting cart.payment_session from Stripe to Razorpay works fine but Razorpay to Stripe throws the following error -

terminal devtools

Any idea what's causing this issue?

SGFGOV commented 1 year ago

Hi

Thanks for reporting this..will investigate and get back.

Best regards Govind

SGFGOV commented 1 year ago

would you mind testing medusa-payment-razorpay@3.0.2-alpha-2.

Hemann55 commented 1 year ago

Hi

Thanks for the reply and the plugin :)

Same error occurs in medusa-payment-razorpay@3.0.2-alpha-2 when changing payment session from Razorpay to any other provider at checkout. The other provider is not set when POST to /cart/{id}/payment-session

Are you able to reproduce this issue?

SGFGOV commented 1 year ago

Hi,

The reason the delete fails is because, razorpay doesn't support cancellations. Thus I didn't really bother about it :).. my bad. for some reason the "3.0.2-alpha-2" didn't have the fix.. I suspect a build issue. If its not too much trouble can you try "3.0.2-alpha-5" and share a screen shot if it fails. Alternatively you can submit a PR and I'll be happy to merge it in

Hemann55 commented 1 year ago

Since Razorpay does not support cancelling/deleting orders or payments, I kept the deletePayment function in services directory empty. This resolves the above error.

async deletePayment(payment) {
//empty
}