Skip to main content

Stripe

The Stripe service connection will create a connection to Stripe's API, and will use Stripe's official OpenAPI spec to provide a fully selectable GraphQL API.

Connecting Stripe

Getting a Stripe API key

To connect Stripe you'll need your Stripe API Secret Key which begins with sk_test_ and is available in the Stripe Dashboard at Developers → API Keys. That link will take you to your Stripe test credentials, for a production site be sure to use your Live API Key from Stripe.

Getting a Stripe API Key

Adding the Stripe service

Go to your project's API tab. Then, select Connect Service on the left side of the schema page. From here, select Stripe as the service you'd like to connect.

Next, fill in the required information. You can just add a human-readable name and auto-generate the slug and namespace for you, or you can change those values to suit your preferences. Here's where you will also add you Stripe API Key.

Configuring a Stripe service

tip

Your slug must be unique among all your services.

Selecting Queries & Mutations

After you select Save you will be presented with a prompt where you can select queries and mutations from the Stripe API to add to your GraphQL API. You'll notice they are all prefixed with the namespace you entered earlier.

At any time you can return to the Stripe service connection you created and select the Select Stripe Queries/Mutations button to show the selection screen again. When you add a given query all the necessary shapes to satisfy that query will also be added to your schema.

Using generated Queries & Mutations

Running a Stripe query

You will notice on the Add Queries and Mutations dialog and in the API Explorer that a variety of Args are available. For most Query types these are parameters that will scope, limit or filter your query in some way. For example, getCustomers takes an email arg which will fetch a list of customers that match that email address, exactly as the Stripe API documents.

Running a Stripe mutation

Many of the Mutation types include an input argument. This corresponds to the request body expected by many of the POST and DELETE endpoints in the Stripe API. You can enter this data in a structured way automatically take care of properly encoding it — in most cases as form data — for the request made to Stripe.

Using Stripe by editing your schema

With the Stripe service connected, you can edit your schema to create new queries that use Stripe in novel ways. Read more about schema editing here.

Still need help? Get in touch with us.