GuideAPI documentationCommunityApplications
Contact us
Introduction
Authentication
Using the API
Guides
Activation flow Journal entries Supplier invoices Customers Contacts Products Orders Invoices Invoice sales Status and Approval Flows Inviting and Administrating Users
Payroll
Legal
Guides Activation flow

Activation flow

When a customer activates a product in Unimicro, the platform creates a purchase entry for that product.

The initial purchase status is configured per product and can be either:

  • Accepted – the product becomes active immediately, or
  • Pending – the provider must review/approve the customer before the product is fully activated.

This article focuses on the Pending flow, where the external provider is responsible for completing onboarding and then updating the purchase status using the API.

Scope
Product activation from marketplace is only possible for server integrations, but the product status endpoints are useful for all integrations.

Activation Flow Overview (Pending-on-activation)

When a product is configured to start in Pending, the activation lifecycle looks like this:

  1. Customer activates the product in Marketplace
    • A purchase record is created with status Pending.
    • Unimicro sends a PurchaseEvent to the provider’s configured Product Activation Endpoint.
  2. Provider validates and prepares onboarding
    • Use the CompanyKey and ApiBaseUrl from the event to call Unimicro APIs.
    • Retrieve company settings or accounting data as needed.
    • Complete any setup or checks in the external system.
  3. Provider updates purchase status
    • When onboarding is complete, the provider calls the Product Status Update Endpoint to set the purchase to:
      • Active – customer is approved and product is ready to use
      • Pending – keep waiting (e.g. manual review still ongoing)
      • Canceled – provider rejects the activation

Only purchases with Active status are considered fully enabled for the customer.

If your product is configured with Accepted as default purchase status, it will be active immediately on activation.
In that case, the Product Status Update Endpoint is mainly useful later, for changing status to Pending or Canceled if you need to suspend or reject a customer after the fact.

Product Activation Event

When a customer activates the product (for example from Marketplace), Unimicro sends a POST request to your configured Product Activation Endpoint.

The payload is a generic event envelope. The Entity property contains the activation details:

PurchaseEvent
{
  "EventType": "Update",
  "EntityName": "PurchaseEvent",
  "Entity": {
    "PurchaseEventType": 1010,
    "ProductId": 49,
    "CompanyName": "Testserver selskap",
    "OrganizationNumber": "959415900",
    "Email": "",
    "Platform": "unimicro",
    "ApiBaseUrl": "https://test-api.unimicro.no/",
    "CompanyKey": "eda508bc-cab4-4697-aeb8-8b5688389fe6",
    "ID": 2931
  },
  "EntityID": 2931,
  "MessageID": "170987-1",
  "SessionID": "bb8f7d6c-c900-4d01-aab0-ed786fcafe9f",
  "TimeStamp": "2021-08-27T07:00:12.51414Z",
  "Reason": "/api/elsa/purchases"
}

Key fields

FieldDescription
ProductIdProduct identifier in the platform.
CompanyKeyMust be included as CompanyKey header in all API requests.
ApiBaseUrlBase URL for the company’s environment (test or production).
PurchaseEventTypeIndicates the purchase event (for example 1010 = OnPending).
EmailUser that initiated the purchase

Updating Purchase Status

External providers update the purchase status using the Product Status Update Endpoint.

This is required when you use the Pending flow, and optional but available when your product defaults to Accepted and you later need to suspend or cancel a customer.

Endpoint

  • Method:PUT
  • Body:null
  • Path parameter: {productId} – your product’s ID from Dev Portal
  • Query parameter:action – one of:
    • set-as-active
    • set-as-pending
    • set-as-canceled

✏ : ProductId can be different in production and test environments. If you are unsure, contact our integration admins.

Endpoints

EndpointDescription
api/elsa/purchases/{productId}?action=set-as-activeSet purchase status to Active
api/elsa/purchases/{productId}?action=set-as-pendingSet purchase status to Pending
api/elsa/purchases/{productId}?action=set-as-canceledSet purchase status to Canceled

Examples

Set purchase to Active

PUT https://test.unimicro.no/api/elsa/purchases/49?action=set-as-active Authorization: Bearer {access_token} CompanyKey: {company_key} Content-Length: 0

Set purchase to Pending

PUT https://test.unimicro.no/api/elsa/purchases/49?action=set-as-pending Authorization: Bearer {access_token} CompanyKey: {company_key} Content-Length: 0

Set purchase to Canceled

PUT https://test.unimicro.no/api/elsa/purchases/49?action=set-as-canceled Authorization: Bearer {access_token} CompanyKey: {company_key} Content-Length: 0

Purchase Event Types

When the purchase status changes, Unimicro generates an event with the corresponding type:

Enum ValueInteger ValueDescription
OnPending1010Purchase was set to Pending
OnActive1020Purchase was set to Active
OnDeactivate1030Provider rejected / deactivated the purchase
OnCancel1040Customer manually canceled the purchase