Mule ESB Integration With Stripe
The Mule Stripe Connector enables developers to interact with Stripe API to accept payments, create invoices, coupons, cards, and other various actions.
Join the DZone community and get the full member experience.Join For Free
MuleSoft is a popular ESB technology to integrate various on-premise and cloud applications for data exchange. Stripe is an American company that allows both private individuals and businesses to accept payments over the internet. Stripe specifically focuses on providing the technical, fraud prevention, and banking infrastructure required to operate online payment systems. The Mule Stripe Connector enables developers to interact with Stripe API to accept payments, create invoices, coupons, cards, and other various actions.
- Stripe developer account.
- Stripe API key.
- Mule Anypoint Studio with runtime version 3.6+.
- Mule Anypoint Stripe connector.
Stripe Developer Account Setup
For this sample, we need a developer Stripe account. We can sign up for free here.
Stripe API key Value
A Stripe developer account provides various options to control the communication between the Stripe API and other applications. To access the full features of Stripe and connect with it, we need the Stripe API key (for a test environment, use the test secret key). These values available under Stripe > Your Account > Account Settings.
Mule AnypointStripe Connector
Stripe is an online payment provider. The Mule Stripe connector gives the option to integrate Stripe to perform the below options
- CRUD for customers.
- Accepts payments.
- CRUD for coupons.
- Create invoices, plans, subscriptions etc.
MULE ESB Flows for Stripe Integration
The below Mule application is used to create Customer and Coupon under Stripe using Mule Anypoint Stripe connector.
How to Integrate Stripe With MuleSoft Applications
Install the Stripe Connector in Anypoint Studio (3.5 and above).
Create a new Anypoint Studio Project and Flow to create Customer and Coupon.
Configure the Stripe global element in global elements section by providing the Stripe API key.
In the flow, add the HTTP inbound endpoint to trigger the service.
Add a choice router to route the control to create customer or create coupon based on the request action query parameter.
Now, we are integrated with Stripe to perform actions.
Running and Testing the Application
Right-click on the application > Run > Mule Application.
Open the browser and hit this URL.
The service will create the new customer in Stripe account in case of no errors.
Now, trigger this URL.
The service will create a new coupon under the Coupon sections if there are no errors.
Customer Creation Under Stripe
Coupon Creation Under Stripe
Published at DZone with permission of Ramakrishna Narkedamilli. See the original article here.
Opinions expressed by DZone contributors are their own.