Installation and activation readiness
In this guide you will learn:
- Implement extension installation and Oauth
- Collect merchant payment gateway credentials
- Activate payment extension in an application
Implement Extension Installation and OAuth
Below diagram explains how extension installation and Oauth works. Follow the steps explained in implement-oauth guide to let merchants install and launch your extension in their platform panel.
- A new merchant installs or an existing merchant opens your payment extension.
install/open
request: In case of both install/open, Fynd Platform calls your extension in iframe on{Extension URL}/fp/install
endpoint. Know more.- Creates OAuth handshake URL and redirects to it.
- Add a condition: If you receive
application_id
ininstall/open
request, make sure to add it as query parameter inredirect_url
parameter ofOAuth handshake URL
. This would help your extension to identify theapplication_id
inAuth callback
request in step 7.
- Add a condition: If you receive
- Fynd Platform checks the extension is already installed. If extension is not already installed then it executes steps 5 and 6.
- Fynd Platform shows OAuth handshake page to merchant and ask for installation approval.
- Merchant accepts installation request.
- Auth callback request: Fynd Platform redirects the client to
redirect_url
provided by extension inOAuth handshake URL
with one timeauthorization_code
. - Extension checks whether it already has active offline access_token for the
company_id
. If no, extension requests anoffline access_token
usingauthorization_code
. - Fynd Platforms respond with
offline access_token
, expiration details andrefresh_token
. - Extension saves the
access_token
and makes sure it updates it usingrefresh_token
before expiration.access_token
is unique for eachcompany_id
and can be used to call Platform API for that company.
In case, your extension fails to update access_token
before expiration, it can request offline access_token
when merchant opens the extension next time as explained in step 8.
- Extension redirects the client to its home page for the merchant's
company_id
andapplication_id
.
Collect Seller Payment Gateway Credentials
After completing the OAuth, Extension redirects the client to its home page for the merchant's company_id
and application_id
. Extension is supposed to collect merchant's payment gateway credentials on this page and upon successfully collecting and validating the credentials, show a success message to the merchant. The credentials should be stored at company_id
* application_id
as merchant may have different credentials for different applications within the company.
Activate Payment Extension
When merchant opens the payment settings of an application within the company, Fynd Platform calls getActivationReadiness API of extension to check whether it has collected and saved valid payment gateway credentials for that application_id
. Upon receiving success response from extension, Fynd Platform change the status from Available for Activation
to Inactive
and allows merchant to activate the extension for the application. Once the merchant activates the extension for the application, its status changes to Active
.