Apologies for what must be an obvious question, but I cannot seem to find the answer anywhere.
I'm in the process integrating my app to the Xero App Store and I'm looking to link Subscriptions to Users.
The API reference for Subscriptions (https://developer.xero.com/documentation/api/xero-app-store/subscriptions) does not show that a UserId
is included in the Subscription object.
The only linkage I can find seems to be when a user purchases a subscription through the Xero App Store, the user will be redirected to the application with the Subscription Id as a parameter:
When a plan is successfully purchased, the user is redirected back to the “after subscribe URL you provided Xero App Store set-up. The Xero App Store appends the subscription Id to this URL so you can immediately determine which plan the user has subscribed to through the subscriptions API.(https://developer.xero.com/documentation/xero-app-store/app-partner-guides/xero-app-store-subscriptions-technical-guide/#purchasing-flow).
What if the user closes their browser before the request completes?
If there is no reference to the User through the Subscription, how do I link the User to the Subscription when I receive the webhook notification of the Subscription creation?
Update
Thinking about this further, it looks like subscriptions are, by default, tenant-based rather than user-based (aligned to the Xero model of subscriptions by tenant, not by user). But confirmation of my understanding would be useful. Thanks.
You will also receive a subscription created webhook, so in the event that the user closes their browser, you will still be able to provision the user with access to a paid subscription.
The Xero Subscription API reference has all the details of the subscription.