SDK reference

Billing and data export

Each route's function in the SDK, its call beside the same request in cURL.
orgBilling

GET/v1/orgs/:orgId/billing

The organization's Cactive One subscription: plan, status, seats, trial and period ends, the card's brand and last four digits, billing details, whether it's subsidised and whether its apps can be used now (access), the plans it can choose, the retention period and the seats a subscription would bill now. tenant:read; answers even when the organization's access has ended.

Parameters and answers
curl 'https://api.cactive.com.au/v1/orgs/{orgId}/billing' \
  -H "Authorization: Bearer $CACTIVE_TOKEN"
postOrgBillingCheckout

POST/v1/orgs/:orgId/billing/checkout

Starts a checkout on the payment page (payments.<host>) and answers its url, checkoutId and openUntil. kind: subscribe (a business plan, planId, and interval: two-year by default, year or month; the plan's trial applies once per organization; 409 when there's already a subscription), card (replace the card) or invoice (pay an open invoice, invoiceId). returnUrl must be on Tenant's host (400 otherwise); the page sends the person back there with ?checkout=<id>&status=complete or canceled. Owners and administrators (tenant:write); 429 past 20 checkouts an hour.

Parameters and answers
curl -X POST 'https://api.cactive.com.au/v1/orgs/{orgId}/billing/checkout' \
  -H "Authorization: Bearer $CACTIVE_TOKEN" \
  -H 'Content-Type: application/json' \
  -d '{
    "kind": "subscribe",
    "returnUrl": "https://example.com"
  }'
postOrgBillingPlan

POST/v1/orgs/:orgId/billing/plan

Moves the subscription to another plan (planId) or billing period (interval: two-year, year or month) now. Within the same period the difference is prorated onto the next invoice; a new period starts today and is charged now, less the unused part of the current one (402 when declined; nothing changes). Nothing is charged during a trial.

Parameters and answers
curl -X POST 'https://api.cactive.com.au/v1/orgs/{orgId}/billing/plan' \
  -H "Authorization: Bearer $CACTIVE_TOKEN" \
  -H 'Content-Type: application/json' \
  -d '{
    "planId": "<planId>",
    "interval": "two-year"
  }'
patchOrgBillingDetails

PATCH/v1/orgs/:orgId/billing/details

Sets who invoices are addressed and emailed to and the ABN shown on tax invoices (taxId: null removes it).

Parameters and answers
curl -X PATCH 'https://api.cactive.com.au/v1/orgs/{orgId}/billing/details' \
  -H "Authorization: Bearer $CACTIVE_TOKEN" \
  -H 'Content-Type: application/json' \
  -d '{
    "taxId": {}
  }'
postOrgBillingCancel

POST/v1/orgs/:orgId/billing/cancel

Cancels now: the organization's apps close at once (billing, exports and administration stay), nothing more is charged and the period already paid isn't refunded. The data is kept for the retention period (retainUntil), for export or resubscribing.

Parameters and answers
curl -X POST 'https://api.cactive.com.au/v1/orgs/{orgId}/billing/cancel' \
  -H "Authorization: Bearer $CACTIVE_TOKEN"
postOrgBillingCodePreview

POST/v1/orgs/:orgId/billing/code/preview

What a promotion code (code) would do to the running subscription, before adding it: checked (active, not expired, redemptions left, the plans, billing periods and buyer it's for, first payment only, a minimum order), then priced: each charge before and after, how many are discounted, when it ends, and the next invoice as the payment provider works it out. 400 says why a code can't be used; 429 past billing.promoChecksPerHour codes an hour.

Parameters and answers
curl -X POST 'https://api.cactive.com.au/v1/orgs/{orgId}/billing/code/preview' \
  -H "Authorization: Bearer $CACTIVE_TOKEN" \
  -H 'Content-Type: application/json' \
  -d '{
    "code": "example"
  }'
postOrgBillingCode

POST/v1/orgs/:orgId/billing/code

Adds a promotion code to the running subscription, in place of any discount it had, from its next invoice. Answers the billing overview with account.discount. tenant:write; in the audit log.

Parameters and answers
curl -X POST 'https://api.cactive.com.au/v1/orgs/{orgId}/billing/code' \
  -H "Authorization: Bearer $CACTIVE_TOKEN" \
  -H 'Content-Type: application/json' \
  -d '{
    "code": "example"
  }'
deleteOrgBillingCode

DELETE/v1/orgs/:orgId/billing/code

Takes the promotion code off the subscription: its next invoices are at the full price. In the audit log.

Parameters and answers
curl -X DELETE 'https://api.cactive.com.au/v1/orgs/{orgId}/billing/code' \
  -H "Authorization: Bearer $CACTIVE_TOKEN"
orgBillingInvoices

GET/v1/orgs/:orgId/billing/invoices

The organization's invoices, newest first, with totals and the GST included.

Parameters and answers
curl 'https://api.cactive.com.au/v1/orgs/{orgId}/billing/invoices' \
  -H "Authorization: Bearer $CACTIVE_TOKEN"
orgBillingInvoicesByInvoiceId

GET/v1/orgs/:orgId/billing/invoices/:invoiceId

One tax invoice: lines, total, GST included, the buyer's details as issued and the supplier's name and ABN.

Parameters and answers
curl 'https://api.cactive.com.au/v1/orgs/{orgId}/billing/invoices/{invoiceId}' \
  -H "Authorization: Bearer $CACTIVE_TOKEN"
orgExports

GET/v1/orgs/:orgId/exports

Recent exports with their progress and, once ready, each ZIP's download link (a day).

Parameters and answers
curl 'https://api.cactive.com.au/v1/orgs/{orgId}/exports' \
  -H "Authorization: Bearer $CACTIVE_TOKEN"
postOrgExports

POST/v1/orgs/:orgId/exports

Starts a full export of the organization's data: every app's records as JSON and CSV, mail as.eml, calendars as.ics, contacts as.vcf, and its Drive files, as ZIPs kept a day with a README of what's in them. One at a time per organization (409 otherwise). Owners and administrators; works after the subscription ends.

Parameters and answers
curl -X POST 'https://api.cactive.com.au/v1/orgs/{orgId}/exports' \
  -H "Authorization: Bearer $CACTIVE_TOKEN"
orgExportsByExportId

GET/v1/orgs/:orgId/exports/:exportId

One export: its progress, what each app contributed and its ZIPs' download links.

Parameters and answers
curl 'https://api.cactive.com.au/v1/orgs/{orgId}/exports/{exportId}' \
  -H "Authorization: Bearer $CACTIVE_TOKEN"
meBilling

GET/v1/me/billing

Your Cactive One Personal plan (storage for Drive and Photos), its status and card, and the personal plans you can choose. Free unless you subscribe.

Parameters and answers
curl 'https://api.cactive.com.au/v1/me/billing' \
  -H "Authorization: Bearer $CACTIVE_TOKEN"
postMeBillingJoinedByOrgId

POST/v1/me/billing/joined/:orgId

The person just joined this organisation (on the web: an invite, a join code): its billed seats follow at once, as they do when Tenant or the phone adds someone (seatsChanged), rather than at the nightly reconcile. Only for a member now.

Parameters and answers
curl -X POST 'https://api.cactive.com.au/v1/me/billing/joined/{orgId}' \
  -H "Authorization: Bearer $CACTIVE_TOKEN"
postMeBillingCheckout

POST/v1/me/billing/checkout

Starts a checkout on the payment page for your own plan (Pro and Max start with a 14-day trial, once), your card or an open invoice, as for an organization. returnUrl must be on your account's host.

Parameters and answers
curl -X POST 'https://api.cactive.com.au/v1/me/billing/checkout' \
  -H "Authorization: Bearer $CACTIVE_TOKEN" \
  -H 'Content-Type: application/json' \
  -d '{
    "kind": "subscribe",
    "returnUrl": "https://example.com"
  }'
postMeBillingPlan

POST/v1/me/billing/plan

Moves your personal plan to another tier or billing period, as for an organization.

Parameters and answers
curl -X POST 'https://api.cactive.com.au/v1/me/billing/plan' \
  -H "Authorization: Bearer $CACTIVE_TOKEN" \
  -H 'Content-Type: application/json' \
  -d '{
    "planId": "<planId>",
    "interval": "two-year"
  }'
patchMeBillingDetails

PATCH/v1/me/billing/details

Sets the name and email on your invoices.

Parameters and answers
curl -X PATCH 'https://api.cactive.com.au/v1/me/billing/details' \
  -H "Authorization: Bearer $CACTIVE_TOKEN" \
  -H 'Content-Type: application/json' \
  -d '{
    "taxId": {}
  }'
postMeBillingCancel

POST/v1/me/billing/cancel

Cancels your personal plan now: storage returns to the free allowance (your files stay; over it you can view and download but not add).

Parameters and answers
curl -X POST 'https://api.cactive.com.au/v1/me/billing/cancel' \
  -H "Authorization: Bearer $CACTIVE_TOKEN"
postMeBillingCodePreview

POST/v1/me/billing/code/preview

What a promotion code (code) would do to your plan, before adding it, as for an organization.

Parameters and answers
curl -X POST 'https://api.cactive.com.au/v1/me/billing/code/preview' \
  -H "Authorization: Bearer $CACTIVE_TOKEN" \
  -H 'Content-Type: application/json' \
  -d '{
    "code": "example"
  }'
postMeBillingCode

POST/v1/me/billing/code

Adds a promotion code to your plan, from its next invoice.

Parameters and answers
curl -X POST 'https://api.cactive.com.au/v1/me/billing/code' \
  -H "Authorization: Bearer $CACTIVE_TOKEN" \
  -H 'Content-Type: application/json' \
  -d '{
    "code": "example"
  }'
deleteMeBillingCode

DELETE/v1/me/billing/code

Takes the promotion code off your plan.

Parameters and answers
curl -X DELETE 'https://api.cactive.com.au/v1/me/billing/code' \
  -H "Authorization: Bearer $CACTIVE_TOKEN"
meBillingInvoices

GET/v1/me/billing/invoices

Your personal plan's invoices.

Parameters and answers
curl 'https://api.cactive.com.au/v1/me/billing/invoices' \
  -H "Authorization: Bearer $CACTIVE_TOKEN"
meBillingInvoicesByInvoiceId

GET/v1/me/billing/invoices/:invoiceId

One of your tax invoices.

Parameters and answers
curl 'https://api.cactive.com.au/v1/me/billing/invoices/{invoiceId}' \
  -H "Authorization: Bearer $CACTIVE_TOKEN"
meCheckoutsByCheckoutId

GET/v1/me/checkouts/:checkoutId

A checkout you started, as the payment page shows it: what's being bought, priced from plan data (the plan, the interval and the intervals it can switch to, seats, the amount, GST, what's due today, the trial), or the invoice; your billing details; the publishable key for the card fields; the way back; and once done, the outcome and the receipt. Anyone else gets 404.

Parameters and answers
curl 'https://api.cactive.com.au/v1/me/checkouts/{checkoutId}' \
  -H "Authorization: Bearer $CACTIVE_TOKEN"
postMeCheckoutsStart

POST/v1/me/checkouts/:checkoutId/start

Before the card: sets the billing period (interval, one of the plan's) and billing details (billingName, billingEmail, taxId, billingAddress from the address form, for tax invoices), checks the checkout's promotion code again, and answers a setup intent's client secret for Stripe's card fields (cards only). Each call is a card attempt: 429 past 5 on one checkout or 15 an hour; 410 once it has expired (an hour after it started).

Parameters and answers
curl -X POST 'https://api.cactive.com.au/v1/me/checkouts/{checkoutId}/start' \
  -H "Authorization: Bearer $CACTIVE_TOKEN" \
  -H 'Content-Type: application/json' \
  -d '{
    "interval": "two-year",
    "billingName": "Example",
    "billingEmail": "person@example.com"
  }'
postMeCheckoutsCode

POST/v1/me/checkouts/:checkoutId/code

"Have a code?": checks a promotion code (code) for this checkout's plan, interval (the one shown; it becomes the checkout's) and seats and the buyer, prices it, and keeps it on the checkout, which redeems it when the subscription is made. Answers the checkout with promotion (the discount, each charge before and after, how many are discounted, what's due today). code: null takes it off. 400 says why a code can't be used; 429 past billing.promoChecksPerHour codes an hour.

Parameters and answers
curl -X POST 'https://api.cactive.com.au/v1/me/checkouts/{checkoutId}/code' \
  -H "Authorization: Bearer $CACTIVE_TOKEN" \
  -H 'Content-Type: application/json' \
  -d '{
    "code": "example"
  }'
postMeCheckoutsComplete

POST/v1/me/checkouts/:checkoutId/complete

With the card confirmed (setupIntentId, the one start made): subscribes, replaces the card or pays the invoice. Answers the checkout (complete, or failed with the bank's message) and, when the bank wants the payment confirmed (3-D Secure), action.clientSecret for the browser; then confirm. An organization's checkout needs tenant:write there.

Parameters and answers
curl -X POST 'https://api.cactive.com.au/v1/me/checkouts/{checkoutId}/complete' \
  -H "Authorization: Bearer $CACTIVE_TOKEN" \
  -H 'Content-Type: application/json' \
  -d '{
    "setupIntentId": "<setupIntentId>"
  }'
postMeCheckoutsConfirm

POST/v1/me/checkouts/:checkoutId/confirm

After the bank's confirmation in the browser: the payment as the provider now has it, and the checkout complete or failed.

Parameters and answers
curl -X POST 'https://api.cactive.com.au/v1/me/checkouts/{checkoutId}/confirm' \
  -H "Authorization: Bearer $CACTIVE_TOKEN" \
  -H 'Content-Type: application/json' \
  -d '{
    "localApproval": true
  }'
postMeCheckoutsCancel

POST/v1/me/checkouts/:checkoutId/cancel

Closes a checkout that isn't complete and answers where to go back to (status=canceled).

Parameters and answers
curl -X POST 'https://api.cactive.com.au/v1/me/checkouts/{checkoutId}/cancel' \
  -H "Authorization: Bearer $CACTIVE_TOKEN"
addonsSubscriptionRemove

DELETE/v1/orgs/:orgId/billing/addons/:addonId

Remove an add-on

Parameters and answers
curl -X DELETE 'https://api.cactive.com.au/v1/orgs/{orgId}/billing/addons/{addonId}' \
  -H "Authorization: Bearer $CACTIVE_TOKEN"