Stripe Connect Express Accounts using PHP API

Stripe Connect Express Accounts using PHP API

Live Demo Download

Screenshots

Overview

Build and start your own marketplace by integrating the Stripe Connect API using PHP to process the payments between your Platform, Connected Accounts and Customers.

This script is a working example of a typical integration of the Stripe Connect API using PHP. Its code has been written to be easily modified to fit your very own needs so you can integrate Stripe Connect to your website using Stripe "Express Accounts".

Please take enough time to understand the differences between Stripe "Custom" and "Express" Accounts on Stripe's website before buying this script!

The main difference you want to consider is how it affects the onboarding process, which is the process during which your users will fill in the required legal information that will be sent and validated by Stripe, before they can start selling their services/products on your website.

- using "Custom" Accounts: your users will have a full white-label experience, they won't even notice that Stripe is being used when they interact with your website as the onboarding process will all be done on your website. Though my "Custom Accounts" script includes this process, this requires more effort to integrate and maintain, as the regulations change from time to time and you will need to keep an eye on these changes and go back to your code to take these changes into consideration.

- using "Express" Accounts: your users will be redirected from your website to Stripe's website to complete the onboarding process, and will be redirected back to your website once the process is complete. So the onboarding process isn't "white-label", your sellers/shops will clearly see that they are on Stripe's website at some point. This requires less effort to integrate and should be preferred if you are not sure of having all the ressources needed to integrate and maintain all the Stripe Connect integration part on your website.

The experience of your end Customers (those paying for products or services on your Platform) won't be different, and the integration on your backoffice side shouldn't be too different either.

Please keep in mind that this script is meant to be integrated to your own website and adapted to your own needs, and isn't some kind of plugin that you configure in a few clics and use without looking at what's under the hood - you need to be a PHP developper to integrate it. The code is written in the simplest possible way for you to quickly understand how it works, with as much comments as I could think of to help you understand what each line does, including the corresponding links to the documentation for each Stripe API function use. The design of the script doesn't matter as it's meant to be integrated on your own website using your own branding and CSS framework, I used Bootstrap so it'd look decent without adding too much code just for the UI. The Stripe Connect API version is the latest to date and the script uses PHP, jQuery, Bootstrap and MySQL (a MySQL database will be needed to run the script, using just one single table - simple, told you!).

All the instructions to install the script are included in a “Read me.txt” file, it will take just a few minutes for you to set it up and start testing it.

Once installed, you will get a welcome page with the links to five steps covering for your integration. The code for these steps is separated into 5 respective folders to keep things as clear as possible for you. The 5 steps are:

• Create an Account: Full onboarding process/creation of Custom Connected Accounts (the sellers/shops on your Platform) with all of their details required by Stripe and the regulations of their own countries, as well as their bank accounts so they can receive the payouts from their sales on your Platform. Once the onboarding process is completed, your Connected Accounts will be ready to start making business on your platform.

• Create a Customer: Creation of a Customer (the buyers of products/services on your Platform) with the needed details.

• Payment process: Create a payment intent using the best practices Stripe Connect requires, working both with “one-to-one” (one payment to one single Account) and “one-to-many” (one payment to several Accounts) methods. Then you can pay using a payment card and get the details of the payment via the included Webhook script so you can record the payment, send an email to the Connected Account(s), Customer and the Platform when a payment has been made etc. The payment process supports Visa/Mastercard/American Express cards, covers the 3D Secure payments (which is a requirement in the European Union) and detects fake cards, insuffisant provisions, expired cards, ...

• Refund process: Select a payment and do partial or full refunds from your Connected Accounts to the Customers.

• Listing: A sort of dashboard/back office base, retrieving (using the Stripe Connect API) and listing most of the information you might want to display on your Platform, including:

- List of all your Connected Accounts

- Account page with their details (information, missing information, balance, bank accounts, payments, transfers, payouts)

- List of all your Customers

- Customer page with their details (information, cards, bank accounts, payment intents, charges)

- Platform activity (list all the events involving the Stripe API on your Platform)

- Platform balance (available/reserved/pending balance in all currencies, list of all the transactions on your Platform)

- Platform earnings (explaining how to record and display those, as the Stripe API doesn't allow to get them)

Just so you can quickly try the script, most of the inputs in the forms are pre-filled so you don't have to fill them all when making your tests.

Be aware that the Stripe Connect API can take quite some time to fully understand, so don't expect to integrate this script in two days and be all ready! This is not a Wordpress plugin so be sure to have some time to run tests, read the code, modify it and learn from your mistakes when integrating the Stripe Connect API and/with this script.

Also, this script is meant to cover the most important needs a marketplace might have in general, but obviously cannot cover all the very needs of your Platform nor your business model, so you will indeed have to spend time adapting it, adding or removing certain functionalities etc. See it as a solid structure for your house, the walls, electricity and plumbing are done, but you still need to paint the walls with the colors you like, buy the furniture and fix those lamps on the ceiling, so don't expect to move in two hours after your purchase!

As I was working on creating this script, I thought it'd be useful to share a bunch of advices and useful information, which I included in the "Read me.txt" file and in the code comments to save you some time understanding the script and how Stripe Connect and its API work, as well as where to find more information on specific points of your integration.

As specified in this file, I had to create this integration for a web project and as it took a lot of time to figure out everything and code everything in a right way (dealing with errors, making the whole thing user-friendly with some JavaScript/Ajax here and there, ...), I thought it could be great to help other developers to save some time too, or in other words, to create the script that I would have loved to buy if it was available somewhere before I started this, so I could have saved a lot of time myself. Now this script exists, and I am a hundred per cent confident that you will save many many hours with it if you need to integrate the Stripe Connect API to create your marketplace!

Please note that I am not a Stripe developper and that am not affiliated to Stripe in any way, so I won't answer any questions on how Stripe and its API work! I do mention the best ways to get their help if you need (they are pretty reactive in my experience), it's all in the "Read me.txt" file as well.

I will maintain this script up to date when the Stripe API is updated and changes are needed in the code though, and will try my best to be reactive and do the needed corrections if someone reports a bug or security issue with the script. Everything works perfectly as far as I know, and because the Stripe API version used is set in the script, even if Stripe updates their API, there shouldn't be any problems using this script for a good while. Of course, regulations can change, so mostly if your Platform is based and/or make some business in the European Union, you will need to keep an eye on the changes required from time to time and I also included how to do this in the "Read me.txt" file.

Enjoy this script and the free time you just saved by purchasing it! 

Features

Script written in pure PHP (no framework)

The code is well documented with a lot of comments and

The code is clean and consistent, each step of the integration is in separated files to keep things very clear

"Read me" file with additional tips on how to use and integrate Stripe Connect and its API that will save you some time reading their documentation

Requirements

A server running PHP and MySQL (it has to be accessible from the outside, if you want to receive the webhook information, be aware of that if you code on a local server)

You've got to be a PHP developper, of course, who has ideally already worked with APIs...

Instructions

Everything is included in the "Read me" file

Download