Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to pass clients ip address while creating a payment intent in stripe.js

I am using google cloud functions to execute the node.js code which creates a payment-intent and passes the client-secret to the client (i.e browser) in this case. However when a payment is completed i am getting ip address of google's server which are most likely hosting the code of google cloud functions.

Device Ip Address in Stripe Dashboard

I need to pass the ip address of the browser somehow so that client who is making the payment's ip address is visible and not the ip address of google's server. I tried looking into stripe's documentation but cannot find any way on how to achieve this. Note: It is recommended to create payment intent on server side and not on client side by stripe.

like image 850
Nurul Sundarani Avatar asked Oct 18 '25 20:10

Nurul Sundarani


1 Answers

The reason you're seeing your server's ip address is likely that you are creating the PaymentMethod server-side. This means your server gets that raw card details which puts you in the highest scope for PCI compliance, SAQ D.

The IP address here should instead come from the browser where you would collect card details securely via Stripe.js client-side. The idea is that you would be using Elements, collect their card details and then create a PaymentMethod (or a Token for legacy integrations) and then use that id server-side to confirm a PaymentIntent or create a Charge.

If you have to pass raw card details server-side, you should talk to Stripe's support team instead to discuss your integration.

like image 59
koopajah Avatar answered Oct 21 '25 10:10

koopajah