medusa icon indicating copy to clipboard operation
medusa copied to clipboard

Razorpay order_id ,'An error occurred in updatePayment:\r\n`order_id` is mandatory' and also in client side "usecheckout" from checkout-context file is not available in latest medusa

Open suganyasai1026 opened this issue 1 year ago • 16 comments

Bug report

import { useCheckout } from "@lib/context/checkout-context" file not available and data: { code: '', type: 'invalid_data', message: 'An error occurred in updatePayment:\r\norder_id is mandatory' } },

Describe the bug

A clear and concise description of what the bug is.

Code snippets

const plugins = [ { resolve: medusa-payment-razorpay, options: { key_id: process.env.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??"", } },

documentation :https://medusajs.com/plugins/medusa-payment-razorpay/ If applicable, add code samples to help explain your problem

suganyasai1026 avatar Feb 26 '24 13:02 suganyasai1026

Hey @suganyasai1026 I am also trying to integrate razorpay and facing the exact same issue

were you able to solve this ?

theStonedSage avatar Feb 29 '24 18:02 theStonedSage

no

suganyasai1026 avatar Mar 07 '24 08:03 suganyasai1026

There are two issues with respect to plugin -

  1. order_id needs to be added in file medusa-core/packages/medusa/src/interfaces/payment-processor.ts which is consumed by plugin medusa-payment-razorpay
  2. order_id needs to be added in plugin medusa-payment-razorpay under file src/core/razorpay-base.ts in methods -
async initiatePayment(
    context: PaymentProcessorContext
  ): Promise<PaymentProcessorError | PaymentProcessorSessionResponse> {
    const intentRequestData = this.getPaymentIntentOptions();
    const {
      email,
      currency_code,
      amount,
      resource_id,
      customer,
      paymentSessionData,
      order_id
    } = context;

and

async updatePayment(
    context: PaymentProcessorContext
  ): Promise<PaymentProcessorError | PaymentProcessorSessionResponse | void> {
    const { amount, customer, paymentSessionData, currency_code, order_id } = context;

sumanchy88 avatar Apr 18 '24 07:04 sumanchy88

@suganyasai1026 or @sumanchy88 did you people find any solution for this as i am facing the same issue

rishabh-zangoh avatar Apr 25 '24 17:04 rishabh-zangoh

Hey! Guys I am facing the same issue, any solutions ?

whiletrueee avatar May 08 '24 08:05 whiletrueee

Any solution I still looking ?

manishkumar212111 avatar May 14 '24 17:05 manishkumar212111

@suganyasai1026 @whiletrueee @theStonedSage @sumanchy88 @rishabh-zangoh @manishkumar212111

can you help me with this error. I have completed entire steps but I the payment button is disabled updated 3 files (constants.tsx, payment-button/index.tsx, payment-button/razorpay-payment-button.tsx and env.local with keyidas rzp_test_... storename and discription image image

youreachedrahat avatar Jul 09 '24 10:07 youreachedrahat

@youreachedrahat Please use this https://www.npmjs.com/package/medusa-payment-razorpay-poorvika

manishkumar212111 avatar Jul 09 '24 11:07 manishkumar212111

I ran this command npm i medusa-payment-razorpay-poorvika to install but still getting this issue no

⠋ Initializing plugin models
error:   Error starting server
Error: Unable to find plugin "medusa-payment-razorpay". Perhaps you need to install its package?

youreachedrahat avatar Jul 09 '24 14:07 youreachedrahat

Also update plugin name in Medusa-config

On Tue, 9 Jul 2024 at 8:13 PM, Rahat Sayyed @.***> wrote:

I ran this command npm i medusa-payment-razorpay-poorvika to install but still getting this issue no

⠋ Initializing plugin models error: Error starting server Error: Unable to find plugin "medusa-payment-razorpay". Perhaps you need to install its package?

— Reply to this email directly, view it on GitHub https://github.com/medusajs/medusa/issues/6511#issuecomment-2217918168, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFBP56AVE5PELJG7M35CBFTZLPZHPAVCNFSM6AAAAABD2HJDI6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEMJXHEYTQMJWHA . You are receiving this because you were mentioned.Message ID: @.***>

manishkumar212111 avatar Jul 09 '24 14:07 manishkumar212111

Now I have same issue as others

error:   unable to retrieve customer from cart
error:   unable to find razorpay customer
error:   no customer billing found:
no customer billing found null
Error: no customer billing found:
no customer billing found null



{
  type: 'invalid_data',
  code: '',
  date: 2024-07-09T14:47:51.706Z
}

client side

message: 'no customer billing found:\r\nno customer billing found null'

youreachedrahat avatar Jul 09 '24 14:07 youreachedrahat

Create new customer and then try

On Tue, 9 Jul 2024 at 8:21 PM, Rahat Sayyed @.***> wrote:

Now I have same issue as others

error: unable to retrieve customer from cart error: unable to find razorpay customer error: no customer billing found: no customer billing found null Error: no customer billing found: no customer billing found null

{ type: 'invalid_data', code: '', date: 2024-07-09T14:47:51.706Z }

client side

message: 'no customer billing found:\r\nno customer billing found null'

— Reply to this email directly, view it on GitHub https://github.com/medusajs/medusa/issues/6511#issuecomment-2217935925, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFBP56FWAGQQAELRNHP2FVTZLP2HDAVCNFSM6AAAAABD2HJDI6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEMJXHEZTKOJSGU . You are receiving this because you were mentioned.Message ID: @.***>

manishkumar212111 avatar Jul 09 '24 14:07 manishkumar212111

already have user

image

youreachedrahat avatar Jul 09 '24 14:07 youreachedrahat

⠋ Initializing defaults
TypeError: Cannot read properties of undefined (reading 'getRepeatableJobs')

is it related

youreachedrahat avatar Jul 10 '24 02:07 youreachedrahat

@youreachedrahat Do you have any updates? I get the error TypeError: Cannot read properties of undefined (reading 'getRepeatableJobs') Using the plugin from the community medusa-plugin-postmark, maybe if you know a solution to your problem with this error it will help me too Thanks in advance for your answer

MikhailNarkevich avatar Aug 23 '24 15:08 MikhailNarkevich