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

implementation of razorpay in client side is missing the file useCheckout' and An error occurred in updatePayment:\r\n`order_id` is mandatory' #13

Closed suganyasai1026 closed 4 months ago

suganyasai1026 commented 6 months ago

my plugin on server side
const plugins = [ { resolve: medusa-payment-razorpay, options: { key_id:RAZORPAY_ID?? "", key_secret: process.env.RAZORPAY_SECRET ?? "", razorpay_account: process.env.RAZORPAY_ACCOUNT ?? "",
automatic_expiry_period: 30, // /any value between 12minuts and 30 days expressed in minutes/ manual_expiry_period: 20, refund_speed: "normal", // webhook_secret: process.env.RAZORPAY_SECRET, } }, implementation document : https://medusajs.com/plugins/medusa-payment-razorpay/ and also implementation of razorpay in client side is missing the file useCheckout (` import { useCheckout } from "@lib/context/checkout-context")

theStonedSage commented 6 months ago

@suganyasai1026 I am also facing the same issue

any idea why its happening ?

@SGFGOV can you help resolve this

SGFGOV commented 6 months ago

The documentation is out dated.. The old nextjs starter used the hook use checkout.. the new one doesn't. The fix look simple..but I haven't had the time to test nor update docs

suganyasai1026 commented 5 months ago

could you explain the fix @SGFGOV

SGFGOV commented 5 months ago

Just do what is done in the case of stripe

rdr6000 commented 4 months ago

I got the button to start working but now this error is occurring: data: { code: '', type: 'invalid_data', message: 'An error occurred in updatePayment:\norder_idis mandatory' }

If I disable razorpay and only do manual everything is working. Else the screen goes white when I click on razorpay

rdr6000 commented 4 months ago

image

400 error is returned and the page turns white like this when I click on the Razorpay option

From this:

image

After clicking on the Razorpay button, to this:

image

SGFGOV commented 4 months ago

Will release a new version shortly Best Regards Govind

On Wed, 3 Apr 2024 at 05:21, rdr6000 @.***> wrote:

image.png (view on web) https://github.com/SGFGOV/medusa-payment-razorpay/assets/40518544/7754825e-3763-4dcd-a5d3-f2a352d2b464

— Reply to this email directly, view it on GitHub https://github.com/SGFGOV/medusa-payment-razorpay/issues/13#issuecomment-2033294191, or unsubscribe https://github.com/notifications/unsubscribe-auth/AXEQJHG4MVBHDTOBJPDOFLTY3NAANAVCNFSM6AAAAABDZ5NUO6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAMZTGI4TIMJZGE . You are receiving this because you were mentioned.Message ID: @.***>

--

This message (including any attachments) may contain confidential, proprietary, privileged and/or private information. The information is intended to be for the use of the individual or entity designated above. If you are not the intended recipient of this message, please notify the sender immediately, and delete the message and any attachments. Any disclosure, reproduction, distribution or other use of this message or any attachments by an individual or entity other than the intended recipient is prohibited.   

SGFGOV commented 4 months ago

Try the latest version. 7.0.6. It fixes these issues

kokill commented 4 months ago

Hi @SGFGOV thanks for the update. Payment seems to be working, but now authorizePayment is failing. i tried to log and found that paymentSessionData is empty while calling authorizePayment. The order_id returned from razorpay.orders.create is not stored in paymentSession -> data. Do we need to manually call updatePaymentSession from FE ?

Here is the log

error:   `order_id` is mandatory
Error: `order_id` is mandatory
     at Object.fetch (web/node_modules/razorpay/dist/resources/orders.js:55:15)
    at RazorpayProviderService.<anonymous> (web/node_modules/medusa-payment-razorpay/dist/core/razorpay-base.js:141:68)
    at step (web/node_modules/medusa-payment-razorpay/dist/core/razorpay-base.js:59:23)
    at Object.next (web/node_modules/medusa-payment-razorpay/dist/core/razorpay-base.js:40:53)
    at web/node_modules/medusa-payment-razorpay/dist/core/razorpay-base.js:34:71
    at new Promise (<anonymous>)
    at __awaiter (web/node_modules/medusa-payment-razorpay/dist/core/razorpay-base.js:30:12)
    at RazorpayBase.getPaymentStatus (web/node_modules/medusa-payment-razorpay/dist/core/razorpay-base.js:135:16)
    at RazorpayProviderService.<anonymous> (web/node_modules/medusa-payment-razorpay/dist/core/razorpay-base.js:389:55)
    at step (web/node_modules/medusa-payment-razorpay/dist/core/razorpay-base.js:59:23)
    at Object.next (web/node_modules/medusa-payment-razorpay/dist/core/razorpay-base.js:40:53)
    at web/node_modules/medusa-payment-razorpay/dist/core/razorpay-base.js:34:71
    at new Promise (<anonymous>)
    at __awaiter (web/node_modules/medusa-payment-razorpay/dist/core/razorpay-base.js:30:12)
    at RazorpayBase.authorizePayment (web/node_modules/medusa-payment-razorpay/dist/core/razorpay-base.js:385:16)
    at PaymentProviderService.<anonymous> (web/node_modules/@medusajs/medusa/dist/services/payment-provider.js:585:71)
    at step (web/node_modules/@medusajs/medusa/dist/services/payment-provider.js:48:23)
    at Object.next (web/node_modules/@medusajs/medusa/dist/services/payment-provider.js:29:53)
    at fulfilled (web/node_modules/@medusajs/medusa/dist/services/payment-provider.js:20:58)
rdr6000 commented 4 months ago

Try the latest version. 7.0.6. It fixes these issues

The issue still occurs in the latest version too. message: 'An error occurred in updatePayment:\norder_idis mandatory'

suganyasai1026 commented 4 months ago

try medusa-payment-razorpay: "7.0.8"

rdr6000 commented 4 months ago

I tried in medusa-payment-razorpay: "7.0.9". As soon as I click on Razorpay in Paymenets section, the screen goes blank and I get this 400 error.

image

suganyasai1026 commented 4 months ago

make sure you are paying with registered user @rdr6000

rdr6000 commented 4 months ago

make sure you are paying with registered user @rdr6000

THANK YOU!!. That was the problem. Thanks a lot and thanks @SGFGOV for this awesome plugin

KailashVenthan commented 4 months ago

Hi guys I have done the config steps but the payment button wont show up

Screenshot 2024-04-05 at 6 03 13 PM

please help