smallcase Subscriptions via Gateway
User can subscribe to fee-based smallcases via smallcase Gateway. The dedicated subscription widget will help user in subscribing to the smallcase, natively inside your app / website.
Users can subscribe to smallcase by following these steps:
- enter personal details
- complete risk profiling (optional; not for all smallcases)
- select subscription plan of their choice
- confirm agreement (optional; not for all smallcases)
- pay subscription fees
Eligibility for triggering the subscription flow:
- smallcase is fee-based (i.e. it has AuM / flat fee plan)
- user does not have an active subscription in the smallcase (data available in subscriptions details API)
- user never subscribed to a smallcase (
statusโSUBSCRIBED) - user's subscription is in grace period (
status=SUBSCRIBEDANDcancellation.value=true) - user's subscription has ended (
status=UNSUBSCRIBED)
- user never subscribed to a smallcase (
Transactional intents that can trigger subscription flow:
1. intent: TRANSACTION
One of the use-case for this intent is to transact in smallcase (eg - BUY a smallcase).
When a transaction is triggered for a fee-based smallcase, Gateway will internally check for user's subscription status in the smallcase. And if the user is not subscribed, the subscription widget will be automatically shown to the user.
And once user subscribes to the smallcase, they will then continue placing their original order (eg - buying smallcase).
And for subsequent time, if user is already subscribed, normal transaction flow will continue as-is.
For backward compatibility, there is no change in API request and client-side response.
Only on successful order placement, the success response would be shared. Otherwise, the error response will be shared.
2. intent: SUBSCRIPTION
For transactions created with intent: SUBSCRIPTION (exact payload for create transaction API is shared below), a dedicated subscription widget flow will open up.
And on a successful subscription, the transaction will get completed, and the program control will be handed back to the partner.
๐ create transaction API
The API is same as the existing create transaction API. Only request payload is different -
{
intent: "SUBSCRIPTION",
config: {
// either scid or iscid is required
scid: "GATEMO_0001",
// If iscid is passed, use connected users auth token in req. header
iscid: "5f58be2e0ae6715aef0d1518"
}
}The API returns "Invalid Order" for:
- free smallcase's scid (since they cannot be subscribed)
- connected user is already subscribed to the smallcase
Note: If transaction is created with guest auth token, and if user's subscription status comes up as subscribed post-broker login, gateway SDK will return already_subscribed error.
๐ SDK Response
For SUBSCRIPTION intent, following order response is shared in case of successful subscription
{
"smallcaseAuthToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzbWFsbGNhc2VBdXRoSWQiOiI2MTU0MmMwMmVhOWFiMGYyNDc3YzY2NTAiLCJpYXQiOjE2MzI5MDYzNDMsImV4cCI6MTYzMjkwOTk0M30.-C415ww3GKIiPu3xAKA4F3zyq1CRDomIns5wa7_uLi4",
"broker": "kite",
"transactionId": "TRX_224c856f81094911931a516e24500022"
}smallcaseAuthIdof the user can be retrieved by verifying & decodingsmallcaseAuthToken.- the same can then be used to track user's subscription as mentioned below.
Tracking user subscriptions
Gateway's user subscription API can be used to track for subscription status. The API will return subscription status against smallcases they have interacted with subscription flow for.
User can be any of these four subscription states -
- In middle of subscription process - user has not yet completed smallcase subscription process
- Active subscription
- In grace period (subscription about to end)
- Subscription ended
Sample response for each state can be found in same api reference.
FAQs
1. How to know if a smallcase is free or fee-based, and whether we should as user to subscribe to it before transaction?
While TRANSACTION intent takes care of subscription, if partner want to trigger dedicated flow using SUBSCRIPTION intent, they can check for whether smallcase is fee-based using flags.private flag present smallcase details API.
Moreover, you can also check for connected user's subscription status as mentioned in "tracking user subscriptions" section above.
2. What happens if user tries to rebalance after their subscription has ended?
Two scenarios here:
- rebalance was pushed by manager during active subscription: user can still rebalance since the rebalance would be available in user's pending action.
- rebalance was pushed by after subscription ended: user will not get this rebalance pending action, and hence would not be able to create transaction ID.