Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Mule ESB Integration With Stripe

DZone's Guide to

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.

Free Resource

Modernize your application architectures with microservices and APIs with best practices from this free virtual summit series. Brought to you in partnership with CA Technologies.

Overview

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.

Prerequisites

  • 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.

Image title

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.

Image title

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.

Image title

How to Integrate Stripe With MuleSoft Applications

Install the Stripe Connector in Anypoint Studio (3.5 and above).

Image title

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.

Image title

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

Image title

Coupon Creation Under Stripe

Image title


The Integration Zone is proudly sponsored by CA Technologies. Learn from expert microservices and API presentations at the Modernizing Application Architectures Virtual Summit Series.

Topics:
mule esb ,integration ,stripe

Published at DZone with permission of Ramakrishna Narkedamilli. See the original article here.

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}