DEV Community

Cover image for Stripe developer foundations videos
CJ Avilla for Stripe

Posted on • Edited on

Stripe developer foundations videos

Learn the fundamentals of working with the Stripe API so you can build almost anything on Stripe.

We’ve launched a series of videos that shows you how to get started with the 7 officially supported client libraries. As a developer, these client libraries are the main way you’ll interact with the Stripe API.

You’ll learn about:

  • Authentication
  • Making requests
  • Pagination
  • Metadata
  • Webhook helpers
  • Idempotency & retries
  • Versioning
  • Expanding objects
  • .env and environment variables

Thumbnail image showing advocates Developer Foundations

Check out the individual client library playlists below or read on for an overview of each topic:

stripe-ruby
stripe-python
stripe-php
stripe-node
stripe-go
stripe-java
stripe-dotnet

Authentication

Authentication is how you prove that you have access to a specific Stripe account when making an API call. When building a Stripe integration, you’ll work with several API keys, each with a particular use case. In these videos, you’ll learn about:

  • Authorization HTTP headers
  • Types of Stripe API keys
    • Publishable keys
    • Secret keys
    • Restricted keys
    • Webhook signing secrets
  • Roll leaked API keys
  • Configure an API key globally
  • Configure an API key per-request
  • Authenticate requests for Stripe Connect globally
  • Authenticate requests for Stripe Connect per-request

ruby
python
php
node
go
java
dotnet

Making requests

The Stripe API has hundreds of API endpoints and accepts thousands of parameters. Once you've mastered the small set of patterns for passing arguments to create, retrieve, update, and delete objects, you'll be able to confidently use the API reference documentation and apply these patterns to build what your business needs. You'll see how to format parameters and pass request body, query string params, and request headers when making requests to the Stripe API. In these videos, you’ll learn how to:

  • Navigate the API reference documentation
  • Create an object passing without passing any params
  • Retrieve single object
  • Create an object with:
    • scalar values
    • enum values
    • nested hashes
    • lists of strings
  • Update an object with scalar values
  • Update an object with a list of nested hashes
  • Retrieve a list of objects
  • Filtering lists of objects
  • Delete an object
  • Using custom methods
  • Using nested service methods
  • Passing request headers

ruby
python
php
node
go
java
dotnet

Pagination

Pagination, also known as paging, divides a set of API results into discrete pages. Pagination is useful when you need to retrieve a list of objects when you have more than 100 items. The Stripe API uses cursor-based pagination, and the client libraries have built-in support for helping you iterate over a list of objects. Learn how to work with lists of Stripe objects using the client libraries, including how to take advantage of auto-pagination. In these videos, Amanda covers:

  • Manual pagination using a cursor
  • Auto-pagination using the helpers

ruby
python
php
node
go
java
dotnet

Metadata

Metadata is useful for storing additional, structured information on an object. For example, you could store your user's full name and corresponding unique identifier from your system on a Stripe Customer object. Metadata is not used by Stripe—for example, not used to authorize or decline a charge—and won't be seen by your users unless you choose to show it to them. In this video, Dawn shows you how to work with metadata from the Stripe API. She covers:

  • Supported resources (updateable objects)
  • Use cases for passing metadata
  • Capabilities and limitations
  • Best practices
  • When metadata is copied from one object to another
  • Descriptions vs. metadata
  • Security and privacy
  • Add new metadata to an object
  • Add key-value pair to existing metadata
  • Update a metadata value
  • Remove a key-value pair

ruby
python
php
node
go
java
dotnet

Webhook helpers

A webhook handler is a core piece of Stripe integrations and helper methods in the client libraries make it easier to build them. Webhook notifications are requests directly from Stripe to your server to update you when events happen on your Stripe Account. Learn from Thorsten about how to use helper methods in the client library to deserialize webhook event payloads into instances of objects rather than working with raw JSON directly. You'll also learn how signature verification works and how you can use the client library methods to handle signature verification for you. You'll also learn to use the listen command in the Stripe CLI, so you don't need a tool like ngrok for testing your webhook endpoints locally.

  • Events
  • Webhooks vs. polling
  • Event versioning
  • Deserialization of event data
  • Implement a basic webhook handler
  • Securing your webhook handler with signature verification
  • Create webhook endpoints
  • Using the listen command in the Stripe CLI

ruby
python
php
node
go
java
dotnet

Idempotency & retries

Idempotence is the property of an API call whereby it can be repeated without changing the result beyond the first application. For instance, making an idempotent request to create a payment could help avoid accidentally double-charging a customer when they double click.

Learn how to use idempotency for safely retrying requests without accidentally performing the same operation twice. Passing idempotency keys can save you when an API call fails in transit and you do not receive a response. For example, if a request to create a charge does not respond due to a network connection error, you can retry the request with the same idempotency key to guarantee that no more than one charge is created. Matthew shows us how to pass idempotency keys and automatically retry requests using the client library in this edition. He covers how to:

  • Pass the Idempotency-Key request header
  • Create an object with an idempotency key
  • Generate UUIDs to use as idempotency keys
  • Use our built-in client library retry logic

ruby
python
php
node
go
java
dotnet

Versioning

When backward-incompatible changes are introduced to the API, a new, dated version is released. In this episode, you'll learn from Dawn about API versioning with the Stripe API. You'll also see the differences between some responses returned from the API for different versions and how they impact the shape of webhook notification payloads.

  • The difference between API versions, client library versions, and Stripe.js versions
  • How API changes work with Stripe
  • Account API versions
  • See the same object with two API versions
  • Create a webhook endpoint for a specific API version

ruby
python
php
node
go
java
dotnet

Expand

In this episode, we’ll learn how to reduce the number of requests you make to the Stripe API by expanding objects in responses. Expand is a feature for addressing the N+1 problem performance problem with API requests. In these videos, Matthew will show you how to:

  • Determine which properties are expandable by looking at the API reference
  • Expand properties from related objects
  • Expand properties from distantly related objects
  • Expand additional properties on all objects in a list
  • Expand properties that aren’t included by default in a response
  • Use expand with POST requests (not just retrieve)

ruby
python
php
node
go
java
dotnet

Environment variables and .env

An environment variable is a dynamic-named value that can affect the way running processes will behave. In Stripe Samples and many of our tutorials, we use .env files to load test API keys and other settings so they can be accessed like environment variables from code. In this edition, CJ walks through the fundamentals of managing environment variables with .env and covers the third party libraries we use for working with .env files. Note that in production you might use a more feature rich and secure credential management system.

ruby
python
php
node
go
java
dotnet

We look forward to sharing some behind the scenes for those curious about creating content in a scalable way across several languages you officially support.

Top comments (0)