Marketplace
With the Craftgate marketplace solution, merchants can create and update their sub-merchants on Craftgate, specify the money distribution to their sub-merchants during checkout, and allow sending money by giving approval. It is necessary for merchants to develop the marketplace API integration under four main headings.
- Creating sub-merchants on Craftgate
- Distribution of money based on sub-merchants during payment
- Approve of payment items to send money to sub-merchants
- Run settlement
Creating sub-merchants
In the Craftgate Marketplace solution, merchants must manage their sub-merchants’ money distribution at checkout. To do this, what must be done first is to create sub merchants in Craftgate. For member API integration, see: Create Member
Merchants can view the sub-merchants that they have created and updated with the API on the merchant panel and can perform detailed searches.
Payment integration
After the sub-merchants are created in Craftgate, the memberId
parameter returns in the response of the API call and merchants must match this parameter with their own vendor. This parameter is used when distributing money to vendors during payment. For Payment API integration, see: Create Payment
In order to settlement to sub-merchants, two parameters are important during the payment.
price | subMerchantMemberId | subMerchantMemberPrice |
---|---|---|
Product Price | Craftgate member id of the created sub-merchant | The payout amount for the sub-merchant for the item |
For example, let’s say we have 3 products in our shopping cart and the sub-merchant of each product is different.
Product #1:
- Product price: 30 TL
- Sub-merchant member ID: 1
- The amount to be settled to sub-merchant: 27 TL
Product #2:
- Product price: 50 TL
- Sub-merchant member ID: 2
- The amount to be settled to sub-merchant: 42 TL
Product #3:
- Product price: 20 TL
- Sub-merchant member ID: 3
- The amount to be settled to sub-merchant: 18 TL
As seen in the example, we have 3 items in our shopping cart, and we want to buy items from 3 different sub-merchants. Considering that the merchant works with different commissions with each seller, it should calculate the money distribution according to the commission received from the sub-merchant for each product in the shopping cart and specify the money to be sent during the payment. In the example above, the seller sells the first product in the basket for 30 TL, and the money that must be settled to the seller's account after the payment is 27 TL. Craftgate transfers money according to this parameter. The amount that will be settled to the sub-merchant and the merchant is determined by this parameter.
Item approval
For sending money in the marketplace solution, merchants are expected to approve each item in the basket when the escrow is completed. The settlement amount for the products that are not approved will not be transferred and will be kept in the pool account. Approval of approved items can be withdrawn if amount is not transferred. For API integration to approve the products, see: Item Approval and Disapproval
Run settlement
The craftgate -> settlement -> createInstantWalletSettlement()
method in our open-source client libraries should be used in order to calculate the sub-merchant payouts for the approved payment transactions and add them to the sub-merchant's wallet balance.
Create Withdraw Request And Run Withdraw Settlement
In order to send the balances in the merchant wallets to the bank accounts, withdrawal requests must first be created. For this, the craftgate -> wallet -> createWithdraw(request)
method in our open source client library should be used.
After this process, the submerchant's wallet balances will be reduced by the withdrawal request.
After these operations, you can complete the settlement to the submerchant's bank accounts by using the Create File -> Upload File -> Approve File steps from the Panel -> Settlement -> Withdraw Settlement menu.