Callbacks¶
Several Pincode APIs are asynchronous in nature. Eg: order updates post-order placement, are entirely asynchronous, which is also the case for catalog-related APIs. You may choose to subscribe to these updates selectively. Only if callback hooks are registered by a client, they can expect callbacks during the different journeys of the respective API flow.
Registering A Callback Hook¶
Your team is expected to send the following to the Pincode team over email:
- Updates you wish to subscribe to
- Callback Endpoint
- Auth Mode
1. Updates¶
This indicates the list of updates you are interested in, for callbacks. You can mention a subset of the following:
ORDER_UPDATE
STORE_UPDATE
LISTING_UPDATE
2. Callback Endpoint¶
OAuth 2.0 protected endpoint which accepts POST payload (Content-Type: application/x-www-form-urlencoded)
Note
The payloads (explained in the sections below), will contain a type field that will determine what type of callback it is and a requestContext section that will determine the uniqueness.
3. Auth Mode¶
Pincode supports 2 modes of Authentication for callbacks.
-
OAuth 2.0 Mode
OAuth Endpoint (staging and production) - to fetch token before making the callback.
OAuth 2.0 Parameters:client_id
client_secret
grant_type
scope
-
Static Token Mode
Provide the static_token that can be used during the callback.
Note
This mode of static token authentication supported in callbacks, is temporary, and will be deprecated soon.
Prefer using the more robust OAuth 2.0 model explained above.