Integrate Adyen MarketPay into your marketplace.
After completing this tutorial, you will be able to start accepting payments and make payouts to your sub-merchants.
Before you begin
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 Support Team to enable MarketPay services for it. Adyen will provide you with credentials of a Marketplace web service user to connect to MarketPay API.
- Create a PSP web service user to accept payments. For the required steps, refer to How to get the web service (WS) user password.
- Depending on the type of your sub-merchants, there are a number of KYC checks that must be performed to verify them. Contact the 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 Adyen 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. In addition, include the
address object with the
country information to initiate the verification process required for the specific country.
The following code illustrates how to create an individual account holder with the basic fields:
createDefaultAccount to true (as shown above), MarketPay will also create an account for this account holder. Alternatively, you can set
createDefaultAccount to false, and manually create accounts using the
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 either use automatic capture (contact the Support Team to set this up) or make the
/capture request manually. In addition, you can partially capture or refund the payment. For more information, refer to Processing 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.
You can also 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).
For more information, refer to Configure notifications and Notification types. You may also want to configure HMAC signing of notifications for additional verification. To do this, see Signing MarketPay notifications with HMAC.
Onboarding and verification
Onboard sub-merchants and move them through KYC verification.
Split marketplace payments with your sub-merchants.