# Buy a certificate

> Buy a certificate. This is the step that debits your balance and starts the 7-day configuration window.

## POST /api/v1/ssls/initialize

**This is the purchase.** It reserves the certificate and debits your balance. Nothing is sent to the CA yet.

**Request**

```json
{
  "packageCode": "POSITIVESSL",
  "domainName": "apiname.com"
}
```

| Field | Required | Notes |
| --- | --- | --- |
| `packageCode` | required | From `GET /api/v1/products/ssls` — the `productCode` field. |
| `domainName` | required | The certificate's main name. |

**Response — 200**

```json
{
  "success": true,
  "message": "SSL certificate purchase initialized successfully. Waiting for installation.",
  "certificateId": "5e8c2a71-4b93-4f06-ae25-1d7f9c3b8042",
  "status": "WaitingForInstall",
  "dcvDetails": null,
  "csr": null,
  "privateKey": null
}
```

:::tip[Safe to retry — you will not be charged twice]
If you call `initialize` again for a domain that already has a certificate awaiting configuration:

- **Same `packageCode`** → the existing certificate comes back with `success: true` and a message saying it was already initialized. **No second charge.** This is what makes a timed-out request safe to repeat.
- **Different `packageCode`** → `Ssl:10052`, telling you to configure the pending certificate first.

Store `certificateId` and start your 7-day timer now.
:::

:::note[Some packages are installed by our technical team]
For a few packages the message changes to say installation is performed by our technical team and asks you to open a support ticket. For those, `configure` will refuse with `Ssl:10070` — it is not a bug. Check the message on this response and route the customer accordingly.
:::

**Errors**

| Code | Meaning and fix |
| --- | --- |
| `Ssl:10003` | `packageCode` unknown. |
| `Ssl:10067` | The package is no longer on sale. Pick another. |
| `Ssl:10052` | A certificate with a *different* package is already awaiting configuration for this domain. |
| `Ssl:10013` | An active certificate already exists for this domain. Reissue or renew instead. |
| `Ssl:10044 / Ssl:10046` | No price configured for this package. Open a ticket. |
| `Ssl:10045` | Insufficient balance. `data` gives the shortfall. |
| `Ssl:10047` | Your balance is suspended. |
| `Ssl:10001` | Invalid domain name. |
