#need help in integrating razorpay in medusa v2

14 messages · Page 1 of 1 (latest)

dawn thunder
#

need help in integrating razorpay in medusa v2

dawn thunder
#

i am firstime integrating payment gateway , i am following this https://github.com/sgftech/payment-razorpay
i am getting this error after clicking on continue payment

http: GET /admin/regions/ ← http://localhost:9000/app/analytics (304) - 20.778 ms
http: POST /store/payment-collections ← - (200) - 29.515 ms
error: Invalid request: Unrecognized fields: 'context'
MedusaError: Invalid request: Unrecognized fields: 'context'
at zodValidator (D:\web development\medusa2\my-medusa-store\node_modules@medusajs\framework\src\zod\zod-helpers.ts:126:13)
at processTicksAndRejections (node:internal/process/task_queues:105:5)
at async validateBody (D:\web development\medusa2\my-medusa-store\node_modules@medusajs\framework\src\http\utils\validate-body.ts:30:27) {
__isMedusaError: true,
type: 'invalid_data',
code: undefined,
date: 2025-02-24T05:22:11.311Z
}
http: POST /store/payment-collections/pay_col_01JMV5A397GYVXE01MFY941PCQ/payment-sessions ← - (400) - 25.587 ms

GitHub

Razorpay payment module for medusa. Contribute to SGFTech/payment-razorpay development by creating an account on GitHub.

dawn thunder
#

and if i remove context then from
const handleSubmit = async () => {
setIsLoading(true)
try {
const shouldInputCard =
isStripeFunc(selectedPaymentMethod) && !activeSession
console.log(activeSession)

    if (!activeSession) {
      await initiatePaymentSession(cart, {
        provider_id: selectedPaymentMethod,
        // context:{
        //   extra:cart
        // }
      })
    }

    
    const checkActiveSession =
    activeSession?.provider_id === selectedPaymentMethod
    
    console.log(checkActiveSession)
  if (!checkActiveSession) {
    await initiatePaymentSession(cart, {
      provider_id: selectedPaymentMethod,
    })
  }

  if (!shouldInputCard) {
    return router.push(
      pathname + "?" + createQueryString("step", "review"),
      {
        scroll: false,
      }
    )
  }
} catch (err: any) {
  setError(err.message)
} finally {
  setIsLoading(false)
}

}
i got error as cart not ready

lusty jasper
#

we cannot add localhost url as webhook url it should be deployed url

dawn thunder
#

i have used ngrok to create webhook url

lusty jasper
#

deployed url hosted backend url (https) instead of localhost

dawn thunder
#

so if a deploy this project then the issue will get resolve

lusty jasper
dawn thunder
dawn thunder
ivory valley