-
Notifications
You must be signed in to change notification settings - Fork 69
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
Payment Stripe Error #34
Comments
If the order creation mentioned at
I experienced exactly the same problem that seems to be associated with the version of the Stripe API because triggering the event
And looking at the Release Notes of the most recent Stripe API version, I noticed that:
This seems to indicate that the API version being used by the webhook needs to be downgraded to the previous version where this functionality might resume working. |
Updating the dependencies The resulting code: async function createOrder({ sessionId }) {
const {
customer_details,
line_items,
...session
} = await stripe.checkout.sessions.retrieve(sessionId, {
expand: ['line_items.data.price.product', 'customer_details']
})
return await hygraphMutationClient.request(createOrderMutation, {
order: {
email: customer_details.email,
total: session.amount_total,
stripeCheckoutId: session.id,
orderItems: {
create: line_items.data.map((item) => ({
quantity: item.quantity,
total: item.amount_total,
product: {
connect: {
id: item.price.product.metadata.productId
}
}
}))
}
}
})
} Although the order creation in Hygraph database was fixed, the request from the line
hygraph-commerce-starter/pages/success.js Line 13 in 04d8013
If the same request is done directly within Hygraph playground, the graphql request succeeds though. |
I found out that this problem was being triggered because I was using a Hypergraph Permanent Auth Token without authorization to read from the API. After setting up the environment variable the correct public |
Once, I set the payment, it shows this error:
Error: not allowed: {"response":{"errors":[{"message":"not allowed","extensions":{"code":"403","path":["orders"]}}],"data":{"orders":[]},"status":200},"request":{"query":"\n query OrderSessionIdQuery($id: String!) {\n orders(first: 1, stage: DRAFT, where: { stripeCheckoutId: $id }) {\n id\n orderItems {\n id\n product {\n images {\n id\n height\n url\n width\n }\n name\n }\n quantity\n total\n }\n total\n }\n }\n","variables":{"id":"cs_test_a1YNicvic2rA6IXuYzYBcSqcdZDT54w5XErQUolix5LSuLDeOrkO09FFq9"}}}
I am thinking because I didn't setup the Stripe Webhook. I don't know how to do that.
The text was updated successfully, but these errors were encountered: