#general_iroh

1 messages · Page 1 of 1 (latest)

frank oracleBOT
cunning drift
#

Hi there, what do you mean by it doesn't work? do you have any error message?

unborn pumice
unborn pumice
cunning drift
#

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.

unborn pumice
# cunning drift You need to configure your express cors middleware properly so that your fronten...

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

unborn pumice
cunning drift
#

Is the PaymentIntent created successfully?

unborn pumice
#

nope. It console logs everything just before the payment function.

cunning drift
#

Ok, so it means the PaymentIntent request is not sent to Stripe yet.

unborn pumice
cunning drift
#

Is there a public URL that I can visit to reproduce the issue?

unborn pumice
#

no I am afraid so.

unborn pumice
cunning drift
#

Since your application haven't hit the Stripe API endpoint for PaymentIntent creation, I don't see any thing related to stripe yet.

unborn pumice
cunning drift
#

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.

unborn pumice
cunning drift
#

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?

unborn pumice
unborn pumice
#

Do I need to add my backend url in stripe dashboard somewhere?

cunning drift
#

No, it's not necessary, and again you should really check the CORS error first.

unborn pumice
#

@cunning drift . Here it is 2.25 pm. So in the log you can see the api was hit.

cunning drift
unborn pumice
#

but in the payment tab I can't see the latest.

cunning drift
#

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
unborn pumice
#

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

cunning drift
#

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
unborn pumice
#
    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);
   }```