> ## Documentation Index
> Fetch the complete documentation index at: https://docs.umeme.app/llms.txt
> Use this file to discover all available pages before exploring further.

# Renouveler un abonnement TV

> Une vente TV renouvelle un abonnement. Même route, même cycle : seuls le compte et la référence changent.

## 1. Une première vente, tout en dur

```bash cURL icon="https://mintcdn.com/dommi10/MMGXqk_5twdsE4Rl/logos/langages/bash.svg?fit=max&auto=format&n=MMGXqk_5twdsE4Rl&q=85&s=c7cc496df6d82b1c6cdaa5c132b8d4bc" theme={"dark"}
curl -X POST "$UMEME_BASE_URL/ventes" \
  -H "Authorization: Bearer $UMEME_CLE" \
  -H "Content-Type: application/json" \
  -d '{
    "uuid": "94a223fe-fb34-47f2-aaa5-b80c4bf8a8eb",
    "compte": "TV",
    "reference": "TV-00",
    "montant": 10
  }'
```

```javascript Node.js · fetch icon="https://mintcdn.com/dommi10/MMGXqk_5twdsE4Rl/logos/langages/nodejs.svg?fit=max&auto=format&n=MMGXqk_5twdsE4Rl&q=85&s=60e7eb54ba25d5cb5e9d62e0896b99c7" theme={"dark"}
// Node.js 18 et plus : fetch est intégré.
const baseUrl = process.env.UMEME_BASE_URL;

const corps = {
  uuid: "94a223fe-fb34-47f2-aaa5-b80c4bf8a8eb",
  compte: "TV",
  reference: "TV-00",
  montant: 10,
};

const reponse = await fetch(`${baseUrl}/ventes`, {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.UMEME_CLE}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify(corps),
});
const donnees = await reponse.json();
```

```javascript Node.js · Axios icon="https://mintcdn.com/dommi10/MMGXqk_5twdsE4Rl/logos/langages/axios.svg?fit=max&auto=format&n=MMGXqk_5twdsE4Rl&q=85&s=7e8bd7e79f903d3d1bffc290e52fcdc9" theme={"dark"}
// npm install axios
import axios from "axios";

const umeme = axios.create({
  baseURL: process.env.UMEME_BASE_URL,
  headers: { Authorization: `Bearer ${process.env.UMEME_CLE}` },
  timeout: 30000,
});

const corps = {
  uuid: "94a223fe-fb34-47f2-aaa5-b80c4bf8a8eb",
  compte: "TV",
  reference: "TV-00",
  montant: 10,
};

const { data } = await umeme.post("/ventes", corps);
```

```python Python icon="https://mintcdn.com/dommi10/MMGXqk_5twdsE4Rl/logos/langages/python.svg?fit=max&auto=format&n=MMGXqk_5twdsE4Rl&q=85&s=41e570f5c5c97d07c3c878a6704f2bed" theme={"dark"}
import os

import requests

BASE_URL = os.environ["UMEME_BASE_URL"]
ENTETES = {"Authorization": f"Bearer {os.environ['UMEME_CLE']}"}

corps = {
    "uuid": "94a223fe-fb34-47f2-aaa5-b80c4bf8a8eb",
    "compte": "TV",
    "reference": "TV-00",
    "montant": 10,
}

reponse = requests.post(
    f"{BASE_URL}/ventes",
    headers=ENTETES,
    json=corps,
    timeout=30,
)
donnees = reponse.json()
```

```php PHP icon="https://mintcdn.com/dommi10/MMGXqk_5twdsE4Rl/logos/langages/php.svg?fit=max&auto=format&n=MMGXqk_5twdsE4Rl&q=85&s=706823b5881c1d4e78720e369520cc78" theme={"dark"}
// composer require guzzlehttp/guzzle
$client = new GuzzleHttp\Client([
    'base_uri' => getenv('UMEME_BASE_URL') . '/',
    'headers' => ['Authorization' => 'Bearer ' . getenv('UMEME_CLE')],
    'timeout' => 30,
]);

$corps = [
    'uuid' => '94a223fe-fb34-47f2-aaa5-b80c4bf8a8eb',
    'compte' => 'TV',
    'reference' => 'TV-00',
    'montant' => 10,
];

$reponse = $client->post('ventes', [
    'json' => $corps,
]);
$donnees = json_decode($reponse->getBody(), true);
```

```java Java icon="https://mintcdn.com/dommi10/MMGXqk_5twdsE4Rl/logos/langages/java.svg?fit=max&auto=format&n=MMGXqk_5twdsE4Rl&q=85&s=a99792afd2b2bcd5b3c64f5157b8469e" theme={"dark"}
// Java 15 et plus : java.net.http et blocs de texte.
var baseUrl = System.getenv("UMEME_BASE_URL");
var client = HttpClient.newHttpClient();

var corps = """
    {
      "uuid": "94a223fe-fb34-47f2-aaa5-b80c4bf8a8eb",
      "compte": "TV",
      "reference": "TV-00",
      "montant": 10
    }
    """;

var requete = HttpRequest.newBuilder(URI.create(baseUrl + "/ventes"))
    .header("Authorization", "Bearer " + System.getenv("UMEME_CLE"))
    .header("Content-Type", "application/json")
    .POST(HttpRequest.BodyPublishers.ofString(corps))
    .build();

var reponse = client.send(requete, HttpResponse.BodyHandlers.ofString());
```

La `reference` est la référence d'abonnement du client. Dans la sandbox, `TV-00` réussit toujours.

## 2. Vérifier l'abonnement

`GET /v1/compteurs/{reference}?compte=TV&montant=10` renvoie le nom de l'abonné avant la vente. Voir [Vérifier un compteur](https://docs.umeme.app/reference/verifier-un-compteur.md).

## 3. Les issues

| Référence de test | Issue | Motif |
| :- | :- | :- |
| `TV-00` | `REUSSIE` | — |
| `TV-11` | `ECHOUEE` | `ECHEC_FOURNISSEUR` |
| `TV-50` | `REJETEE` | `SERVICE_INDISPONIBLE` |

Une vente TV réussie n'a pas de jeton : le reçu PDF prouve le renouvellement.

## 4. Et ensuite ?

> [card] [Statuts](https://docs.umeme.app/ressources/statuts.md)
>
> Le cycle complet d'une vente.

> [card] [Recevoir et vérifier les rappels](https://docs.umeme.app/guides/rappels.md)
>
> Vérifier la signature des rappels.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.