Working With Stripe’s SDK

Working With Stripe’s SDK

Stripe is an e-commerce solution for supporting payments in your web applications. Integrating Stripe into your application is almost too easy, and their integrations put a very low barrier upon the integration.

While their integration is easy and fast, you still do have to write some code to tie your system to the information in Stripe.

Pulling information from Stripe is pretty straightforward; they have a simple REST API. But in my example, we will use their NodeJS SDK to pull data.

The first thing we need to do is install the Stripe npm module.

npm install stripe

Once we get that installed, we need to create an instance of the Stripe SDK. This follows common node conventions. Note that the secret key can be found within the Stripe admin console.

We can start making API calls now that we have our Stripe SDK. In this case, we are going to retrieve all events using pagination. With pagination, we will continue to pull events until we have pulled them all. We are also pulling only events with the type “checkout.session.completed”. This will minimize the number of events we get.

In this blog post, we used Stripe’s NPM module to make these calls. If we wanted, we could make straight REST API calls to achieve the same results.

Integrating with Stripe is easy to get going. For most projects, you will need to dive a little beneath the easy integrations and build tighter ties between Stripe and your system, but luckily their API is easy to work with.

author avatar
Chad Michel Senior Software Architect
Chad is a lifelong Nebraskan. He grew up in rural Nebraska and now lives in Lincoln. Chad and his wife have a son and daughter.

Related posts