Create, Upgrade and Downgrade Deputy Embedded Accounts
Provisioning a Deputy Account
The first step in the provisioning flow is to create a Deputy business. A Deputy business is designed to match one account on the partner system. Multiple locations can be created under a Deputy business.
To create a business, submit a post request to the signup endpoint
Bearer Token
You will need to pass in a bearer token (created here https://developer.deputy.com/deputy-docs/docs/provisioning-api-security-overview) in order to access all of these provisioning APIs.
URL
curl POST https://api.usw2.deputy.com/connect/v1/partner/{partnername}/signup
{partnername} is the name we assign to the partner's embedded integration.
Sample Request Payload
{
"userData": {
"firstName": "Deputy",
"lastName": "User",
"email": "[email protected]",
"mobileNumber": "+61 00000000"
},
"businessData": {
"externalId": "Biz1",
"estimatedEmployeeCount": "15",
"portfolioName": "Calvins Coffee",
"countryCode": "AU",
}
}
Data Elements
userData
Data Element | Mandatory | Info |
---|---|---|
firstName | Yes | The first name of the user creating a Deputy Trial. |
lastName | Yes | The last name of the user creating a Deputy Trial. |
Yes | The email address of a user creating a Deputy trial. For Embedded customers, this account must be new to Deputy otherwise an error will be thrown. | |
mobileNumber | No | The mobile number of the user signing up to Deputy. This needs to be a valid mobile number otherwise an error will be thrown. |
businessData
Data Element | Mandatory | Info |
---|---|---|
externalId | Yes | A partner provided external ID. We store this internally to create a mapping between the Deputy embedded account and the user's account on the partner's app. This is freetext and must be unique. |
estimatedEmployeeCount | No | An integer representing the estimated number of customers that will be onboarded into Deputy. Value must be greater than 0. |
portfolioName | Yes | The business name shows internally in several places in the product. |
countryCode | No | A string representing a valid two-letter country code. A default value ("US") is provided when this is omitted. |
This will create a Deputy Premium trial which lasts 30 days. An account must be converted within these 30 days via a call to our conversion endpoint.
Geolocation
The Deputy business will be created in the root region of the API call. Our current provisioning API runs in the US region only (https://api.usw2.deputy.com) , however UK ( https://api.euw2.deputy.com) and AU (https://api.apse2.deputy.com) are in development.
Response
The response from this endpoint will detail the following fields
{
"success": true,
"data": {
"hostname": "biz.na.deputy.com",
"portfolioName": "Calvins Coffee",
"status": "ACTIVE",
"edition": "SUBSCRIPTION_PRO_TRIAL",
"trialEndDate": "2023-05-13T00:00:00.000Z",
"conversionDate": "",
"externalId": "Biz1"
},
"error": null
}
Data Elements Returned
Data Element | Info |
---|---|
hostname | The URL of the created Deputy account. |
portfolioName | The portfolio name provided in the request |
status | Always ACTIVE , indicating an Active Deputy installation. |
edition | Always SUBSCRIPTION_PRO_TRIAL , indicating a Deputy trial for a Premium monthly subscription |
trialEndDate | Date the Deputy accounts trial ends. The account should be converted before this date. |
conversionDate | Always empty |
externalId | The external ID provided in the request |
Converting or Cancelling a Deputy Account
To convert an account to a premium Deputy subscription OR cancel a Deputy subscription, a POST request needs to be made to the change-plan
endpoint.
URL
curl POST https://api.usw2.deputy.com/connect/v1/partner/{partnername}/change-plan
Business Address Requirements
If you're converting an account in the US, extra data containing the billing address of the business is required for compliance reasons.
Sample Request Payload to Convert
{
"data" : {
"hostname": "biz.na.deputy.com",
"action": "upgrade",
"address": {
"address1": "123 Elm Street",
"suburb": "Manhattan",
"state": "NY",
"postcode": "12345",
"country": "US"
}
}
}
Sample Request Payload to Cancel
{
"data" : {
"hostname": "biz.na.deputy.com",
"action": "cancel"
}
}
Data Elements
Data
Data Element | Mandatory | Info |
---|---|---|
hostname | Yes | A valid hostname, returned as part of the provisioning endpoint. |
action | Yes | Either upgrade or cancel |
Address
Data Element | Mandatory | Info |
---|---|---|
address1 | No | A valid street address. |
suburb | No | City or suburb |
state | No | State to which the address belongs to |
postcode | No | Postal code of the address |
country | No | Country to which the address belongs to |
The response from this endpoint will detail the following fields
{
"success": true,
"data": {
"hostname": "biz.na.deputy.com",
"trialEndDate": "2023-05-14T00:00:00+00:00",
"edition": "SUBSCRIPTION_PAID_PRO_PREMIUM"
},
"error": null
}
Data Elements Returned
Info
Data Element | Info |
---|---|
hostname | The URL of the created Deputy account. |
trialEndDate | The date that the trial ends. If converting before the end date of the trial, the day after the end of trial will constitute the start of billing. |
edition | The edition the account has been converted to. |
Note An error will be thrown if you try to upgrade an account that is already Premium, or cancel an account that is on trial or expired.
Status Check on a Deputy Business
To retrieve subscription information related to a Deputy business, a post request can be made to the Status Check endpoint
URL
curl POST https://api.usw2.deputy.com/connect/v1/partner/{partnername}/subscription-status
Sample Payload
{
"hostname": "biz.na.deputy.com"
}
Data elements
Data Element | Mandatory | Info |
---|---|---|
hostname | Yes | A valid hostname, returned as part of the provisioning endpoint. |
Response
Given a hostname that is linked to the partner making the request, the endpoint will return
{
"success": true,
"data": {
"status": "ACTIVE",
"hostname": "biz.na.deputy.com",
"portfolioName": "Calvins Coffee",
"edition": "SUBSCRIPTION_FREE",
"trialEndDate": "2023-05-05T00:00:00.000Z",
"conversionDate": ""
},
"error": null
}
Note on Embedded Subscription Editions
Deputy embedded accounts have three editions:
- SUBSCRIPTION_PRO_TRIAL - The account is in a trial state. The trial will expire at the date listed in the
trialEndDate
field. Trials should be converted before this date. - SUBSCRIPTION_FREE - a Premium account has been cancelled, or a trial has expired.
SUBSCRIPTION_FREE
accounts may be converted intoSUBSCRIPTION_PAID_PRO_PREMIUM
accounts via calling our change plan endpoint. While in aSUBSCRIPTION_FREE
state, these accounts may be deleted by Deputy, especially if the account has low users and has been dormant. For this reason, it's recommended to convert before the account enters this state, or soon after. - SUBSCRIPTION_PAID_PRO_PREMIUM - a paid, converted Deputy account.
Updated 3 months ago