#general_iroh
1 messages · Page 1 of 1 (latest)
Hi there, what do you mean by it doesn't work? do you have any error message?
In the front end I find this Access to XMLHttpRequest at 'https://stage-back.test.io/payment' from origin 'https://stage-front..io' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
but in the backend there is no try catch error I could have found.
but it is coming from somewhere ->
ERROR (node:8) Warning: Accessing non-existent property 'use' of module exports inside circular dependency
It doesn't look like a problem related to Stripe directly. You server disallow a CORS request coming from your frontend.
You need to configure your express cors middleware properly so that your frontend can talk to your server.
Also you need to fix the circular dependency issue.
this is the problem actually. My frontend is interacting fine. I can sign up, login and see other data as well. Onty time this error occurs when I try to hit the /payment api. And I have logged it. Only until the action flow hits the stripe create payment function it works fine.
``` await SuperAppApi.post(/payment,payment_item,config).then((res)=>{
responseData = res.data
console.log(res)
}).catch((err)=>{ console.log(err," error")})```
front end
So, it seems like something is wrong with the stripe implementation @cunning drift
Is the PaymentIntent created successfully?
nope. It console logs everything just before the payment function.
Ok, so it means the PaymentIntent request is not sent to Stripe yet.
I think so. But why don't I fined any try catch error? I am not sure.
Also this all works in local.
my front end url is stage-front.test.io
backend is stage-back.test.io
front end is kept in aws cloud front.
Backed runs from lambda function
Is there a public URL that I can visit to reproduce the issue?
no I am afraid so.
but is there any thing so mandatory implementing strip that I have missed.
btw I am using test stripe here. not the production stripe.
Since your application haven't hit the Stripe API endpoint for PaymentIntent creation, I don't see any thing related to stripe yet.
I tried to create stripe customer. Same issue. It just stops at the point it reaches any stripe function.
Based on the CORS error that you shared earlier, your client request is declined by your server and thus your server is not sending any requests to Stripe. I'd suggest you to fix this CORS error first.
I would have fixed it if it occurred for other request as well. But it only occurs for /payment request. and if I comment the stripe payment function it works.
That's indeed strange, is it to do with the authentication.authenticateToken,paymentRoute that you passed to the /payment route?
Does it work if you remove it?
no. I meant if I comment out stripe paymenet function it works. authentication.authenticateToken - this verifies cookie
I am not sure but is there any issue of stripe being integrated with aws?
Do I need to add my backend url in stripe dashboard somewhere?
No, it's not necessary, and again you should really check the CORS error first.
@cunning drift . Here it is 2.25 pm. So in the log you can see the api was hit.
Hi! Can you share the request ID (req_xxx)? Here's how you can find it: https://support.stripe.com/questions/finding-the-id-for-an-api-request
Find help and support for Stripe. Our support center provides answers on all types of situations, including account information, charges and refunds, and subscriptions information. Get your questions answered and find international support for Stripe.
req_HFS7CCbtuGorFF
but in the payment tab I can't see the latest.
https://dashboard.stripe.com/test/logs/req_HFS7CCbtuGorFF you can check the Source of this request, which says Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.4844.51 Safari/537.36
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
It means this request was sent from the frontend (i.e., through CardElement). However, it's not from your backend.
Usually this is how your application create a PaymentIntent, your frontend sends request to your backend, and your backend sends a PaymentIntent creation request to Stripe
Your frontend -> Your backend -> Stripe
oh, but when I am commenting out the payment method from backed, no cors errors is occurring. How am i supposed to fix this I have no idea
Because of the CORS issue, your backend is rejecting request from your frontend, and that's why no PaymentIntent requests are sent to Stripe.
Your frontend x Your backend -> Stripe
This is beyond what I can support I'm afraid. I'll recommend you to consult the official cors document https://expressjs.com/en/resources/middleware/cors.html and configure your application accodingly.
const allowedOrigins = ['https://test.eidverse.io', 'https://checkout.stripe.com'];
const origin = req.headers.origin;
if (allowedOrigins.includes(origin)) {
res.setHeader('Access-Control-Allow-Origin', origin);
}```
okay understood