-
-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TypeError: Cannot read properties of undefined (reading 'event') #28
Comments
@SGFGOV - Can you help me here? |
Plz send your full log
…On Sun, 13 Oct, 2024, 9:37 am Balram yadav, ***@***.***> wrote:
@SGFGOV <https://github.com/SGFGOV> - Can you help me here?
—
Reply to this email directly, view it on GitHub
<#28 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AXEQJHGDUNG7LZDQN6AUNTLZ3HWWPAVCNFSM6AAAAABP25X3G6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDIMBYHAYTCOJYHA>
.
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.
|
Now i am getting the webhook logged but my payment status is still awaiting in the medusa dashboard but the payment is actually captured. info: Received Razorpay webhook body as object : {"entity":"event","account_id":"acc_P8De6sNJ1BGm7N","event":"payment.captured","contains":["payment"],"payload":{"payment":{"entity":{"id":"pay_P8Z9Xt31NCgYIA","entity":"payment","amount":155000,"currency":"INR","status":"captured","order_id":"order_P8Z8xDZqyZEIqJ","invoice_id":null,"international":false,"method":"wallet","amount_refunded":0,"refund_status":null,"captured":true,"description":"Order number order_P8Z8xDZqyZEIqJ","card_id":null,"bank":null,"wallet":"airtelmoney","vpa":null,"email”:”[email protected]","contact":"+912822193549","notes":{"resource_id":"cart_01J9N0WY3BQMBVDRADSYAGZ8TP"},"fee":3658,"tax":558,"error_code":null,"error_description":null,"error_source":null,"error_step":null,"error_reason":null,"acquirer_data":{"transaction_id":null},"created_at":1728832083,"reward":null,"base_amount":155000}}},"created_at":1728832087} |
I am also have some problems implementing it in the frontend. Sometimes i get: Error: Functions cannot be passed directly to Client Components unless you explicitly expose it by marking it with "use server". Or maybe you meant to call this function rather than return it. {transitional: ..., adapter: function, transformRequest: ..., transformResponse: ..., timeout: ..., xsrfCookieName: ..., xsrfHeaderName: ..., maxContentLength: ..., maxBodyLength: ..., validateStatus: ..., headers: ..., baseURL: ..., raxConfig: ..., method: ..., withCredentials: ..., url: ..., json: ..., data: ...} When the order is being placed. And sometimes i also get: TypeError: Cannot read properties of null (reading 'removeChild') Can you help me with that too? |
I am also getting buffer data as log
|
@RohitBansal272 Are you also getting Error: Functions cannot be passed directly to Client Components unless you explicitly expose it by marking it with "use server". Or maybe you meant to call this function rather than return it. When it places the order, in the frontend? My manual payment method works fine, but when i use the razorpay it doesnt work. |
@balramxyadav I am using React Native but i faced the same error using the next.js storefront
|
@SGFGOV I have tried to resolve the issue and solved 50% of it, will try to open a tomorrow The thing I did
I am stuck with something related to event issue where is falls to default switch condition but the above one fixed the issue for few orders. Also I guess the repo is out of sync because in ide I can see I am using 7.3.0-next version but GitHub has 7.3.0 as latest |
Are you using an iPhone? |
I am using Android and haven't tested on iphone but does it matter because I have added webhook url in razorpay dashboard webhook section (not passing in razorpay options during checkout) |
Does auto capture work with it? I can see the payment captured in razorpay but the status is not paid in medusa. |
@balramxyadav webhook is currently broken so it is not showing paid in medusa |
Another problem: When I click on ‘Pay’ on mobile, it redirects me to a Razorpay page from the checkout, and then it sends me to the callback URL. It works fine on desktop as the page only opens in a popup, and the state is retained to place the order. However, on mobile, it redirects directly to the callback URL. One approach could be to create a new endpoint for the callback. Verify if the payment was successful. If yes, create an order and redirect directly to the confirmation page, and in case of failure, redirect to the checkout page. Is this the right approach, or how should this be handled? |
@SGFGOV - Hey, i somehow made it work but it doesn't work it mobile becuase the razorpay redirects to the otp page and the handler func doesnt run on mobile. Can you help me? |
I have not tried using dart. Otherwise if it's the mobile web browser you remove the client side call back url in the ui |
I have not tried using dart. Otherwise if it's the mobile web browser you remove the client side call back url in the ui Please use the latest version |
I am trying something like import { NextResponse } from "next/server"
import { cookies } from "next/headers" // Necessary for cookie handling
// Assuming this is where your completeCart function is
import { revalidateTag } from "next/cache" // Adjust as needed
import { completeCart } from "@lib/data"
import { redirect } from "next/navigation"
import { placeOrder } from "@modules/checkout/actions"
export async function POST() {
try {
// Place order and get the cart
const cart = await placeOrder()
console.log("From API:", cart)
if (cart?.type === "order") {
const countryCode =
cart.data.shipping_address?.country_code?.toLowerCase()
const orderId = cart.data.id
const redirectUrl = `/${countryCode}/order/confirmed/${orderId}`
redirect(redirectUrl)
// return NextResponse.json({ success: true })
}
// If no order was created, return an error
return NextResponse.json(
{ success: false, message: "Order could not be placed" },
{ status: 400 }
)
} catch (error: any) {
// Handle errors and return an appropriate error message
return NextResponse.json({ error: error.message }, { status: 500 })
}
} And putting the api route in the callback. Would a approach like this work? How would you approach it? |
@SGFGOV Any update regarding this issue? |
@SGFGOV - After placing the order, the response I get from the ‘place order’ function is payment_status: 'requires_more', type: 'cart', even though the payment shows as completed in Razorpay. I found this in the documentation:
I believe the issue might be with the authorization process when the order is placed. How can I resolve this? Also, for some reason, I’m getting the error:
How can I fix this? More info: There were some of these logs error: An error occurred in updatePayment Client side: From action: { |
I am getting this same error in the logs. |
Building a new plugin for v2. I think this will be addressed there |
When i try to integrate razorpay webhook with the plugin i get that error:
TypeError: Cannot read properties of undefined (reading 'event')
I also get this with alot of numbers:
info: Received Razorpay webhook body as object : {"type":"Buffer","data":
How can i make it work?
The text was updated successfully, but these errors were encountered: