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.
Activation Flow Overview (Pending-on-activation)
When a product is configured to start in Pending, the activation lifecycle looks like this:
- 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.
- 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.
- 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
- When onboarding is complete, the provider calls the Product Status Update Endpoint to set the purchase to:
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:
{
"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
| Field | Description |
|---|---|
| ProductId | Product identifier in the platform. |
| CompanyKey | Must be included as CompanyKey header in all API requests. |
| ApiBaseUrl | Base URL for the company’s environment (test or production). |
| PurchaseEventType | Indicates the purchase event (for example 1010 = OnPending). |
| User 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
| Endpoint | Description |
|---|---|
| api/elsa/purchases/{productId}?action=set-as-active | Set purchase status to Active |
| api/elsa/purchases/{productId}?action=set-as-pending | Set purchase status to Pending |
| api/elsa/purchases/{productId}?action=set-as-canceled | Set 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 Value | Integer Value | Description |
|---|---|---|
| OnPending | 1010 | Purchase was set to Pending |
| OnActive | 1020 | Purchase was set to Active |
| OnDeactivate | 1030 | Provider rejected / deactivated the purchase |
| OnCancel | 1040 | Customer manually canceled the purchase |