Stripe Connect PHP API – Create accounts, customers, payments & refunds (build your marketplace)
Stripe Connect PHP API is a set of tools and APIs that enables you to build a platform that allows multiple parties to interact with your business. With Stripe Connect, you can create and manage user accounts, accept payments, and pay out funds to your sellers or service providers. Stripe Connect also provides robust reporting tools that give you insight into your platform’s performance.
Getting Started with Stripe Connect
Before you can use the Stripe Connect PHP API, you need to set up a Stripe account and configure your account to use Connect. Once you’ve set up your Stripe account, you can create an OAuth client ID to allow your users to connect their Stripe accounts to your platform.
Creating User Accounts
To create a user account in Stripe Connect, you’ll use the Accounts
API. You can create two types of accounts: Standard accounts and Custom accounts. Standard accounts are pre-built account types that you can use to onboard users quickly. Custom accounts allow you to customize the onboarding process and collect more information from your users.
To create a Standard account, you’ll use the Create Account
endpoint. This endpoint creates a new account object in Stripe and returns the account ID, which you’ll use to manage the account. You can also specify the type of account (individual or company) and other details such as email and country.
To create a Custom account, you’ll use the Create Custom Account
endpoint. This endpoint allows you to specify additional details such as the user’s legal name, tax ID, and business type.
Creating Customers
Once you’ve created user accounts, you can create customer objects in Stripe to represent your buyers. Customers in Stripe are separate from user accounts and can be used to store billing information, track payments, and manage subscriptions.
To create a customer in Stripe, you’ll use the Customers
API. You can create a new customer by sending a POST request to the Create Customer
endpoint. You’ll need to provide basic information such as the customer’s name and email address. You can also include additional information such as shipping and billing addresses.
Accepting Payments
Stripe Connect provides a variety of ways to accept payments, including credit and debit cards, bank transfers, and digital wallets. To accept payments, you’ll need to create a payment object in Stripe and attach it to a customer or account.
To create a payment in Stripe, you’ll use the Payments
API. You can create a new payment by sending a POST request to the Create Payment
endpoint. You’ll need to provide the amount of the payment, the currency, and a description of the payment. You can also include optional parameters such as the customer or account ID and a statement descriptor.
Refunding Payments
If a buyer requests a refund or if you need to issue a refund for any reason, you can use the Stripe Connect API to process refunds. To process a refund, you’ll need to create a refund object in Stripe and attach it to the original payment.
To create a refund in Stripe, you’ll use the Refunds
API. You can create a new refund by sending a POST request to the Create Refund
endpoint. You’ll need to provide the amount of the refund and the ID of the original payment. You can also include optional parameters such as a description of the refund.
Conclusion
Enjoy this script and the free time you just saved by purchasing it!
CHANGELOG
2020-02:
– Original version of the script.
2021-05:
– The script has been updated to the latest Stripe Connect API (version 2020-08-27) and Stripe PHP Library (version 7.79.0).
– The support of fraudulent cards detection has been improved.
2022-01:
– Fixed an issue with the way tokens were created during the Connected Accounts onboarding process. This part has been entirely rewritten, the tokens are now created using the Stripe.js library rather than the PHP API. This is now a requirement for platforms based in France and only recommended (so far, at least) for other countries. This is a pretty major upgrade under the hood, so if you bought the script previously and want to integrate these changes, be sure to read the code in details.
– Added a mandatory “By continuing, you agree to our terms and the Stripe Connected Account Agreement.” line at the first step of account creation.
– Removed the Stripe API publishable keys from the external javascript files, so there’s no need to change it there too when implementing the code or switching from ‘test’ to ‘live’ mode.
– On the ‘Connected account’ and ‘Customer’ details pages in the listing part of the script, added the full array of data that can be retrieved from the API so you know everything you can get from the API.
– Removed most of the custom CSS classes previously created in favor of Bootstrap’s classes.
– The documentation of the Webhook file has been improved more with useful tips.
– Added a few more tips around the use of the API and Stripe Connect in general in the “Read me” file, including an example of how to update the information of a Connected account using tokens.
– Updated the PHP library for Stripe API to the latest version to date (7.107.0). The latest Stripe Connect API version being still ‘2020-08-27’.
– Minor corrections of the comments (corrected a few english mistakes, updated links to the right pages of the stripe connect api, additional clarity on a few things).
What is Stripe Connect PHP API?
Stripe Connect PHP API is a set of tools and APIs that allows you to create user accounts, customers, payments, and refunds in your marketplace. It enables you to connect buyers and sellers and process transactions securely and efficiently.
What types of payments can I accept with Stripe Connect?
Stripe Connect supports a variety of payment methods, including credit and debit cards, bank transfers, and digital wallets.
How do I process refunds with Stripe Connect?
To process refunds in Stripe Connect, you’ll need to create a refund object in Stripe and attach it to the original payment. You can do this using the Refunds API, which allows you to create, retrieve, and update refund objects in Stripe.
You must log in to submit a review.