Integration Steps
Restricted Access
The Marketplace API is available only to select customers based on their business needs.
Regular Instamojo API credentials will not work for the Marketplace API.For credentials related to Marketplace API contact [email protected] and specify your platform (production/sandbox).
Authentication Flow
All API interactions required you to have a authentication credentials. Use the client_id and client_secret to authenticate yourself against the API. There are three kinds of authentication:
-
Application Based - This gives you extra privileges like creating an account on Instamojo.
-
User Based - This gives you privileges for performing actions on a user's account. For eg: updating their name and location, creating payment links on their behalf, etc.
-
Refresh Token Based - An
access_tokenobtained via the User Based authentication will expire in36000seconds. But it also gives arefresh_token, which can be used to obtain a new pair ofaccess_tokenandrefresh_tokenwithout the need for theusernameandpassword.
Signup Flow
-
Use Application Based Authentication with your marketplace Client ID & Client Secret to get an
access_token. -
Use this
access_tokento create a user on Instamojo using Signup API. Here you should use a valid email id and a random password. Ensure that you are not storing the password in your system. On signup, you will receive a uniqueidfor the user, which will be used henceforth to identify the user. -
Use User Based Authentication to get an
access_tokenusing the username & password from above step. Going forward, you must store theaccess_tokenandrefresh_tokensafely in your database, and discard the password that you had used. If the currentaccess_tokenexpires, you should use the Refresh Token Based Authentication to get a new pair ofaccess_tokenandrefresh_token. -
Use this
access_tokento Update bank details of a user.
Payment Flow
-
Use User Based Authentication with your marketplace Client ID & Client Secret to get an
access_token. -
Use this
access_tokento Create a Payment Request. -
Present the payment link created above to the buyer. Your can either redirect the merchant to this page, or use our Javascript SDK on web.
-
Once the buyer completes the payment, Instamojo will trigger a
webhookto your servers as well redirect the buyer to theredirect_urlyou provided in step 2. -
At this stage, the amount (& fees) is credited against the marketplace account. The marketplace can send all or parts of the amounts to individual sub-merchants using Create a Settlement API by sending type as
CREDIT. -
Once all the redistributions are done, the marketplace marks the payment as fulfilled using Fulfil a Payment API. The remaining balance is considered as marketplace’s commission, which gets paid out to marketplace’s bank account.
Key Points to Note
- Marketplace can credit to their sub-merchants only upto a total of transaction amount (i.e; the amount paid by the buyer).
- Crediting to sub-merchants work only till the payment gets marked as fulfilled. Once payment is marked as fulfilled, the distribution is deemed final.
Refund Flow
- Marketplace can initiate a full / partial refund to the buyer using Create a Refund. This will deduct the amount from the marketplace and send it to the buyer.
- The marketplace can then use the Create a Settlement to deduct from the individual / multiple sub-merchants by sending type as a
DEBIT.
Key Points to Note
- You can debit a sub-merchant only in case of refunds.
- Only sub-merchants that were earlier credited for this payment can be debited by marketplace.
- Marketplace can debit sub-merchants only upto refund amount.
- A sub-merchant can be debited only if they have sufficient balance with Instamojo.
