Stripe
Last Authored: Monday, July 24th, 2023This Interaction service allows you to pull data from your Stripe account.
Requirements
For Stripe Interaction layer to work we require a Stripe API Restricted Key configured to have READ permissions on Charges, Products and Subscriptions resources. Please read Locate API Keys for more info.
Steps on creating a new Stripe Private Key
Log into Stripe as an administrator and click Developers > API Keys
Click on the button that says Create restricted key
This should open up Create restricted API Key Page.
Enter a name for the Key in Key name input
Under Resource Types, toggle the Read permission for Products, Charges and Subscriptions resource types
Once the three resources have permissions set, scroll to the bottom of the page and click on Create New Key. You may have to verify the creation of the key if using two factor authentication.
Once the key gets created, you should be able to see the new key in a modal. Keep the key secure as this is the key that Project Compound will ask for.
Stripe Charges
This services requires Read permission on the Stripe restricted API Key.
This Interaction layer allows you to fetch your Charges data. It utilizes the Charges resource on Stripe's API.
The UI for this layer will ask for the following inputs:
Interaction Name - Used for Dashboarding and internal resource naming
Stripe Private Key - API key created when creating a new restricted API key
Frequency - How often do you want to pull the data. Currently we only support three options, hourly, daily and monthly.
Behind the scenes
To make this data fetch work, we deploy three AWS resources:
Lambda
SQS - Simple Queue Service
Events Rule
One Lambda resource is deployed, written in Node, which is responsible for three tasks. First, it hits Stripe's Charges API and pulls data in JSON format. Second, this data is then sent to an SQS queue which is used as the read source in the extraction stage. When this service is deployed, we set limits to how many of these Lambdas can run in parallel. By default, AWS sets it to 1000 however Stripe's API is limited to 100 calls/sec or 20 calls/sec for test mode. Hence, to be safe we have configured parallel execution of this function to 20 i.e only 20 functions can run at a time.
Two SQS resources are deployed, 1 responsible to fetch the next batch of charges and the other to store the extrapolated data. Stripe's Charges API is limited to fetching a max of 100 charges in one call. However in Project Compound, we limit the fetch to 20 charges to optimize cost and performance of the node function. Hence, to grab all the charges we send a starting_after
value to the next batch SQS queue which queues the Lambda function to run with the provided value. This ensures the next batch of charges is fetched. The other SQS queue is deployed to hold the extrapolated data which is utilized in the Extraction layer.
One Event Rule is deployed which triggers the Lambda resource based on the frequency option selected.
You can sync old Stripe Charges data through Dashboard.
Stripe Products
This services requires Read permission on the Stripe restricted API Key.
This Interaction layer allows you to fetch your Charges data. It utilizes the Products resource on Stripe's API.
The UI for this layer will ask for the following inputs:
Interaction Name - Used for Dashboarding and internal resource naming
Stripe Private Key - API key created when creating a new restricted API key
Frequency - How often do you want to pull the data. Currently we only support three options, hourly, daily and monthly.
Behind the scenes
To make this data fetch work, we deploy three AWS resources:
Lambda
SQS - Simple Queue Service
Events Rule
One Lambda resource is deployed, written in Node, which is responsible for three tasks. First, it hits Stripe's Products API and pulls data in JSON format. Second, this data is then sent to an SQS queue which is used as the read source in the extraction stage. When this service is deployed, we set limits to how many of these Lambdas can run in parallel. By default, AWS sets it to 1000 however Stripe's API is limited to 100 calls/sec or 20 calls/sec for test mode. Hence, to be safe we have configured parallel execution of this function to 20 i.e only 20 functions can run at a time.
Two SQS resources are deployed, 1 responsible to fetch the next batch of charges and the other to store the extrapolated data. Stripe's Charges API is limited to fetching a max of 100 charges in one call. However in Project Compound, we limit the fetch to 20 charges to optimize cost and performance of the node function. Hence, to grab all the products we send a starting_after
value to the next batch SQS queue which queues the Lambda function to run with the another fetch with provided value. This ensures that the next batch of products is fetched.The other SQS queue is deployed to hold the extrapolated data which is utilized in the Extraction layer.
One Event Rule is deployed which triggers the Lambda resource based on the frequency option selected.
Stripe Subscriptions
This services requires Read permission on the Stripe restricted API Key.
This Interaction layer allows you to fetch your Charges data. It utilizes the Charges resource on Stripe's API.
The UI for this layer will ask for the following inputs:
Interaction Name - Used for Dashboarding and internal resource naming
Stripe Private Key - API key created when creating a new restricted API key
Frequency - How often do you want to pull the data. Since one Stripe account can have several subscriptions, we currently only support two options, daily and monthly.
Behind the scenes
To make this data fetch work, we deploy three AWS resources:
Lambda
SQS - Simple Queue Service
Events Rule
One Lambda resource is deployed, written in Node, which is responsible for three tasks. First, it hits Stripe's Charges API and pulls data in JSON format. Second, this data is then sent to an SQS queue which is used as the read source in the extraction stage. When this service is deployed, we set limits to how many of these Lambdas can run in parallel. By default, AWS sets it to 1000 however Stripe's API is limited to 100 calls/sec or 20 calls/sec for test mode. Hence, to be safe we have configured parallel execution of this function to 20 i.e only 20 functions can run at a time.
Two SQS resources are deployed, 1 responsible to fetch the next batch of charges and the other to store the extrapolated data. Stripe's Subscriptions API is limited to fetching a max of 100 subscriptions in one call. However in Project Compound, we limit the fetch to 20 subscriptions to optimize cost and performance of the node function. Hence, to grab all the subscriptions we send a starting_after
value to the next batch SQS queue which queues the Lambda function to run with the provided value. This ensures to fetch the next batch of subscriptions.The other SQS queue is deployed to hold the extrapolated data which is utilized in the Extraction layer.
One Event Rule is deployed which triggers the Lambda resource based on the frequency option selected.