Retourenereignisse: Der Kunde hat eine neue Retoure angelegt, oder ihr Status hat sich geändert. Anfrageparameter, Auswahl der Benachrichtigung und Form der Antwort werden in der [Übersicht der E-shop API](https://www.bulkgate.com/de/dokumentation/eshop-api/eshop-api-uebersicht/) beschrieben.

## API-URL

| ENDPOINT                                                           | EREIGNIS DER BENACHRICHTIGUNG             |
|:-------------------------------------------------------------------|:------------------------------------------|
| `https://portal.bulkgate.com/api/1.0/eshop/return/new`             | `product_return`                          |
| `https://portal.bulkgate.com/api/1.0/eshop/return/change-status`   | `return_status_change_<return_status_id>` |

> [!NOTE]
> Erreicht die Anfrage ihr Ziel nicht, wiederholen Sie sie auf dem [Backup-Server](https://www.bulkgate.com/de/dokumentation/api-verwaltung-und-tokens/backup-server/) `backup1.bulkgate.com`.

## Unterstützte HTTP-Methoden

- `POST` - `application/json`

```http
POST /api/1.0/eshop/return/new HTTP/1.1
Host: portal.bulkgate.com
Content-Type: application/json
```

## Neue Retoure

`eshop/return/new` löst die Benachrichtigung des Ereignisses `product_return` aus. Die Angaben zur Retoure übergeben Sie mit Variablen aus der Gruppe Retoure, z. B. `return_id`, `return_reason` oder `return_products1`.

```http-json
POST /api/1.0/eshop/return/new HTTP/1.1
Host: portal.bulkgate.com
Content-Type: application/json

{
  "application_id": 451,
  "application_token": "NKN02TWE6NfBkfl-your-secret-token-Wf05GaqLIWLW4aBj",
  "language": "de",
  "variables": {
    "return_id": "77",
    "order_id": "10045",
    "return_reason": "Falsche Größe",
    "customer_mobile": "777777777",
    "customer_country_id": "cz"
  }
}
```

## Statusänderung der Retoure

`eshop/return/change-status` sucht die Benachrichtigung für einen bestimmten Status. Den Namen des Ereignisses setzt es aus `return_status_change_` und dem Wert der Variable `return_status_id` zusammen. Senden Sie `return_status_id` deshalb immer — ohne sie ordnet das Portal die Benachrichtigung keinem Status zu. Die Status, für die sich eine Benachrichtigung einrichten lässt, lädt Ihr Shop über die [Einrichtung](https://www.bulkgate.com/de/dokumentation/eshop-api/eshop-api-einrichtung/) hoch.

```http-json
POST /api/1.0/eshop/return/change-status HTTP/1.1
Host: portal.bulkgate.com
Content-Type: application/json

{
  "application_id": 451,
  "application_token": "NKN02TWE6NfBkfl-your-secret-token-Wf05GaqLIWLW4aBj",
  "language": "de",
  "variables": {
    "return_id": "77",
    "return_status_id": "3",
    "return_status": "Retoure erhalten",
    "customer_mobile": "777777777",
    "customer_country_id": "cz"
  }
}
```

Die obige Anfrage verwendet die Benachrichtigung, die für das Ereignis `return_status_change_3` eingerichtet ist.

## Antwort

```json
{
    "data": {
        "customer": [
            {
                "status": "accepted",
                "message_id": "tmpde1bcd4b1d1",
                "part_id": ["tmpde1bcd4b1d1"],
                "number": "420777777777",
                "channel": "sms"
            }
        ]
    }
}
```

Die Bedeutung der Schlüssel `customer` und `admin`, Fehler beim Senden und die Fehlertypen finden Sie in der [Übersicht der E-shop API](https://www.bulkgate.com/de/dokumentation/eshop-api/eshop-api-uebersicht/).
