Stripe Connector v1.0.0

Community Connector

The Anypoint Connector for Stripe provides the ability to perform most common tasks against the Stripe API in an easy, consistent way. It allows you to easily accept payments, create charges, manage accounts using Stripe Connect, manage subscriptions and Invoices, and perform refunds.

Introduction

The Stripe Connector facilitates connections between Mule integration applications and Stripe via its Java SDK. It is a Premium Connector, meaning that you can deploy it into production if you have an Mule Enterprise License or a CloudHub account, as well as a license to use the Connector from WhiteSky Labs, Pty Ltd.

The Stripe Connector provides access to over 60 APIs in Stripe. It allows you to perform a large set of actions including managing Accounts, Subscriptions, Balances, Coupons, Charges, Cards and all forms of payments and payment management.

Assumptions

This document assumes that you are familiar with Mule, Anypoint™ Connectors, and the Anypoint Studio interface. To increase your familiarity with Studio, consider completing one or more Anypoint Studio Tutorials. Further, this page assumes that you have a basic understanding of Mule flows and Mule Global Elements.

This document describes implementation examples within the context of Anypoint Studio, Mule ESB’s graphical user interface, and, in parallel, includes configuration details for doing the same in the XML Editor.

Requirements

There are no hardware, software or technical requirements in addition to those required to run the AnyPoint Platform.

You will require a valid CloudHub Subcription or Mule ESB Enterprise License in order to use the Connector, as well as a valid agreement with WhiteSky Labs to use the Stripe Connector.

Dependencies

The Stripe Connector requires AnyPoint Studio 5.1.1 or greater with Mule EE ESB Runtime 3.6.0 or newer.

Versions

The Connector was developed and tested using ESB 3.6.0 and AnyPoint Studio 5.1.1, using the Stripe SDK for Java version 1.27.0.

Consumers

The Connector requires the user to have a valid Stripe account.

Compatibility Matrix

Application/Service Version
Mule Runtime Mule 3.6.0 and above
Stripe API Version 2015-03-24
Stripe SDK for Java v1.27.1

Installing and Configuring

You can “test drive” the Stripe Connector by installing it in Anypoint Studio. Follow the instructions to download and launch Anypoint Studio, then follow the steps below to install the Stripe Connector.

However, to use the Stripe Connector in a production environment, you must have either:

  • an Enterprise license to use Mule
  • a CloudHub Starter, Professional, or Enterprise account
  • Contact the MuleSoft Sales Team to obtain either of these.

Installing

To install the Stripe Connector:

  1. Under the Help menu in Anypoint Studio, select Install New Software.
  2. Next to the Work with: field of the Install wizard, choose the “Add:” button. Choose “Archive” and navigate to the installation zip file provided to you by WhiteSky Labs. Finally, give the site a name (e.g. “Stripe Connector Installer”) and choose OK.
  3. In the table below the Filter field (see image below), click to expand the Standard folder, then select Mule Stripe Connector. Click Next.
  4. Review the details, then click Next.
  5. Click to accept the terms and conditions, then click Finish.
  6. Click Restart Now to complete the installation. Once you have installed the connector and restarted Studio you will see the Stripe Connector available in the palette, under the Connectors category.

    Stripe Connector Palette

Configuring

To use the Stripe Connector, you must configure two things:

  • an instance of the connector in your application
  • a global Stripe connector configuration

To create a global Stripe connector configuration, follow these steps:

  1. Click the Global Elements tab at the base of the canvas, then click Create.
  2. Use the filter to locate, then select Stripe, then click OK.
  3. Configure the global connector’s parameters according to the table below.

    Stripe Global Parameters

    Parameter Description Example
    NameName for the global elementSplunk
    ApiVersion(Optional) Stripe API Version2015-03-24
    ApiKeyYour Stripe API Keysk_abc123
  4. Access the Pooling Profile tab to configure any settings relevant to managing multiple connections via a connection pool.
  5. Access the Reconnection tab to configure any settings relevant to reconnection strategies that Mule should execute if it loses its connection to Stripe.
  6. Click Test Connection to confirm that the parameters of your global Stripe connector are accurate, and that Mule is able to successfully connect to your instance of Stripe.
  7. Click OK to save the global connector configurations.
  8. Return to the Message Flow tab in Studio. Drag the Stripe Connector onto the canvas, then select it to open the Properties Editor console.
  9. Configure the connector’s parameters according to the table below.

    Stripe Connector Instance Parameters

    Field Description Default
    Display NameA human-readable name for the Connector operationRetrieve Customer
    Config ReferenceThe global configuration for the Connector to connect to StripeStripe__Connection_Management_Strategy
    OperationThe operation to perform.Retrieve Customer
    idA parameter for the operation chosen.#[payload]
  10. Click blank space on the canvas to save your Stripe connector configurations.

Example Use Case

It’s time to build the flows which creates a Customer, retrieves them, and deletes the Customer.

Create Customer flow

Retrieve and Delete flows

Create Customer flow: This is the flow which creates a Customer in Stripe. Start by dragging an HTTP endpoint from the palette onto the flow. Create a new Connector Configuration for this endpoint and accept the defaults.

HTTP Connector Configuration

Now add a path to your HTTP receiver: “/createcustomer”. This is the URL you will call to start the flow.

HTTP Receiver Configuration

Then drag a Stripe Connector onto the flow after the HTTP endpoint. In the configuration window for the Stripe Connector, select the previously created Stripe config from the Config Reference dropdown. Set the Operation to “Create Customer”, and provide an email and description. Add an “Object to JSON” transformer at the end to make sure the response is readable by a human. Click okay.

Create Customer Flow

This completes the Create Customer flow.

Retrieve Customer flow: This is the flow which retrieves the Customer. Start by dragging an HTTP endpoint from the palette onto the workspace (not onto a flow), creating a new flow. Use the existing HTTP configuration. Configure the Path to “/retrieveCustomer”. This is the URL you will call to start the flow. Then drag a Stripe Connector onto the flow after the HTTP endpoint. In the configuration window for the Stripe Connector, select the previously created Stripe config from the Config Reference dropdown. Set the Operation to “Retrieve Customer”, and set the id field to “#[message.inboundProperties.’http.query.params’.id]”. Add an “Object to JSON” transformer at the end to make sure the response is readable by a human. Click OK.

Retrieve Customer Flow

Delete Customer Flow: This is the flow which removes the customer you created. Start by dragging an HTTP endpoint from the palette onto the workspace (not onto a flow), creating a new flow. Use the existing HTTP configuration. Configure the Path to “/deleteCustomer”. This is the URL you will call to start the flow. Then drag a Stripe Connector onto the flow after the HTTP endpoint. In the configuration window for the Stripe Connector, select the previously created Stripe config from the Config Reference dropdown. Set the Operation to “Delete Customer”, and set the id field to “#[message.inboundProperties.’http.query.params’.id]”. Add an “Object to JSON” transformer at the end to make sure the response is readable by a human. Click OK.

Delete Customer Flow

Flow XML

The final flow XML should look like this.

<?xml version="1.0" encoding="UTF-8"?>

Testing the app

Now it’s time to test the app. Run the app in Anypoint Studio and open a browser window. Visit http://localhost:8081/createcustomer. This will create a Customer in Stripe and return the ID in the JSON. Now visit [http://localhost:8081/retrievecustomer?id=](http://localhost:8081/retrievecustomer?id=). This will retrieve the customer, confirming it exists. Now visit [http://localhost:8081/deletecustomer?id=](http://localhost:8081/deletecustomer?id=). This will remove the previously created customer.

Updating From an Older Version

There is currently no procedure for upgrading as only one version of the Connector exists.

Using This Connector

Best Practices

  • It is important to understand how the Stripe API works in order to effectively use the Connector, especially the relationships between accounts, application fees and Stripe Connect. Review the Stripe API documentation to learn more.

Go Further