AWS for Industries
Streamlining Financial Operations: Leveraging Stripe event destinations with Amazon EventBridge
Stripe is a financial infrastructure platform that provides businesses with the tools to power their online and in person payments, embedded financial services, and custom revenue models. In this fast-paced digital world, customer payment flows require automated workflows to kick off processes such as fulfilling orders after a successful payment, granting user access after a subscription upgrade, or sending notifications for refund processing. Traditionally, customers send Stripe events to webhook endpoints, and in this blog post, we’ll explore a new workflow automation using Stripe event destinations.
At AWS, we constantly innovate to help our financial services customers streamline their operations and enhance their customer experiences. Today, we’re excited to showcase a powerful integration between Stripe, a leading financial infrastructure platform, and our own Amazon EventBridge – a serverless, event-driven service that helps connect your applications together by ingesting, transforming, and delivering events.
If you’re both an AWS and Stripe customer, you can create Stripe event destinations to receive real-time updates about your Stripe accounts directly in Amazon EventBridge. Previously, Stripe only supported sending events to a webhook endpoint.
By integrating with Amazon EventBridge using Stripe event destinations, you receive event data from Stripe directly in your AWS account. This eliminates the need to handle traffic and manage integration code logic yourself. When Amazon EventBridge receives events, it routes them to 20 supported targets to process or trigger business automations.
In this blog post, we’ll guide you through this integration workflow automation. You’ll learn how this solution allows you to receive events reliably and securely within your AWS infrastructure, without the need to manage additional infrastructure or write additional integration code.
For business decision makers, we’ll explore how this integration improves your customers’ experience, delivers overall business benefits, and potentially saves your company’s time and money. For technical decision makers, we’ll delve into implementation considerations, resource requirements, and the technical advantages of this solution.
Key Benefits for Your Business:
- Enhanced Reliability and Security: Receive Stripe events directly within your AWS infrastructure.
- Improved Scalability: Handle high-volume event processing effortlessly.
- Simplified Integration: Remove intermediary steps for more efficient event handling.
- Versatile Event Routing: Leverage Amazon EventBridge to route events to over 20 AWS and third-party targets.
- Advanced Developer Tools: Use Amazon EventBridge’s built-in capabilities for event management.
Unlocking New Possibilities
With this integration, you can:
- Trigger serverless functions with AWS Lambda for business automations.
- Set up low-code workflows with AWS Step Functions, for customer notifications.
- Distribute Stripe event data to internal services using Amazon Simple Notification Service (SNS) or Amazon Simple Queue Service (SQS).
- Create automated event archival pipelines to Amazon S3.
- Implement robust monitoring and alerting systems with Amazon CloudWatch.
Use case: Sending Stripe events to Amazon CloudWatch
To get started with sending Stripe events to Amazon EventBridge, use our AWS CloudFormation template [GitHub] to provision programmatically the infrastructure needed across Stripe and AWS, which additionally sets up a CloudWatch log group to monitor incoming events. The section below explains the steps our CloudFormation template performs to set up in your Stripe and AWS accounts. Alternately, you can perform these steps manually through the UI as described in the Send events to Amazon EventBridge page.
The following diagram illustrates the event flow and high-level architecture of this solution.
Figure 1: Shows the architecture of Stripe events to Amazon EventBridge
Stripe customers route events to Amazon EventBridge by configuring it as a Partner Event Source destination. For instance, here are the high-level steps to send a ‘Customer.Created’ Stripe event to an AWS CloudWatch log group using Stripe event destinations and Amazon EventBridge’s Partner Event Source feature.
1. Go to the CloudFormation console in AWS, click Stacks -> Create stack -> With new resources (standard).
Figure 2: Create a new stack in AWS CloudFormation
2. Upload cloudformation.yaml from the repository, and click “Next.”
Figure 3: Uploading a CloudFormation template
3. In Specify Stack Details Steps, Enter the following required parameters:
Stack Name: Provide a Name for an AWS CloudFormation Stack
EventDestinationName : Name for Stripe event destination
StripeAPIKey: Copy and paste the Secret API Key from Stripe Dashboard. The Stripe API key is stored as a secure string in CloudFormation. Follow Stripe best practices for managing sensitive information.
Figure 4: Enter Required Parameter values
4. In the Configure stack options step, check the boxes under Capabilities and transforms section as the following example. Click Next.
Figure 5: Acknowledge AWS CloudFormation capabilities
5. Once the AWS CloudFormation Execution is completed, the following resources will be created:
Figure 6: AWS CloudFormation steps completed
At a high level, AWS CloudFormation performs the following 3 steps:
1. Configure Amazon EventBridge as Stripe event destinations in your Stripe account.
AWS CloudFormation creates and executes a Lambda function to call Stripe API using user provide input.
2. Associate Stripe event destination with an Amazon EventBridge
Using following AWS CloudFormation snippet, Amazon EventBridge will be associated with Stripe Event Destinations in your AWS Account.
AmazonEventBus:
Type: AWS::Events::EventBus
Properties:
Name: <<Name of EventBus Name>>
EventSourceName: <<Name of Stripe Event Source. Please note Name and EventSourceName should be the same Ex: aws.partner/stripe.com/ed_test_1235_>>
3. Define rules in Amazon EventBridge to handle incoming Stripe events.
AWS CloudFormation script creates a CloudWatch log group to log Stripe events and associates the log group with EventBus using an Amazon EventBridge rule.
6. Verify CloudFormation Setup.
a. AWS CloudFormation executes with success, like the following:
Figure 7: AWS CloudFormation steps completed
b. It creates an Active Stripe event destination in the Stripe Workbench.
Figure 8: Active Stripe event destination in Stripe Workbench
c. It activates Partner Event Source under Amazon EventBridge in your AWS Account
Figure 9: Active Partner Event Source Under Amazon EventBridge
d. Creating a New Customer on Stripe Side now results in Amazon CloudWatch Log event.
Figure 10: Customer Created event from Stripe is logged in Amazon CloudWatch Log Group
Conclusion
Registering Stripe event destinations for Amazon EventBridge offers a powerful solution for optimizing your financial operations and enhancing customer experiences. This integration enables you to build robust, decoupled, scalable event-driven architectures for efficient payment event handling.
One of the satisfied users provided the following feedback for his experience using Stripe event destinations: “Because the Stripe EventBridge integration is a trusted source, I’m no longer worried about webhook secret key handling and signature verification. Previously, I sent all interesting webhook events to a single AWS Lambda function, which I then forwarded to an Amazon EventBridge event bus and handled from there. The direct integration to EventBridge simplifies my integration by removing the Lambda function I had sandwiched in between.”
For Business Decision Makers, this solution promises improved operational efficiency, enhanced customer experiences, and potential cost savings.
For Technical Decision Makers, it offers a simplified integration process, improved reliability, and advanced tools for managing the entire event lifecycle.
Ready to transform your payment processing and streamline your financial workflows? Here’s how you can get started receiving Stripe events directly in Amazon EventBridge:
1. Explore: Dive deeper into the technical documentation for Stripe event destinations and Amazon EventBridge.
2. Start Small: Use our sample repository to set up a test environment and see the integration in action.
3. Get Support: Have questions? Reach out to our team of AWS and Stripe experts here. We’re here to help you implement this solution effectively.
4. Share Your Experience: Already using this integration? We’d love to hear about your success. Share your story with us in the comments.