Skip to content

Place a termination order

This guide describes how to place a termination order step by step.

The examples in this guide are meant to be used as a reference. The UUIDs and dates are not real and should be replaced with real data. The illustrations are for visual representation only and do not match the data used to explain the endpoints.

Step 1 - Retrieve the order draft id

GET ​/v1​/profile​/order-drafts

Swagger documentation here: Get profile order drafts

Response:

```json
{
    "order_draft_id":"a474ad23-e9d0-4ea7-8562-e13fd0826583"
}
```

Step 2 - Update the draft with the end customer account

PATCH ​/v1​/order-drafts​/{orderDraftId}

Swagger documentation here: Update the order draft

Payload:

```json
[
  {
    "op":"add",
    "path":"/order-on-account",
    "value":"08684e47-9d25-4dc7-9d00-d288b1861ba9"
  }
]
```

Properties

Option      | Type   | Description
----------- | ------ | ------------
`operation` | string | Operation to be performed. In this case "add"
`path`      | string | Path to the property to be updated. In this case "/order-on-account"
`order_account_id` | UUID | UUID of the end customer account.

Step 3 - Adds a termination to the draft

PATCH ​/v1​/order-drafts​/{orderDraftId}

Swagger documentation here: Update the order draft

This will set the selected subscription(s) to the draft.

Payload:

```json
[
  {
    "op":"add",
    "path":"/terminates",
    "value":
      {
        "reference":"test",
        "subscription_id":"08684e47-9d25-4dc7-9d00-d288b1861ba9"
        "wish_date":"2024-05-16",
      }
  }
]
```

Properties

Option      | Type   | Description
----------- | ------ | ------------
`operation` | string | Operation to be performed. In this case "add"
`path`      | string | Path to the property to be updated. In this case "/order-on-account"
`subscription_id` | UUID | UUID of the selected subscription.
`reference` | string | Reference of the order.
`wish_date` | date(YYY-mm-dd) | Date the subscription is wished to be terminated.

Terminate subscription

Step 4 - Execute dry-run to validate the draft

POST ​/v1​/accounts​/{accountId}​/orders?order_draft_id={orderDraftId}&dry_run=true

Swagger documentation here: Post an order with dry_run

Query Parameters:

Parameter      | Required   | Type    | Description
----------- | ------ | ---------- |------------
`accountId` | required | UUID | UUID of the account
`orderDraftId` | required | UUID | UUID of the draft

Step 5 - Place the order

Finally, it is all settled to successfully submit the order. The order can handle multiple subscriptions. All the subscriptions in the order will be delivered on the same date (the date set for the order).

POST ​/v1​/accounts​/{accountId}​/orders?order_draft_id={orderDraftId}

Swagger documentation here: Post an order

Query Parameters:

Parameter      | Required   | Type    | Description
----------- | ------ | ---------- |------------
`accountId` | required | UUID | UUID of the account
`orderDraftId` | required | UUID | UUID of the draft