Api / Marketplace
Enterprise
Integrating an External Application for Enterprise
IMPORTANT: For legibility the ”\” at the end of appropriate line were removed
Creating customer — before they buy for first time
Request
curl -v
-X GET $URL
--header "x-api-key: ${BEARER}"
--header 'Content-Type: application/json'
--data '{
"method":"createCustomer",
"params": {
"id":"ABC",
"name":"ABC Company",
"admin": {
"email":"test3@example.com",
"phone":"111111111",
"displayName": "Isa Aswath"
}
}
}'
Notes
- You send us your internal id (“ABC”) and we return it as “remoteId” in response.
- You can safely ignore “id” in the returned body, this is our internal primary key in the customers table.
Response
STATUS: 200
BODY:
{
"name":"ABC Company",
"partner": "kjljglsdfj1",
"createdAt":1684313717,
"id":"agdsdfa1dafg1",
"isActive":true,
"admin":{"email":"test3@example.com"},
"remoteId":"ABC",
"url":"https://server.com/onboardingurl"
}
How orders work
Let’s talk about Customer ABC, which has 100 employees as of June 1st
1. Simple process
No changes in employees, here is a typical order process
- Customer ABC wishes to start using OneOffice, starting from June 1 —> create order for 100 licenses from June 1 to July 1st
- Customer ABC renews 100 licenses on July 1st for another month —> create order for 100 licenses from July 1 to August 1st
- … keeps creating monthly orders of 100 licenses
2. Employees leave
Let’s say 10 employees leave on June 15th. Licenses are non-refundable, so they are ‘wasting’ 15 days (June 15th till July 1st). Here is a typical order process
- Customer ABC wishes to start using OneOffice, starting from June 1 —> create order for 100 licenses from June 1 to July 1st
- Customer ABC renews 90 licenses on July 1st for another month —> create order for 90 licenses from July 1 to August 1st
- … keeps creating monthly orders of 90 licenses
3. Employees join
Let’s say 10 employees join on June 15th.
- Customer ABC wishes to start using OneOffice, starting from June 1 —> create order for 100 licenses from June 1 to July 1st
- Customer ABC wishes to add 10 licenses on June 15th OneOffice —> create order for 15 licenses from June 15th to July 15th
- Customer ABC renews 100 licenses on July 1st for another month —> create order for 100 licenses from July 1 to August 1st
- Customer ABC renews 10 licenses on July 15th for another month —> create order for 15 licenses from July 15th to August 15th
- … keeps creating monthly orders of 100 and 15 licenses etc
If your marketplace supports partial duration, you can issue order #2 from June 15th to July 1st, and on July 1st onwards create orders for 110 licenses every month
Creating order
There are 3 ways to create an order based on your marketplace design. All three types are listed below.
1. Simple order
Here, the licenses become valid the moment the order is created
curl -v
-X GET $URL
--header "x-api-key: ${BEARER}"
--header 'Content-Type: application/json'
--data '{
"method":"createOrder",
"params": {
"customer":"ABC",
"id":"REMOTEORDER1",
"product":"oo-lite",
"licenses":20,
"duration":"monthly"
}
}'
Notes
- “customer” the id you sent us in the “createCustomer” request
- “id” is the order in your tables — in the case of the first order, this is the parent order, you will send that in subsequent requests
- “products” can be any of oo-lite, oo-std, oo-ent, erp-std, erp-admin, erp-lim
- “duration” can be any of monthly or yearly
Response
Note that all dates are in unix epoch
{
"id": "qjol39FON7uelq17IRlT",
"customer": "0EmPZlaCHpCiB2Mt3xGo",
"instance": null,
"product": "oo-lite",
"licenses": 20,
"duration": "monthly",
"count": 1,
"createdAt": 1781759295,
"startsAt": 1781759295,
"expiresAt": 1784351295,
"remoteId": "REMOTEORDER1"
}
2. Controlled start date
Note that all dates are in unix epoch
curl -v
-X GET $URL
--header "x-api-key: ${BEARER}"
--header 'Content-Type: application/json'
--data '{
"method":"createOrder",
"params": {
"customer":"ABC",
"id":"REMOTEORDER1",
"product":"oo-lite",
"licenses":20,
"duration":"monthly",
"startsAt": 1781759295
}
}'
3. Partial orders
Note that all dates are in unix epoch
curl -v
-X GET $URL
--header "x-api-key: ${BEARER}"
--header 'Content-Type: application/json'
--data '{
"method":"createOrder",
"params": {
"customer":"ABC",
"id":"REMOTEORDER1",
"product":"oo-lite",
"licenses":20,
"startsAt": 1781759295,
"expiresAt": 1784351295
}
}'
Cancelling orders
A cancelled order typically applies when a customer made a mistake (e.g. they purchased 90 licenses but actually wanted 100)
Request
curl -v
-X GET $URL
--header "x-api-key: ${BEARER}"
--header 'Content-Type: application/json'
--data '{
"method":"cancelOrder",
"params":{
"id":"REMOTEORDER1"
}
}'
Suspending / unsuspending orders
A suspended order typically occurs when faced with payment delays
Request
curl -v
-X GET $URL
--header "x-api-key: ${BEARER}"
--header 'Content-Type: application/json'
--data '{
"method":"suspendOrder",
"params":{
"id":"REMOTEORDER1"
}
}'
curl -v
-X GET $URL
--header "x-api-key: ${BEARER}"
--header 'Content-Type: application/json'
--data '{
"method":"unsuspendOrder",
"params":{
"id":"REMOTEORDER1"
}
}' Have questions?
Still have questions? Talk to support.
All content copyright OneOffice / ZeGenie Inc. -- Unauthorized use is prohibited.