using Stripe.js in an isomorphic node/react app

538 views
Skip to first unread message

Rob Koberg

unread,
Sep 14, 2016, 8:52:04 AM9/14/16
to Stripe API Discussion
What is the best way to handle Stripe.js in a web app that renders on the server and the client (browser)? The react UI uses the same code to render on the server and the client. Can you call API endpoints directly that can simulate what Stripe.js does? If I use Stripe.js as is, I will need to have tests to check if it is running in the browser wherever I make a Stripe.js call.

How are you importing it into your app if you are using webpack. 

There is more information at this issue: https://github.com/stripe/stripe-node/issues/265

(Initially I was confused by the node-stripe npm module and the Stripe.js library. I thought the module was Stripe.js and Stripe.js was the node api.)

Remi J.

unread,
Sep 14, 2016, 8:56:49 AM9/14/16
to api-d...@lists.stripe.com
Hey Rob,

Alex provided a detailed answer to your question directly in the issue you opened on our repository for our Node library [1] so I think you already have the information you need!

For anyone reading this or ending up on this question in the future though, the idea is that Stripe.js is a client-side library that is expected to run in the browser. It wouldn't make sense to use it server-side. Similarly, there's no way to use our Node.js library client-side as it's designed to be used with your Secret API key that you never want to have available client-side.

For PCI compliance, you should always load Stripe.js directly from our servers and it's not something you can package or store on your own servers.

Let me know if you have any other questions!
Cheers,
Remi


--
You received this message because you are subscribed to the Google Groups "Stripe API Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to api-discuss+unsubscribe@lists.stripe.com.
To post to this group, send email to api-d...@lists.stripe.com.
Visit this group at https://groups.google.com/a/lists.stripe.com/group/api-discuss/.

Rob Koberg

unread,
Sep 14, 2016, 9:25:46 AM9/14/16
to api-d...@lists.stripe.com
Yes, and sorry for the confusion. Thanks for developers fast responses
on github -- very helpful.
>> email to api-discuss...@lists.stripe.com.
>> To post to this group, send email to api-d...@lists.stripe.com.
>> Visit this group at
>> https://groups.google.com/a/lists.stripe.com/group/api-discuss/.
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Stripe API Discussion" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to api-discuss...@lists.stripe.com.
Reply all
Reply to author
Forward
0 new messages