Atlas Stripe API Integration
This guide will help you configure Atlas to authenticate and proxy requests to the Stripe API.
Stripe is a payment processing platform for online and mobile businesses. It offers payments, fraud detection, checkout links, billing, invoicing, and more.
The Stripe API provides developers with programmatic access to the Stripe platform. This includes charges, disputes, events, payouts, refunds, customer analytics, and team management.
At the end of this guide, your running instance of Atlas will be configured to:
Proxy HTTP requests to the Stripe API.
Authenticate these requests using one or more Stripe API keys.
Availability
Public beta. This integration is available to all Atlas users, but the API may change.
Prerequisites
A running instance of Atlas. See installation guides for more details.
Provision a Stripe API key
Stripe offers several types of API keys. We recommend provisioning restricted API keys for use with Atlas. The steps to do this are as follows:
From the Stripe dashboard click the Developers button in the top-right corner.
Choose the API keys tab.
Click the Create restricted key button.
Name the key, and select the permissions you want to grant.
When you're done, click the Create key button in the bottom left corner.
Copy the key and save it somewhere safe. You will need it in the next step to configure Atlas to proxy requests to the Stripe API.
Add Stripe Integration to Atlas
Once the Stripe API key is provisioned, we will need to make it available to your running Atlas instance. We will do this by:
Adding the Stripe API key to the Atlas configuration as an environment variable, e.g.,
STRIPE_API_KEY
.Configuring the Atlas deployment to use an HTTP adapter that adds the Stripe API key to the
Authorization
header.
Step 1: Add Stripe API key to Atlas Deployment as an Environment Variable
Choose an environment variable name for the Stripe API key. Generally this is something like
STRIPE_API_KEY
.Add the Stripe API key you provisioned as an environment variables to your Atlas deployment. The install guides have instructions for how to do this for each deployment method. For example, if you deployed Atlas using ECS, you might add an environment variable
STRIPE_API_KEY
to the Pulumi configuration. If you deployed using Kubernetes, you might add theSTRIPE_API_KEY
environment variable to a.env
file.Note the name of the environment variable you chose. We will use this in the next step to configure the HTTP adapter.
Step 2: Add Stripe API key to Atlas Configuration
We can use the mom
CLI to add the Stripe API key to the Atlas configuration. Run this command, changing
YOUR_ATLAS_CONFIG.yml
with the path to your Atlas configuration fileSTRIPE_API_KEY
to the name of the environment variable you chose in the previous stepYOUR_ADAPTER_NAME
to the name you want to use for the HTTP adapter in Atlas, e.g.,stripe
The diff in your version control system should look something like this:
Step 3: Deploy the Updated Atlas Config
The install guides have instructions for how to deploy Atlas into a variety of environments, including Kubernetes and ECS.
Step 4: Test the Integration
Once deployed, we can use the mom curl
command to test the integration. Be sure to replace stripe
with the name you chose in the previous step if it is different.
Using the integration in a canvas
This integration can be used in Moment by creating a new cell in a Moment canvas, and pasting the following code. Note that you will need to assign httpAdapterName
to the name you chose for the HTTP adapter in the previous step, e.g., stripe
or stripe-viewer
.
If the integration is working, you should see a JSON object with a list of Stripe charges.
Last updated