Stripe Connector
Learn how to integrate Stripe APIs into your graph
Stripe is a payments platform that provides a REST API to support multiple checkout flows. The prebuilt Stripe Connector provides a GraphQL interface for Stripe's services.
Connector capabilities
This Connector can incorporate the following Stripe REST API endpoints into your graph:
Core resources, like Customers and Payment Intents
Prerequisites
To use the Connector, you need a Stripe API key.
Try out the Connector
Use the Apollo Sandbox below to test out the Connector. This is the same interface you use locally to test your queries.
Starting with the Products
query is easiest since it doesn't require any parameters.
Other available queries are listed on the left. Click one to add fields to your query and run to see the response.
Getting started
If you haven't already, create a new graph in GraphOS.
Copy the
supergraph.yaml
androuter.yaml
files from the Connector to replace the files created by runningrover init
.Set your Stripe API key as an environment variable in your terminal:
terminalexport STRIPE_API_KEY=....
Run
rover dev
to start the local development session:terminalAPOLLO_KEY=service:My-Graph-s1ff1u:•••••••••••••••••••••• \ APOLLO_GRAPH_REF=My-Graph-s1ff1u@main \ rover dev --supergraph-config supergraph.yaml --router-config router.yaml
You're all set! Open http://localhost:4000
to query your graph using Apollo Sandbox.
Adding to an existing graph in GraphOS
To add these Connectors to an existing graph, publish the schema products.graphql
file to your graph ref using rover subgraph publish
:
APOLLO_KEY=service:My-Graph-s1ff1u:•••••••••••••••••••••• \
rover subgraph publish My-Graph-s1ff1u@main --name products --schema products.graphql --routing-url http://products
APOLLO_KEY=service:My-Graph-s1ff1u:•••••••••••••••••••••• \
rover subgraph publish My-Graph-s1ff1u@main --name checkout --schema checkout.graphql --routing-url http://checkout
Setup VS Code task runner
Once you've set up the VS Code task runner, you can execute the Tasks: Run Task
command in VS Code to run the rover dev
task.
Edit your .vscode/settings.json
to include the following Stripe-specific key:
{
"terminal.integrated.profiles.osx": {
"graphos": {
"path": "zsh",
"args": ["-l"],
"env": {
"STRIPE_API_KEY": "",
...
}
}
},
"terminal.integrated.defaultProfile.osx": "graphos"
}
Alternatively, you can open a new terminal window in VS Code with the graphos
profile, then run rover dev --supergraph-config supergraph.yaml --router-config router.yaml
.
Contributing
The Connectors Community welcomes contributions to this Connector or to expand the library. For instructions on how to contribute, see the contributing guide.
Modules to contribute
The following schema modules can be added to this Connector:
Additional modules listed in the left column of the Stripe API documentation
To contribute a new module:
Add a schema designed for the module as a new
.graphql
fileUpdate the
router.yaml
andsupergraph.yaml
files accordingly
You can use the current modules in this folder as examples to start from.