This guide provides you with the steps to integrate your marketplace with the MarketPay system. After completing this tutorial, you will be able to start accepting payments and make payouts to your sub-merchants.
Before you start using MarketPay services, make sure that you have performed the following steps:
- Sign up for an Adyen test account at https://www.adyen.com/signup and contact Adyen Support Team to enable MarketPay services for it.
- Create a Marketplace web service user to connect to MarketPay-related endpoints, and a PSP web service user to accept payments.
- Depending on the type of your sub-merchants, there are a number of KYC checks that must be performed to verify them. Contact the Adyen Support Team to define required KYC checks for your test account.
For more information on prerequisite steps, refer to Getting started with Adyen.
Step 1 - Sign up sub-merchants
Provide information about your sub-merchants to the MarketPay system. For each sub-merchant, create a corresponding account holder and one or more accounts for it (where necessary).
To create an account holder, call
/createAccountHolder, where you provide
legalEntity (individual or business). These fields are required for an account holder to start accepting payments.
The following code illustrates how to create an individual account holder with the required fields only:
By default, at least one account is always created for the account holder (if the
createDefaultAccount flag is set to true, as shown above). If you need to add more accounts to an account holder, use
Step 2 - Onboard sub-merchants
During the onboarding process, you need to collect additional information from your sub-merchants for KYC verification checks. Successful passing of these checks is required for sub-merchants to process payments at higher tiers and enable payouts.
The code below illustrates how to upload a passport using the
/uploadDocument call. The image file, which contains the document, must be encoded as the Base64 string and assigned to the
documentContent field, and the
documentDetail object should contain an account holder code and other information about the document.
Since KYC verification is usually performed asynchronously, its result is sent to your backend as a notification. To accept these notifications, configure them as described in Set up notifications.
Step 3 - Process payments
After creating account holders with the basic information, you can immediately start processing payments for them. In this case, the amount customers pay to your marketplace should be split between a sub-merchant's account and your marketplace account.
To do this, make an
/authorise call and pass split-specific fields as additional data. In the example below,
amount fields contain payment details, while
additionalData contains instructions on how to split a payment. In this case, 62.00 EUR will be split between an account holder's account (60.00 EUR) and your marketplace commission (2.00 EUR).
After a transaction has been successfully authorised, you must capture it for the payment to be settled. You can opt for automatic capture (contact Adyen Support Team) or make the
/capture request manually. In addition, you can partially capture or refund the payment. For more information, refer to Process payments.
Step 4 - Pay out sub-merchants
After an account holder successfully passes required KYC checks, you can initiate a payout to this account holder.
For this, call
/payoutAccountHolder as follows. In the example below,
value specify the amount to be paid out (997.92 EUR),
accountHolderCode uniquely identify the source account, while the
bankAccountUUID specifies the bank account that receives the payout.
Alternatively, you can schedule a payout job to automatically make a payout (e.g. once per day). For more information, refer to Payouts.
Step 5 - Set up notifications
To be aware of all the events that happen to your marketplace account, as well as get the results of KYC verification and other important changes, your system must be able to accept notifications.
MarketPay sends these notifications as callbacks to the URLs you specify via the
/createNotificationConfiguration call. In this case, we activate the ACCOUNT_HOLDER_VERIFICATION notification that should be sent to the endpoint on your server ( using the specified connection credentials (testUserName and testPassword).