---
# System prepended metadata

title: Jooycar Paypermile Events

---

# Jooycar Paypermile Events
The Jooycar Platform defines several events to ease the integration with Paypermile solutions. These events happen in different stages of the Paypermile policy lifecycle, and can be either outgoing or ingoing.

## Outgoing Messages
Outgoing messages occur when a defined event happens on the Paypermile policy lifecycle (e.g. a device installation). For these events a message with a defined structure and subject is sent to all the registered Webhook subscriptions as soon as its processed by the platform.

For details on how to register to listen to these messages, please refer to the Jooycar Webhook documentation.

### 1. Expired Lead
_This event only applies to leads created through the Jooycar Presale API._
It is triggered when an unfinished presale lead has exceeded a defined amount of time without being updated by the customer. The fields included on this message can be either filled or empty, that depending on the customer information captured by the Presale API.

Subject: `lead/expired` 
Body:
```json
{ 
  "id": "5a12ed57c7c51d0b6a8de9c5",
  "channel": "ChannelName",
  "executiveId": "17442043-2",
  "plan": {
    "currency": "CLF",
    "distancePrice": 0.0012,
    "fixedPrice": 0.43548,
    "maxPrice": 2.41548,
    "distance": "KM",
    "maxDistance": 1650,
    "extraCurrencies": [
      {
        "currency": "CLP",
        "currencyRate": 27532.8
      }
    ],
    "metadata": {
      "deductible": "5",
      "code": 1069,
      "premium": "0.001259",
      "default": true,
      "position": 0,
      "label": "Más vendido"
    }
  },
  "insuredVehicle": {
    "brandCode": "5",
    "displayBrand": "CHEVROLET",
    "modelCode": "1535",
    "displayModel": "AVEO",
    "subModelCode": "",
    "displaySubModel": "",
    "year": "2018",
    "isNew": "2",
    "plate": "JLKK47",
    "vehicleType": "1",
    "usage": "particular",
    "color": "Blanco",
    "engineNumber": "",
    "chassisNumber": "",
    "metadata": {}
  },
  "insuredPerson": {
    "lastName1": "Rojas",
    "lastName2": "Ortiz",
    "firstName": "Juan",
    "midName": "Jose",
    "idValue": "11111111-1",
    "idType": "rut",
    "gender": "M",
    "email": "jjrojas@correo.com",
    "birthDate": "1979-04-18",
    "nationality": "",
    "mobileCode": "9",
    "mobile": "99999999",
    "areaCode": "",
    "landline": "",
    "metadata": {}
  },
  "insuredAddress": {
    "type": "",
    "street": "Av. de las Flores",
    "streetNumber": "50",
    "level": "201",
    "block": "13",
    "unitNumber": "13024",
    "reference": "",
    "municipality": "DOWNTOWN",
    "state": "CENTRAL STATE",
    "city": "1",
    "country": "CL",
    "zipCode": "",
    "metadata": {}
  },
  "contractingPerson": {
    "lastName1": "Rojas",
    "lastName2": "Ortiz",
    "firstName": "Juan",
    "midName": "Jose",
    "idValue": "11111111-1",
    "idType": "rut",
    "gender": "M",
    "email": "jjrojas@correo.com",
    "birthDate": "1979-04-18",
    "nationality": "",
    "mobileCode": "9",
    "mobile": "99999999",
    "areaCode": "",
    "landline": "",
    "metadata": {}
  },
  "contractingAddress": {
    "type": "",
    "street": "Av. de las Flores",
    "streetNumber": "50",
    "level": "201",
    "block": "13",
    "unitNumber": "13024",
    "reference": "",
    "municipality": "DOWNTOWN",
    "state": "CENTRAL STATE",
    "city": "1",
    "country": "CL",
    "zipCode": "",
    "metadata": {}
  },
  "deliveryPerson": {
    "lastName1": "Rojas",
    "lastName2": "Ortiz",
    "firstName": "Juan",
    "midName": "Jose",
    "idValue": "11111111-1",
    "idType": "rut",
    "gender": "M",
    "email": "jjrojas@correo.com",
    "birthDate": "1979-04-18",
    "nationality": "",
    "mobileCode": "9",
    "mobile": "99999999",
    "areaCode": "",
    "landline": "",
    "metadata": {}
  },
  "deliveryAddress": {
    "type": "",
    "street": "Av. de las Flores",
    "streetNumber": "50",
    "level": "201",
    "block": "13",
    "unitNumber": "13024",
    "reference": "",
    "municipality": "DOWNTOWN",
    "state": "CENTRAL STATE",
    "city": "1",
    "country": "CL",
    "zipCode": "",
    "metadata": {}
  },
  "payingPerson": {
    "lastName1": "Rojas",
    "lastName2": "Ortiz",
    "firstName": "Juan",
    "midName": "Jose",
    "idValue": "11111111-1",
    "idType": "rut",
    "gender": "M",
    "email": "jjrojas@correo.com",
    "birthDate": "1979-04-18",
    "nationality": "",
    "mobileCode": "9",
    "mobile": "99999999",
    "areaCode": "",
    "landline": "",
    "metadata": {}
  },
  "payingAddress": {
    "type": "",
    "street": "Av. de las Flores",
    "streetNumber": "50",
    "level": "201",
    "block": "13",
    "unitNumber": "13024",
    "reference": "",
    "municipality": "DOWNTOWN",
    "state": "CENTRAL STATE",
    "city": "1",
    "country": "CL",
    "zipCode": "",
    "metadata": {}
  },
  "inspectionPerson": {
    "lastName1": "Rojas",
    "lastName2": "Ortiz",
    "firstName": "Juan",
    "midName": "Jose",
    "idValue": "11111111-1",
    "idType": "rut",
    "gender": "M",
    "email": "jjrojas@correo.com",
    "birthDate": "1979-04-18",
    "nationality": "",
    "mobileCode": "9",
    "mobile": "99999999",
    "areaCode": "",
    "landline": "",
    "metadata": {}
  },
  "inspectionAddress": {
    "type": "",
    "street": "Av. de las Flores",
    "streetNumber": "50",
    "level": "201",
    "block": "13",
    "unitNumber": "13024",
    "reference": "",
    "municipality": "DOWNTOWN",
    "state": "CENTRAL STATE",
    "city": "1",
    "country": "CL",
    "zipCode": "",
    "metadata": {}
  }
  "createdAt": "2018-08-01T19:35:42.000Z"
}
```

| Parameter | Type | Nullable | Description
| ------ | ------ | ------ | ------
| id | String | false | Jooycar ID for the lead
| channel |	String | false | The reference of the channel/broker associated to the message
| executiveId |	String | true | An ID value that identifies the executive related to this lead
| plan | [QuotingPlan](#QuotingPlan) | true | A QuotingPlan object containing the quoting result selected by the customer. _Refer to the Appendix for detailed information._
| insuredVehicle | [VehicleData](#VehicleData) | false | A VehicleData object containing the insured vehicle data captured by the lead. _Refer to the Appendix for detailed information._
| insuredPerson | [PersonData](#PersonData) | false | A PersonData object containing the insured person data captured by the lead. _Refer to the Appendix for detailed information._
| insuredAddress | [AddressData](#AddressData) | false | An AddressData object containing the insured address data captured by the lead. _Refer to the Appendix for detailed information._
| contractingPerson | [PersonData](#PersonData) | false | A PersonData object containing the contracting person data captured by the lead. _Refer to the Appendix for detailed information._
| contractingAddress | [AddressData](#AddressData) | false | An AddressData object containing the contracting address data captured by the lead. _Refer to the Appendix for detailed information._
| deliveryPerson | [PersonData](#PersonData) | false | A PersonData object containing the delivery person data captured by the lead. _Refer to the Appendix for detailed information._
| deliveryAddress | [AddressData](#AddressData) | false | An AddressData object containing the delivery address data captured by the lead. _Refer to the Appendix for detailed information._
| payingPerson | [PersonData](#PersonData) | false | A PersonData object containing the paying person data captured by the lead. _Refer to the Appendix for detailed information._
| payingAddress | [AddressData](#AddressData) | false | An AddressData object containing the paying address data captured by the lead. _Refer to the Appendix for detailed information._
| inspectionPerson | [PersonData](#PersonData) | false | A PersonData object containing the inspection person data captured by the lead. _Refer to the Appendix for detailed information._
| inspectionAddress | [AddressData](#AddressData) | false | An AddressData object containing the inspection address data captured by the lead. _Refer to the Appendix for detailed information._
| createdAt	| String | false | Lead date of creation as an ISO 8601 Date

### 2. Lead Quote
_This event only applies to leads created through the Jooycar Presale API._
It is triggered when new quoting plans are obtained for a presale lead. The fields included on this message can be either filled or empty, that depending on the customer information captured by the Presale API.

Subject: `lead/quote` 
Body:
```json
{ 
  "id": "5a12ed57c7c51d0b6a8de9c5",
  "channel": "ChannelName",
  "executiveId": "17442043-2",
  "plans": [
    {
      "currency": "CLF",
      "distancePrice": 0.0012,
      "fixedPrice": 0.43548,
      "maxPrice": 2.41548,
      "distance": "KM",
      "maxDistance": 1650,
      "extraCurrencies": [
        {
          "currency": "CLP",
          "currencyRate": 27532.8
        }
      ],
      "metadata": {
        "deductible": "5",
        "code": 1069,
        "premium": "0.001259",
        "default": true,
        "position": 0,
        "label": "Más vendido"
      }
    },
    {
      "currency": "CLF",
      "distancePrice": 0.00102,
      "fixedPrice": 0.43548,
      "maxPrice": 2.11848,
      "distance": "KM",
      "maxDistance": 1650,
      "extraCurrencies": [
        {
          "currency": "CLP",
          "currencyRate": 27532.8
        }
      ],
      "metadata": {
        "deductible": "10",
        "code": 1071,
        "premium": "0.001259",
        "default": false,
        "position": 0,
        "label": "Más barato"
      }
    }
  ],
  "insuredVehicle": {
    "brandCode": "5",
    "displayBrand": "CHEVROLET",
    "modelCode": "1535",
    "displayModel": "AVEO",
    "subModelCode": "",
    "displaySubModel": "",
    "year": "2018",
    "isNew": "2",
    "plate": "JLKK47",
    "vehicleType": "1",
    "usage": "particular",
    "color": "Blanco",
    "engineNumber": "",
    "chassisNumber": "",
    "metadata": {}
  },
  "insuredPerson": {
    "lastName1": "Rojas",
    "lastName2": "Ortiz",
    "firstName": "Juan",
    "midName": "Jose",
    "idValue": "11111111-1",
    "idType": "rut",
    "gender": "M",
    "email": "jjrojas@correo.com",
    "birthDate": "1979-04-18",
    "nationality": "",
    "mobileCode": "9",
    "mobile": "99999999",
    "areaCode": "",
    "landline": "",
    "metadata": {}
  },
  "insuredAddress": {
    "type": "",
    "street": "Av. de las Flores",
    "streetNumber": "50",
    "level": "201",
    "block": "13",
    "unitNumber": "13024",
    "reference": "",
    "municipality": "DOWNTOWN",
    "state": "CENTRAL STATE",
    "city": "1",
    "country": "CL",
    "zipCode": "",
    "metadata": {}
  },
  "contractingPerson": {
    "lastName1": "Rojas",
    "lastName2": "Ortiz",
    "firstName": "Juan",
    "midName": "Jose",
    "idValue": "11111111-1",
    "idType": "rut",
    "gender": "M",
    "email": "jjrojas@correo.com",
    "birthDate": "1979-04-18",
    "nationality": "",
    "mobileCode": "9",
    "mobile": "99999999",
    "areaCode": "",
    "landline": "",
    "metadata": {}
  },
  "contractingAddress": {
    "type": "",
    "street": "Av. de las Flores",
    "streetNumber": "50",
    "level": "201",
    "block": "13",
    "unitNumber": "13024",
    "reference": "",
    "municipality": "DOWNTOWN",
    "state": "CENTRAL STATE",
    "city": "1",
    "country": "CL",
    "zipCode": "",
    "metadata": {}
  },
  "deliveryPerson": {
    "lastName1": "Rojas",
    "lastName2": "Ortiz",
    "firstName": "Juan",
    "midName": "Jose",
    "idValue": "11111111-1",
    "idType": "rut",
    "gender": "M",
    "email": "jjrojas@correo.com",
    "birthDate": "1979-04-18",
    "nationality": "",
    "mobileCode": "9",
    "mobile": "99999999",
    "areaCode": "",
    "landline": "",
    "metadata": {}
  },
  "deliveryAddress": {
    "type": "",
    "street": "Av. de las Flores",
    "streetNumber": "50",
    "level": "201",
    "block": "13",
    "unitNumber": "13024",
    "reference": "",
    "municipality": "DOWNTOWN",
    "state": "CENTRAL STATE",
    "city": "1",
    "country": "CL",
    "zipCode": "",
    "metadata": {}
  },
  "payingPerson": {
    "lastName1": "Rojas",
    "lastName2": "Ortiz",
    "firstName": "Juan",
    "midName": "Jose",
    "idValue": "11111111-1",
    "idType": "rut",
    "gender": "M",
    "email": "jjrojas@correo.com",
    "birthDate": "1979-04-18",
    "nationality": "",
    "mobileCode": "9",
    "mobile": "99999999",
    "areaCode": "",
    "landline": "",
    "metadata": {}
  },
  "payingAddress": {
    "type": "",
    "street": "Av. de las Flores",
    "streetNumber": "50",
    "level": "201",
    "block": "13",
    "unitNumber": "13024",
    "reference": "",
    "municipality": "DOWNTOWN",
    "state": "CENTRAL STATE",
    "city": "1",
    "country": "CL",
    "zipCode": "",
    "metadata": {}
  },
  "inspectionPerson": {
    "lastName1": "Rojas",
    "lastName2": "Ortiz",
    "firstName": "Juan",
    "midName": "Jose",
    "idValue": "11111111-1",
    "idType": "rut",
    "gender": "M",
    "email": "jjrojas@correo.com",
    "birthDate": "1979-04-18",
    "nationality": "",
    "mobileCode": "9",
    "mobile": "99999999",
    "areaCode": "",
    "landline": "",
    "metadata": {}
  },
  "inspectionAddress": {
    "type": "",
    "street": "Av. de las Flores",
    "streetNumber": "50",
    "level": "201",
    "block": "13",
    "unitNumber": "13024",
    "reference": "",
    "municipality": "DOWNTOWN",
    "state": "CENTRAL STATE",
    "city": "1",
    "country": "CL",
    "zipCode": "",
    "metadata": {}
  }
  "createdAt": "2018-08-01T19:35:42.000Z"
}
```

| Parameter | Type | Nullable | Description
| ------ | ------ | ------ | ------
| id | String | false | Jooycar ID for the lead
| channel |	String | false | The reference of the channel/broker associated to the message
| executiveId |	String | true | An ID value that identifies the executive related to this lead
| plans | Array<[QuotingPlan](#QuotingPlan)> | false | A QuotingPlan array containing the quoting results returned for this customer. _Refer to the Appendix for detailed information._
| insuredVehicle | [VehicleData](#VehicleData) | false | A VehicleData object containing the insured vehicle data captured by the lead. _Refer to the Appendix for detailed information._
| insuredPerson | [PersonData](#PersonData) | false | A PersonData object containing the insured person data captured by the lead. _Refer to the Appendix for detailed information._
| insuredAddress | [AddressData](#AddressData) | false | An AddressData object containing the insured address data captured by the lead. _Refer to the Appendix for detailed information._
| contractingPerson | [PersonData](#PersonData) | false | A PersonData object containing the contracting person data captured by the lead. _Refer to the Appendix for detailed information._
| contractingAddress | [AddressData](#AddressData) | false | An AddressData object containing the contracting address data captured by the lead. _Refer to the Appendix for detailed information._
| deliveryPerson | [PersonData](#PersonData) | false | A PersonData object containing the delivery person data captured by the lead. _Refer to the Appendix for detailed information._
| deliveryAddress | [AddressData](#AddressData) | false | An AddressData object containing the delivery address data captured by the lead. _Refer to the Appendix for detailed information._
| payingPerson | [PersonData](#PersonData) | false | A PersonData object containing the paying person data captured by the lead. _Refer to the Appendix for detailed information._
| payingAddress | [AddressData](#AddressData) | false | An AddressData object containing the paying address data captured by the lead. _Refer to the Appendix for detailed information._
| inspectionPerson | [PersonData](#PersonData) | false | A PersonData object containing the inspection person data captured by the lead. _Refer to the Appendix for detailed information._
| inspectionAddress | [AddressData](#AddressData) | false | An AddressData object containing the inspection address data captured by the lead. _Refer to the Appendix for detailed information._
| createdAt	| String | false | Lead date of creation as an ISO 8601 Date

### 3. New Proposal
_This event only applies to leads created through the Jooycar Presale API._
It is triggered when a customer reaches the end of the presale flow submitting all necessary data for inspection and insurance policy creation. The fields included on this message can be either filled or empty, that depending on the customer information captured by the Presale API.

Subject: `proposal/new`
Body:
```json
{ 
  "id": "5a12ed57c7c51d0b6a8de9c5",
  "channel": "ChannelName",
  "executiveId": "17442043-2",
  "plan": {
    "currency": "CLF",
    "distancePrice": 0.0012,
    "fixedPrice": 0.43548,
    "maxPrice": 2.41548,
    "distance": "KM",
    "maxDistance": 1650,
    "extraCurrencies": [
      {
        "currency": "CLP",
        "currencyRate": 27532.8
      }
    ],
    "metadata": {
      "deductible": "5",
      "code": 1069,
      "premium": "0.001259",
      "default": true,
      "position": 0,
      "label": "Más vendido"
    }
  },
  "insuredVehicle": {
    "brandCode": "5",
    "displayBrand": "CHEVROLET",
    "modelCode": "1535",
    "displayModel": "AVEO",
    "subModelCode": "",
    "displaySubModel": "",
    "year": "2018",
    "isNew": "2",
    "plate": "JLKK47",
    "vehicleType": "1",
    "usage": "particular",
    "color": "Blanco",
    "engineNumber": "",
    "chassisNumber": "",
    "metadata": {}
  },
  "insuredPerson": {
    "lastName1": "Rojas",
    "lastName2": "Ortiz",
    "firstName": "Juan",
    "midName": "Jose",
    "idValue": "11111111-1",
    "idType": "rut",
    "gender": "M",
    "email": "jjrojas@correo.com",
    "birthDate": "1979-04-18",
    "nationality": "",
    "mobileCode": "9",
    "mobile": "99999999",
    "areaCode": "",
    "landline": "",
    "metadata": {}
  },
  "insuredAddress": {
    "type": "",
    "street": "Av. de las Flores",
    "streetNumber": "50",
    "level": "201",
    "block": "13",
    "unitNumber": "13024",
    "reference": "",
    "municipality": "DOWNTOWN",
    "state": "CENTRAL STATE",
    "city": "1",
    "country": "CL",
    "zipCode": "",
    "metadata": {}
  },
  "contractingPerson": {
    "lastName1": "Rojas",
    "lastName2": "Ortiz",
    "firstName": "Juan",
    "midName": "Jose",
    "idValue": "11111111-1",
    "idType": "rut",
    "gender": "M",
    "email": "jjrojas@correo.com",
    "birthDate": "1979-04-18",
    "nationality": "",
    "mobileCode": "9",
    "mobile": "99999999",
    "areaCode": "",
    "landline": "",
    "metadata": {}
  },
  "contractingAddress": {
    "type": "",
    "street": "Av. de las Flores",
    "streetNumber": "50",
    "level": "201",
    "block": "13",
    "unitNumber": "13024",
    "reference": "",
    "municipality": "DOWNTOWN",
    "state": "CENTRAL STATE",
    "city": "1",
    "country": "CL",
    "zipCode": "",
    "metadata": {}
  },
  "deliveryPerson": {
    "lastName1": "Rojas",
    "lastName2": "Ortiz",
    "firstName": "Juan",
    "midName": "Jose",
    "idValue": "11111111-1",
    "idType": "rut",
    "gender": "M",
    "email": "jjrojas@correo.com",
    "birthDate": "1979-04-18",
    "nationality": "",
    "mobileCode": "9",
    "mobile": "99999999",
    "areaCode": "",
    "landline": "",
    "metadata": {}
  },
  "deliveryAddress": {
    "type": "",
    "street": "Av. de las Flores",
    "streetNumber": "50",
    "level": "201",
    "block": "13",
    "unitNumber": "13024",
    "reference": "",
    "municipality": "DOWNTOWN",
    "state": "CENTRAL STATE",
    "city": "1",
    "country": "CL",
    "zipCode": "",
    "metadata": {}
  },
  "payingPerson": {
    "lastName1": "Rojas",
    "lastName2": "Ortiz",
    "firstName": "Juan",
    "midName": "Jose",
    "idValue": "11111111-1",
    "idType": "rut",
    "gender": "M",
    "email": "jjrojas@correo.com",
    "birthDate": "1979-04-18",
    "nationality": "",
    "mobileCode": "9",
    "mobile": "99999999",
    "areaCode": "",
    "landline": "",
    "metadata": {}
  },
  "payingAddress": {
    "type": "",
    "street": "Av. de las Flores",
    "streetNumber": "50",
    "level": "201",
    "block": "13",
    "unitNumber": "13024",
    "reference": "",
    "municipality": "DOWNTOWN",
    "state": "CENTRAL STATE",
    "city": "1",
    "country": "CL",
    "zipCode": "",
    "metadata": {}
  },
  "inspectionPerson": {
    "lastName1": "Rojas",
    "lastName2": "Ortiz",
    "firstName": "Juan",
    "midName": "Jose",
    "idValue": "11111111-1",
    "idType": "rut",
    "gender": "M",
    "email": "jjrojas@correo.com",
    "birthDate": "1979-04-18",
    "nationality": "",
    "mobileCode": "9",
    "mobile": "99999999",
    "areaCode": "",
    "landline": "",
    "metadata": {}
  },
  "inspectionAddress": {
    "type": "",
    "street": "Av. de las Flores",
    "streetNumber": "50",
    "level": "201",
    "block": "13",
    "unitNumber": "13024",
    "reference": "",
    "municipality": "DOWNTOWN",
    "state": "CENTRAL STATE",
    "city": "1",
    "country": "CL",
    "zipCode": "",
    "metadata": {}
  },
  "subscription": {
    "strategy": "TransbankOneClick",
    "subscriptionData": {
      "subscriptionDate": "2019-11-17T23:13:43.000Z",
      "authCode": "459329",
      "creditCardType": "AmericanExpress",
      "last4CardDigits": "1755"
    }
  },
  "expiresAt": "2019-08-01T19:42:07.000Z",
  "createdAt": "2018-08-01T19:35:42.000Z",
  "subscribedAt": "2018-08-01T19:42:07.000Z"
}
```

| Parameter | Type | Nullable | Description
| ------ | ------ | ------ | ------
| id | String | false | Jooycar ID for the lead
| channel |	String | false | The reference of the channel/broker associated to the message
| executiveId |	String | true | An ID value that identifies the executive related to this lead
| plan | [QuotingPlan](#QuotingPlan) | false | A QuotingPlan object containing the quoting result selected by the customer. _Refer to the Appendix for detailed information._
| insuredVehicle | [VehicleData](#VehicleData) | false | A VehicleData object containing the insured vehicle data captured by the lead. _Refer to the Appendix for detailed information._
| insuredPerson | [PersonData](#PersonData) | false | A PersonData object containing the insured person data captured by the lead. _Refer to the Appendix for detailed information._
| insuredAddress | [AddressData](#AddressData) | false | An AddressData object containing the insured address data captured by the lead. _Refer to the Appendix for detailed information._
| contractingPerson | [PersonData](#PersonData) | false | A PersonData object containing the contracting person data captured by the lead. _Refer to the Appendix for detailed information._
| contractingAddress | [AddressData](#AddressData) | false | An AddressData object containing the contracting address data captured by the lead. _Refer to the Appendix for detailed information._
| deliveryPerson | [PersonData](#PersonData) | false | A PersonData object containing the delivery person data captured by the lead. _Refer to the Appendix for detailed information._
| deliveryAddress | [AddressData](#AddressData) | false | An AddressData object containing the delivery address data captured by the lead. _Refer to the Appendix for detailed information._
| payingPerson | [PersonData](#PersonData) | false | A PersonData object containing the paying person data captured by the lead. _Refer to the Appendix for detailed information._
| payingAddress | [AddressData](#AddressData) | false | An AddressData object containing the paying address data captured by the lead. _Refer to the Appendix for detailed information._
| inspectionPerson | [PersonData](#PersonData) | false | A PersonData object containing the inspection person data captured by the lead. _Refer to the Appendix for detailed information._
| inspectionAddress | [AddressData](#AddressData) | false | An AddressData object containing the inspection address data captured by the lead. _Refer to the Appendix for detailed information._
| subscription | [PaymentSubscriptionData](#PaymentSubscriptionData) | false | A PaymentSubscriptionData object containing the payment subscription data captured by the lead. _Refer to the Appendix for detailed information._
| expiresAt	| String | false | Lead date of expiration as an ISO 8601 Date
| createdAt	| String | false | Lead date of creation as an ISO 8601 Date
| subscribedAt | String | false | Lead date of subscription as an ISO 8601 Date

### 4. Insurance Policy Setup
This event is triggered when the Insurance Policy setup has been completed, including any available data related to the setup process.

Subject: `insurance_policy/setup`
Body:
```json
{
  "channel": "ChannelName",
  "proposalId": "1111111111",
  "policyId" : "5992943.123.456",
  "metadata": {
    "documentUrl": "https://url...5a12ec6a8de9c5d57c751d0b.pdf"
  }
}
```

| Parameter | Type | Nullable | Description
| ------ | ------ | ------ | ------
| channel | String | false | The reference of the channel/broker associated to the message
| proposalId | String | false | ID of the lead associated to the insurance policy
| policyId | String | false | The ID for the policy provided by the company
| metadata | Object | true | A custom object containing any other information related to the policy.<br>`{ string : any }`

### 5. Device Association
This event is emmitted when a Jooycar device is associated to an Insurance Policy.

Subject: `device/association`
Body:
```json
{
  "channel": "ChannelName",
  "provider": "shippingCompanyA",
  "imei": "352864240582358",
  "associatedAt": "2018-07-30T17:15:37.000Z",
  "isReplacement": false,
  "metadata": {
    "proposalId": "1111111111",
    "policyId" : "5992943.123.456",
    "replaced": {
      "imei": "356363051553677",
      "status": "disabled",
      "comment": "Free text"
    }
  }
}
```

| Parameter | Type | Nullable | Description
| ------ | ------ | ------ | ------
| channel |	String | false | The reference of the channel/broker associated to the event
| provider | String | false | The shipping provider reference
| imei | String | false | IMEI of the device
| associatedAt | String | false | An ISO 8601 Date of the time the association happened
| isReplacement | Bool | false | If true, this association is a replacement of an already assigned device for the policy
| metadata.proposalId |	String | true | ID of the proposal associated to this device
| metadata.replaced | Object | true | Only present if the assignment is a replacement of another device
| metadata.replaced.imei | String | false | The IMEI of the old device
| metadata.replaced.status | Enum | true | One of: <br>- **preactive**. The device is ready to be installed on a new client.<br>- **active**. The device is currently active on other vehicle.<br>- **disabled**. The device is disabled, possibly it's lost.<br>- **failure**. The device is in stock, but reported malfunction.
| metadata.replaced.comment | String | true | Additional information about the replacement, provided by the logistics provider.

### 6. Device Shipping Status
This event is emitted when the Jooycar Platform receives an update from the logistics provider about the delivery of a device to a customer.

Subject: `shipping/status`
Body:
```json
{
  "channel": "ChannelName",
  "provider": "shippingCompanyA",
  "id": "57d7f737a7b7c643902be753",
  "shippingType": "delivery",
  "imei" : "3580123812491201",
  "status" : "awaitingShipment",
  "updatedAt": "2018-08-01T19:35:42.000Z",
  "metadata": {
    "proposalId": "1111111111",
    "policyId" : "5992943.123.456",
    "providerStatus": "pending-contact",
    "comments": "Free text",
    "relatedTime": "2018-08-01T19:35:42.000Z"
  }
}
```

| Parameter | Type | Nullable | Description
| ------ | ------ | ------ | ------
| channel |	String | false | The reference of the channel/broker associated to the event
| provider | String | false | The **shipping provider** reference
| id | String | false | id of the shipping request
| shippingType | String | false | One of: "delivery" or "pickup"
| imei | String | false | The IMEI of the shipped device
| status | String | false | One of:<br>- **awaitingAssignment**. The order still doesn't have an assigned device.<br>- **awaitingShipment**. Order has been pulled and is awaiting collection from the shipping provider.<br>- **awaitingExecution**. Order has been coordinated with client to be executed in the future.<br>- **awaitingPickup**. Order has been packaged and is awaiting customer pickup from a shipping-provider-specified location.<br>- **onRoute**. Order has been shipped, but receipt has not been confirmed.<br>- **verificationRequired**. The order is on hold on and can't be completed with the current information.<br>- **completed**. Receipt is confirmed.<br>- **returnedToPartner**. It's confirmed that the device has been returned to the partner.<br>- **rejected**. Order has been rejected for shipping by the shipping provider due to a stock inconsistency or other reasons.<br>- **rejectedByClient**. Order has been rejected by client/addressee.<br>- **canceled**. The order cancelation has been accepted by the shipping provider.
| updatedAt | String | false | An ISO 8601 Date of the time the status was received from the logistics provider.
| metadata.proposalId | String | true | ID of the lead associated to the insurance policy
| metadata.providerStatus | String | true | Shipping status defined by the shipping provider
| metadata.comments | String | true | Free text for adding additional context
| metadata.relatedTime | String | true | An ISO 8601 Date of the time the shipping provider declared the status update really happened.

### 7. Device Installation
This event is emitted when the Jooycar Platform detects a device has been installed on a vehicle.

Subject: `device/installation`
Body:
```json
{
  "channel": "ChannelName",
  "eventId": "5c534b9b3285c666c3d3943a",
  "imei": "3580123812491201",
  "installedAt": "2018-07-30T17:15:37.000Z",
  "metadata": {
    "proposalId": "1111111111",
    "policyId" : "5992943.123.456"
  }
}
```

| Parameter | Type | Nullable | Description
| ------ | ------ | ------ | ------
| channel |	String | false | The reference of the channel/broker associated to the event
| eventId |	String | false | The ID assigned to this event
| imei |	String |	false	| IMEI of the device
| installedAt |	Number	| false | An ISO 8601 Date of the time the device installation happened
| metadata.proposalId |	String | true | ID of the proposal associated to this device

### 8. Device Disconnection
It is emitted when a device reports it has been disconnected from a vehicle. This event is emitted when the device is reconnected.

Subject: `device/disconnection`
Body:
```json
{
  "channel": "ChannelName",
  "eventId": "5c534b9b14041d69f5af4428",
  "imei": "3580123812491201",
  "startedAt": "2018-08-01T19:35:42.000Z",
  "endedAt": "2018-08-03T03:27:00.000Z",
  "metadata": {
    "proposalId": "1111111111"
    "policyId" : "5992943.123.456"
  }
}
```

| Parameter | Type | Nullable | Description
| ------ | ------ | ------ | ------
| channel |	String |	false |	The reference of the channel/broker associated to the event
| eventId |	String |	false |	The ID assigned to this event
| imei | String | false | IMEI of the device
| startedAt | String | false | An ISO 8601 Date of the start of the disconnection time range
| endedAt | String | false | An ISO 8601 Date of the end of the disconnection time range
| metadata.proposalId |	String | true | ID of the proposal associated to this device

### 9. New Period Balance
This event is emitted when a billing period is closed for an Insurance Policy, and includes information of the balance items to be billed for the period.

Subject: `balance/new`
Body:
```json
{
  "channel": "ChannelName",
  "id": "ec51d0be5a129c5d57c76a8d",
  "type": "premium",
  "totalAmount": {
    "currency": "CLP",
    "value": 19503,
    "extraCurrencies": [
      {
        "currency": "CLF",
        "value": 0.68
      }
    ]
  },
  "status": "open",
  "metadata": {
    "proposalId": "1111111111",
    "policyId" : "5992943.123.456",
    "periodSize": 30,
    "distance": 693.9,
    "unreportedDistance": 0,
    "disconnectionDays": 0,
    "penaltyDays": 0,
    "period": "2020-09",
    "extraCurrencies": [
      {
        "currency": "CLP",
        "exchangeRate": "28680.37"
      }
    ]
  },
  "items": [
    {
      "type": "fixed",
      "value": 19503,
      "currency": "CLP",
      "description": "Prima fija",
      "metadata": {
        "periodSize": 30
      },
      "extraCurrencies": [
        {
          "value": 0.68,
          "currency": "CLF"
        }
      ]
    },
    {
      "type": "tripDistance",
      "value": 0,
      "currency": "CLP",
      "description": "Prima por distancia recorrida (0 KM)",
      "metadata": {
        "distance": 0
      },
      "extraCurrencies": [
        {
          "value": 0,
          "currency": "CLF"
        }
      ]
    },
    {
      "type": "unreportedDistance",
      "value": 0,
      "currency": "CLP",
      "description": "Prima por distancia no reportada (0 KM)",
      "metadata": {
        "unreportedDistance": 0
      },
      "extraCurrencies": [
        {
          "value": 0,
          "currency": "CLF"
        }
      ]
    },
    {
      "type": "disconnectionPenalty",
      "value": 0,
      "currency": "CLP",
      "description": "Penalización por desconexión (0 dias)",
      "metadata": {
        "disconnectionDays": 0
      },
      "extraCurrencies": [
        {
          "value": 0,
          "currency": "CLF"
        }
      ]
    },
    {
      "type": "installationPenalty",
      "value": 0,
      "currency": "CLP",
      "description": "Penalización por demora en instalación (0 dias)",
      "metadata": {
        "penaltyDays": 0
      },
      "extraCurrencies": [
        {
          "value": 0,
          "currency": "CLF"
        }
      ]
    },
    {
      "type": "credit",
      "value": 0,
      "currency": "CLP",
      "description": "Crédito a favor",
      "metadata": {},
      "extraCurrencies": [
        {
          "value": 0,
          "currency": "CLF"
        }
      ]
    },
    {
      "type": "limitDiscount",
      "value": 0,
      "currency": "CLP",
      "description": "Descuento por límite de prima máxima",
      "metadata": {},
      "extraCurrencies": [
        {
          "value": 0,
          "currency": "CLF"
        }
      ]
    }
  ]
}
```
| Parameter | Type | Nullable | Description
| ------ | ------ | ------ | ------
| channel |	String | false | The reference of the channel/broker associated to the message.
| id | String | false | An Id of this balance
| type | String | false | Type of balance (e.g.: premium, shipping)
| totalAmount | [AmountData](#AmountData) | false | An AmountData object with the total amount of the balance in all configured currencies.
| status | String | false | The status of the balance. One of:<br>- open<br>- closed<br>- freeze<br>- paid<br>- rejected<br>- canceled<br>- reversed<br>- informative<br>- unconfirmed
| metadata | Object | true | An object containing any other information related to the balance. <br>{ string : any }
| items | Array<[BalanceItem](#BalanceItem)> | false | A BalanceItem array containing the items results returned for this customer. Refer to the Appendix for detailed information.


### 10. Balance Payment Status
_This event only applies to channels where balance charge attempts are handled by the Jooycar Platform._
This event is emitted on every charge attempt of an unpaid balance, in which the result itself can be either approval or rejection of said charge.

Subject: `balance/status`
Body:
```json
{
  "channel": "ChannelName",
  "id": "ec51d0be5a129c5d57c76a8d",
  "status": "paid",
  "type": "premium",
  "totalAmount": {
    "currency": "CLP",
    "value": 19503,
    "extraCurrencies": [
      {
        "currency": "CLF",
        "value": 0.68
      }
    ]
  },
  "attempt": 3,
  "result": {
    "strategy": "TransbankOneClick",
    "resultData": {
      "responseCode": "0",
      "authorizationCode": "077272",
      "buyOrder": "20201003143516646",
      "creditCardType": "MasterCard",
      "last4CardDigits": "1398",
      "transactionId": "42784540"
    }
  },
  "resolvedAt": "2020-10-03T14:35:15.000Z",
  "metadata": {
    "proposalId": "1111111111",
    "policyId" : "5992943.123.456",
    "period" : "2020-09",
    "extraCurrencies": [
      {
        "currency": "CLP",
        "exchangeRate": "28680.37"
      }
    ]
  }
}
```

| Parameter | Type | Nullable | Description
| ------ | ------ | ------ | ------
| channel |	String | false | The reference of the channel/broker associated to the message
| id | String | false | An ID of this balance
| type | String | false | Type of balance (e.g.: premium, shipping)
| totalAmount | [AmountData](#AmountData) | false | An AmountData object with the total amount of the balance in all configured currencies
| status | String | false | The status of the balance. One of:<br>- open<br>- closed<br>- freeze<br>- paid<br>- rejected<br>- canceled<br>- reversed<br>- informative<br>- unconfirmed
| attempt | Number | false | The number of attempts this balance has been tried to charge to the payment method
| result | [PaymentAttemptData](#PaymentAttemptData) | false | A PaymentAttemptData object containing the result of the charge attempt
| resolvedAt | String | false | An ISO 8601 Date of the time when the result ocurred
| metadata | Object | true | An object containing any other information related to the balance. <br>{ string : any }

## Incoming Messages
Incoming messages are the input source for entering new data to the Jooycar Platform (e.g. instantiating a new policy). The incoming messages are usually related to starting events or feed up required data for ongoing events.

This messages are sent to the Jooycar Platform through the Jooycar Paypermile Events API. For details on how to interact with this endpoint, please refer to the Jooycar Paypermile API documentation.

### A. Insurance Policy Creation
_This event only applies to policies whose leads were not created through the Jooycar Presale API._
The Insurance Policy Creation message is the starting point for instantiating a new policy on the Jooycar Platform for channels that do not implement the Jooycar Presale API. It must include all the necessary data to identify a customer for correct data processing and displaying, as well for external processes like shipping logistics.

Subject: `insurance_policy/create`
Body:
```json
{ 
  "channel": "ChannelName",
  "proposalId": "38469342345",
  "policyId": "5992943.123.456",
  "start": "2020-06-16",
  "plan": {
    "currency": "CLF",
    "distancePrice": 0.0012,
    "fixedPrice": 0.43548,
    "maxPrice": 2.41548,
    "distance": "KM",
    "maxDistance": 1650,
    "extraCurrencies": [
      {
        "currency": "CLP",
        "currencyRate": 27532.8
      }
    ],
    "metadata": {
      "deductible": "5",
      "code": 1069,
      "premium": "0.001259",
      "default": true,
      "position": 0,
      "label": "Más vendido"
    }
  },
  "insuredVehicle": {
    "brandCode": "5",
    "displayBrand": "CHEVROLET",
    "modelCode": "1535",
    "displayModel": "AVEO",
    "subModelCode": "",
    "displaySubModel": "",
    "year": "2018",
    "isNew": "2",
    "plate": "JLKK47",
    "vehicleType": "1",
    "usage": "particular",
    "color": "Blanco",
    "engineNumber": "",
    "chassisNumber": "",
    "metadata": {}
  },
  "insuredPerson": {
    "lastName1": "Rojas",
    "lastName2": "Ortiz",
    "firstName": "Juan",
    "midName": "Jose",
    "idValue": "11111111-1",
    "idType": "rut",
    "gender": "M",
    "email": "jjrojas@correo.com",
    "birthDate": "1979-04-18",
    "nationality": "",
    "mobileCode": "9",
    "mobile": "99999999",
    "areaCode": "",
    "landline": "",
    "metadata": {}
  },
  "insuredAddress": {
    "type": "",
    "street": "Av. de las Flores",
    "streetNumber": "50",
    "level": "201",
    "block": "13",
    "unitNumber": "13024",
    "reference": "",
    "municipality": "DOWNTOWN",
    "state": "CENTRAL STATE",
    "city": "1",
    "country": "CL",
    "zipCode": "",
    "metadata": {}
  },
  "contractingPerson": {
    "lastName1": "Rojas",
    "lastName2": "Ortiz",
    "firstName": "Juan",
    "midName": "Jose",
    "idValue": "11111111-1",
    "idType": "rut",
    "gender": "M",
    "email": "jjrojas@correo.com",
    "birthDate": "1979-04-18",
    "nationality": "",
    "mobileCode": "9",
    "mobile": "99999999",
    "areaCode": "",
    "landline": "",
    "metadata": {}
  },
  "contractingAddress": {
    "type": "",
    "street": "Av. de las Flores",
    "streetNumber": "50",
    "level": "201",
    "block": "13",
    "unitNumber": "13024",
    "reference": "",
    "municipality": "DOWNTOWN",
    "state": "CENTRAL STATE",
    "city": "1",
    "country": "CL",
    "zipCode": "",
    "metadata": {}
  },
  "deliveryPerson": {
    "lastName1": "Rojas",
    "lastName2": "Ortiz",
    "firstName": "Juan",
    "midName": "Jose",
    "idValue": "11111111-1",
    "idType": "rut",
    "gender": "M",
    "email": "jjrojas@correo.com",
    "birthDate": "1979-04-18",
    "nationality": "",
    "mobileCode": "9",
    "mobile": "99999999",
    "areaCode": "",
    "landline": "",
    "metadata": {}
  },
  "deliveryAddress": {
    "type": "",
    "street": "Av. de las Flores",
    "streetNumber": "50",
    "level": "201",
    "block": "13",
    "unitNumber": "13024",
    "reference": "",
    "municipality": "DOWNTOWN",
    "state": "CENTRAL STATE",
    "city": "1",
    "country": "CL",
    "zipCode": "",
    "metadata": {}
  },
  "payingPerson": {
    "lastName1": "Rojas",
    "lastName2": "Ortiz",
    "firstName": "Juan",
    "midName": "Jose",
    "idValue": "11111111-1",
    "idType": "rut",
    "gender": "M",
    "email": "jjrojas@correo.com",
    "birthDate": "1979-04-18",
    "nationality": "",
    "mobileCode": "9",
    "mobile": "99999999",
    "areaCode": "",
    "landline": "",
    "metadata": {}
  },
  "payingAddress": {
    "type": "",
    "street": "Av. de las Flores",
    "streetNumber": "50",
    "level": "201",
    "block": "13",
    "unitNumber": "13024",
    "reference": "",
    "municipality": "DOWNTOWN",
    "state": "CENTRAL STATE",
    "city": "1",
    "country": "CL",
    "zipCode": "",
    "metadata": {}
  },
  "inspectionPerson": {
    "lastName1": "Rojas",
    "lastName2": "Ortiz",
    "firstName": "Juan",
    "midName": "Jose",
    "idValue": "11111111-1",
    "idType": "rut",
    "gender": "M",
    "email": "jjrojas@correo.com",
    "birthDate": "1979-04-18",
    "nationality": "",
    "mobileCode": "9",
    "mobile": "99999999",
    "areaCode": "",
    "landline": "",
    "metadata": {}
  },
  "inspectionAddress": {
    "type": "",
    "street": "Av. de las Flores",
    "streetNumber": "50",
    "level": "201",
    "block": "13",
    "unitNumber": "13024",
    "reference": "",
    "municipality": "DOWNTOWN",
    "state": "CENTRAL STATE",
    "city": "1",
    "country": "CL",
    "zipCode": "",
    "metadata": {}
  }
}
```

| Parameter | Type | Nullable | Description
| ------ | ------ | ------ | ------
| channel |	String | false | The reference of the channel/broker associated to the message
| proposalId | String | false | ID of the lead associated to the insurance policy. This ID must remain unique across all policy renewals for this customer.
| policyId | String | false | The ID for the policy provided by the company.
| start | String | false | The start date of the policy in YYYY-MM-DD format.
| end | String | true | The end date of the policy if available, in YYYY-MM-DD format.
| url | String | true | A public-accesible URL of the insurance policy document (e.g. policy PDF).<br>_May be required depending on product configuration._
| imei | String | true | IMEI of the device assigned to this policy, if already assigned.
| plan | [QuotingPlan](#QuotingPlan) | false | A QuotingPlan object containing the quoting result selected by the customer. _Refer to the Appendix for detailed information._
| insuredVehicle | [VehicleData](#VehicleData) | false | A VehicleData object containing the insured vehicle data captured by the lead. _Refer to the Appendix for detailed information._
| insuredPerson | [PersonData](#PersonData) | false | A PersonData object containing the insured person data captured by the lead. _Refer to the Appendix for detailed information._
| insuredAddress | [AddressData](#AddressData) | false | An AddressData object containing the insured address data captured by the lead. _Refer to the Appendix for detailed information._
| contractingPerson | [PersonData](#PersonData) | true | A PersonData object containing the contracting person data captured by the lead. If this object is not provided, the values from `insuredPerson` will be used instead. _Refer to the Appendix for detailed information._
| contractingAddress | [AddressData](#AddressData) | true | An AddressData object containing the contracting address data captured by the lead. If this object is not provided, the values from `insuredAddress` will be used instead. _Refer to the Appendix for detailed information._
| deliveryPerson | [PersonData](#PersonData) | true | A PersonData object containing the delivery person data captured by the lead. If this object is not provided, the values from `insuredPerson` will be used instead. _Refer to the Appendix for detailed information._
| deliveryAddress | [AddressData](#AddressData) | true | An AddressData object containing the delivery address data captured by the lead. If this object is not provided, the values from `insuredAddress` will be used instead. _Refer to the Appendix for detailed information._
| payingPerson | [PersonData](#PersonData) | true | A PersonData object containing the paying person data captured by the lead. If this object is not provided, the values from `insuredPerson` will be used instead. _Refer to the Appendix for detailed information._
| payingAddress | [AddressData](#AddressData) | true | An AddressData object containing the paying address data captured by the lead. If this object is not provided, the values from `insuredAddress` will be used instead. _Refer to the Appendix for detailed information._
| inspectionPerson | [PersonData](#PersonData) | true | A PersonData object containing the inspection person data captured by the lead. If this object is not provided, the values from `insuredPerson` will be used instead. _Refer to the Appendix for detailed information._
| inspectionAddress | [AddressData](#AddressData) | true | An AddressData object containing the inspection address data captured by the lead. If this object is not provided, the values from `insuredAddress` will be used instead. _Refer to the Appendix for detailed information._

### B. Proposal Confirm
_This event only applies to leads created through the Jooycar Presale API._
The Proposal Confirm message should be sent for every lead that was received by the insurance company through the [Proposal New](#3ProposalNew) outgoing event, and was later approved by the insurance company to become a policy.

Subject: `proposal/confirm`
Body:
```json
{
  "channel": "ChannelName",
  "id": "5a12ed57c7c51d0b6a8de9c5",
  "status": "accepted",
  "policyId": "0075543",
  "start": "2020-01-16",
  "end": "2021-01-16",
  "url": "https://...",
  "imei": "364538572943587",
  "vin": "VF14RSMB4JA411705",
  "metadata": {}
}
```

| Parameter | Type | Nullable | Description
| ------ | ------ | ------ | ------
| channel |	String | false | The reference of the channel/broker associated to the message
| id | String | false | Jooycar ID for the lead
| status | String | false | The confirmation status for the proposal. One of:<br>-`accepted`<br>-`rejected`
| policyId | String | true | An unique ID for the policy provided by the company.<br>_Required if status is `accepted`._
| start | String | true | The start date of the policy in YYYY-MM-DD format.<br>_Required if status is `accepted`._
| end | String | true | The end date of the policy if available, in YYYY-MM-DD format.
| url | String | true | A public-accesible URL of the insurance policy document (e.g. policy PDF).<br>_May be required depending on product configuration._
| imei | String | true | IMEI of the device assigned to this policy, if already assigned.
| vin | String | true | VIN of the vehicle
| metadata | Object | true | An object containing any other information related to the policy. <br>{ string : any }

### C. Insurance Policy Renewal
This message defines new attributes to be set on the renewal of an existing policy on the Jooycar Platform. Attributes may refer to the new insurance conditions the customer is bound to.

Subject: `insurance_policy/renew`
Body:
```json
{
  "channel": "ChannelName",
  "leadId": "53c8ed5fc3b7bd0b322016aa",
  "proposalId": "9876540",
  "policyId": "6012345.111.222",
  "start": "2019-03-21",
  "end": "2020-03-21",
  "url": "https://...",
  "plan": {
    "currency": "CLF",
    "distancePrice": 0.0012,
    "fixedPrice": 0.43548,
    "maxPrice": 2.41548,
    "distance": "KM",
    "maxDistance": 1650,
    "extraCurrencies": [
      {
        "currency": "CLP",
        "currencyRate": 27532.8
      }
    ],
    "metadata": {
      "deductible": "5",
      "code": 1069,
      "premium": "0.001259",
      "default": true,
      "position": 0,
      "label": "Más vendido"
    }
  },
  "metadata": {}
}
```
| Parameter | Type | Nullable | Description
| ------ | ------ | ------ | ------
| channel |	String | false | The reference of the channel/broker associated to the message
| leadId | String | true | ID of the lead associated to the insurance policy.<br>**Required if proposalId not present.**
| proposalId | String | true | ID of the proposal associated to the insurance policy (provided by the company).<br>**Required if leadId not present.**
| policyId | String | false | The unique ID provided by the company for the next current policy.
| start | String | false | The start date of the policy in YYYY-MM-DD format.
| end | String | true | The end date of the policy if available, in YYYY-MM-DD format.
| url | String | true | A public-accesible URL of the insurance policy document (e.g. policy PDF).<br>_May be required depending on product configuration._
| plan | [QuotingPlan](#QuotingPlan) | false | A QuotingPlan object containing the quoting result selected by the customer. _Refer to the Appendix for detailed information._
| metadata |	Object |	true |	An object containing any other information related to the policy.<br>{ string : any }

### D. Insurance Policy Terminate
This message informs the Jooycar Platform that a currently active policy has to be terminated, for any reason. This activates the termination flow on the selected proposal.

Subject: `insurance_policy/terminate`
Body:
```json
{
  "channel": "ChannelName",
  "leadId": "53ff63b7bd5fcb328d0548ab",
  "proposalId": "9876540",
  "policyId": "5992943.123.456",
  "end": "2020-05-17",
  "reason": "notRenewed",
  "deviceStatus": "returned",
  "message": "The vehicle is now too old to be insured by the company"
}
```

| Parameter | Type | Nullable | Description
| ------ | ------ | ------ | ------
| channel | String | false | The reference of the channel/broker associated to the message
| leadId | String | true | ID of the lead associated to the insurance policy.<br>**Required if proposalId not present.**
| proposalId | String | true | ID of the proposal associated to the insurance policy (provided by the company).<br>Required if leadId not present.
| policyId | String | false | The ID of the policy provided by the company
| end | String | false | The day of the policy termination, in YYYY-MM-DD format.
| reason | String | false | Reason for the policy termination. Must be one of the following values:<br>**clientRequest**: The insured client ends the policy on his own.<br>**notRenewed**: The company will not renew the client policy for a new period.<br>**morosity**: The company ends the policy because the client exceeded a certain unpaid payments threshold.<br>**loss**: The company ends the policy given the insured vehicle has loss.
| deviceStatus | String | false | Information about the status of the device related with policy termination. Value must be one of:<br>**returned**: The company already has the device associated to this policy in its stock, so no logistics pickup is required.<br>**pendingValidation**: Status of the device is not available at the moment, it will be informed later.<br>**notReturned**: The client still has the device, so the company requests logistics pickup to retrieve the associated device back to stock.
| message | String | true | Free text message related to the termination (e.g. comments about termination)


# Appendix

The appendix section contains extended information on various definitions of this document.

## Data Definitions
These are data type definitions that are used on various event messages. Each one has its own definition.

### AddressData
This object holds attributes that describes an address.

Example:
```json
{
  "type": "",
  "street": "Av. de las Flores",
  "streetNumber": "50",
  "level": "201",
  "block": "13",
  "unitNumber": "13024",
  "reference": "",
  "municipality": "DOWNTOWN",
  "state": "CENTRAL STATE",
  "city": "RED CITY",
  "country": "CL",
  "zipCode": "",
  "metadata": {}
}
```

| Parameter | Type | Nullable | Description
| ------ | ------ | ------ | ------
| type | String | true | Type description 
| street | String | true | Street name 
| streetNumber | String | true | Street number 
| level | String | true | Level department 
| block | String | true | Block number 
| unitNumber | String | true | Unit 
| reference | String | true | Reference address 
| municipality | String | true | Municipality 
| state | String | true | State 
| city | String | true | City 
| country | String | true | Country as an ISO 3166 country code. Please refer to [the ISO 3166 site](https://www.iso.org/iso-3166-country-codes.html) for details on country codes
| zipCode | String | true | Zip code 
| metadata | Object | true | An object containing any other information related to the address.<br>{ string : any }


### BalanceItem
This object holds attributes relative to a billing item, depending on its description

Example:
```json
{
  "type": "tripDistance",
  "value": 0,
  "currency": "CLP",
  "description": "Prima por distancia recorrida (0 KM)",
  "metadata": {
      "distance": 0
  },
  "extraCurrencies": [
        {
          "value": 0,
          "currency": "CLF"
        }
      ]
    }
```

| Parameter | Type | Nullable | Description
| ------ | ------ | ------ | ------
| type | String | false | A type is a description the billing item. One of:<br>`- fixed` <br>`- tripDistance` <br>`- unreportedDistance` <br>`- disconnectionPenalty` <br>`- installationPenalty` <br>`- credit` <br>`- limitDiscount`
| value | Number | false | An amount for this type
| currency | String | false | A unit monetary
| description | String | false | A description complement the type
| metadata | Object | false | An object containing any other information related to the balance. <br>{ string : any }
| metadata.periodSize | Number | true | The amount of days the policy was active for the balance period
| metadata.distance | Number | true | The distance that should be billed to the client
| metadata.unreportedDistance | Number | true | The unreported distance that should be billed to the client
| metadata.disconnectionDays | Number | true | The amount of days the device associated to the policy was detected as disconnected from the vehicle
| metadata.penaltyDays | Number | true | The amount of days the device associated to the policy was not installed since the policy start
| extraCurrencies | Array<Object> | false | A list of different money currencies for various purposes (e.g. display pricing). Extra currency data is subject to product configuration.
| extraCurrencies.value | Number | false | The exchange rate of this currency relative to the main billing currency
| extraCurrencies.currency | String | false | The ISO 4217 code of the money currency this object and its attributes are related to. Please refer to the ISO 4217 site for details on currency codes.


### PaymentAttemptData
This object holds attributes relative to a payment attempt, depending on its strategy

Example:
```json
{
  "strategy": "TransbankOneClick",
  "resultData": {
    "responseCode": "0",
    "authorizationCode": "077272",
    "buyOrder": "20201003143516646",
    "creditCardType": "MasterCard",
    "last4CardDigits": "1398",
    "transactionId": "42784540"
  }
}
```

| Parameter | Type | Nullable | Description
| ------ | ------ | ------ | ------
| strategy | String | false | A strategy code for the payment strategy used
| subscriptionData | Object | false | An Object containing attributes relative to the payment strategy defined by the sibling `strategy` attribute

**Subscription Strategies**
> Code: **TransbankOneClick**
> Example:
> ```json
> {
>   "responseCode": "0",
>   "authorizationCode": "077272",
>   "buyOrder": "20201003143516646",
>   "creditCardType": "MasterCard",
>   "last4CardDigits": "1398",
>   "transactionId": "42784540"
> }
> ```
> | Parameter | Type | Nullable | Description
> | ------ | ------ | ------ | ------
> | responseCode | String | false | The response code returned from Transbank.
> | authorizationCode | String | true | Authorization code for this transaction. This attribute may be missing if the transaction was not successful.
> | buyOrder | String | true | The order ID generated for this transaction. This attribute may be missing if the transaction was not successful.
> | creditCardType | String | true | The credit card type associated to this subscription. This attribute may be missing if the transaction was not successful.
> | last4CardDigits | String | true | The credit card's last 4 digits. This attribute may be missing if the transaction was not successful.
> | transactionId | String | true | The ID of this transaction. This attribute may be missing if the transaction was not successful.

### PersonData
This object holds attributes that describes a person.

Example:
```json
{
  "lastName1": "Rojas",
  "lastName2": "Ortiz",
  "firstName": "Juan",
  "midName": "Jose",
  "idValue": "11111111-1",
  "idType": "rut",
  "gender": "M",
  "email": "jjrojas@correo.com",
  "birthDate": "1979-04-18",
  "nationality": "",
  "mobileCode": "9",
  "mobile": "99999999",
  "areaCode": "",
  "landline": "",
  "metadata": {}
}
```

| Parameter | Type | Nullable | Description
| ------ | ------ | ------ | ------
| lastName1 | String | true | Last name
| lastName2 | String | true | Second last name
| firstName | String | true | First name
| midName | String | true | Middle name 
| idValue | String | true | A National ID of this person
| idType | String | tue | The National ID document type
| gender | String | true | The person gender 
| email | String | true | Email address 
| birthDate | String | true | Birthday date in YYYY-MM-DD format
| nationality | String | true | The nationality as an ISO 3166 country code, or XX if declared as foreigner without nationality details. Please refer to [the ISO 3166 site](https://www.iso.org/iso-3166-country-codes.html) for details on country codes
| mobileCode | String | true | Access code number for mobile
| mobile | String | true | Mobile phone number
| areaCode | String | true | Access code number for landline
| landline | String | true | Landline phone number
| metadata | Object | true | An object containing any other information related to the person.<br>{ string : any } 

### QuotingPlan
This object is a representation of the quote plan attributes for a Jooycar Paypermile product.

Example:
```json
{
  "currency": "CLF",
  "distancePrice": 0.0012,
  "fixedPrice": 0.43548,
  "maxPrice": 2.41548,
  "distance": "KM",
  "maxDistance": 1650,
  "extraCurrencies": [
    {
      "currency": "CLP",
      "currencyRate": 27532.8
    }
  ],
  "metadata": {
    "deductible": "5",
    "code": 1069,
    "premium": "0.001259",
    "default": true,
    "position": 0,
    "label": "Más vendido"
  }
}
```

| Parameter | Type | Nullable | Description
| ------ | ------ | ------ | ------
| currency | String | true | The ISO 4217 code of the money currency related to each _\*Price_ attribute sibling to this. This currency is treated as the main billing currency. Please refer to [the ISO 4217 site](https://www.iso.org/iso-4217-currency-codes.html) for details on currency codes.<br>**Always required/present if any _\*Price_ siblings attributes are present.**
| distancePrice | Number | true | The price per distance unit which will determine trip distance billing.<br>_This attribute could not be present/required depending on product configuration._<br>_This attribute is subject to rounding depending on product configuration._
| fixedPrice | Number | true | The fixed price to be charged every billing cycle regardless of driving distance.<br>_This attribute could not be present/required depending on product configuration._<br>_This attribute is subject to rounding according to product configuration._
| maxPrice | Number | true | The maximum price that should be billed to the client on a single billing cycle. If this value is not provided, a default value will be used based on the formula `distancePrice * maxDistance + fixedPrice`.<br>_This attribute could not be present/required depending on product configuration._<br>_This attribute is subject to rounding according to product configuration._
| maxDistance | Number | true | The maximum distance that should be billed to the client on a single billing cycle.<br>_This attribute could not be present/required depending on product configuration._<br>_This attribute is subject to rounding according to product configuration._
| initialDistance | Number | true | The distance already consumed from the first billing period. If not present, the value 0 is assumed.<br>_This attribute is subject to rounding according to product configuration._
| extraCurrencies | Array | true | A list of different money currencies for various purposes (e.g. display pricing). Extra currency data is subject to product configuration.
| extraCurrencies[].currency | String | false | The ISO 4217 code of the money currency this object and its attributes are related to. Please refer to [the ISO 4217 site](https://www.iso.org/iso-4217-currency-codes.html) for details on currency codes.
| extraCurrencies[].currencyRate | Number | false | The exchange rate of this currency relative to the main billing currency. This value may be used to calculate values like distancePrice and others on a different currency for display or billing purposes, that depending on product configuration.
| metadata | Object | false | An object containing client custom quoting attributes. Attribute definition is subject to product configuration


### PaymentSubscriptionData
This object holds attributes relative to a payment subscription, depending on its strategy

Example:
```json
{
  "strategy": "TransbankOneClick",
  "subscriptionData": {
    "subscriptionDate": "2019-11-17T23:13:43.000Z",
    "authCode": "459329",
    "creditCardType": "AmericanExpress",
    "last4CardDigits": "1755"
  }
}
```

| Parameter | Type | Nullable | Description
| ------ | ------ | ------ | ------
| strategy | String | false | A strategy code for the subscription strategy used
| subscriptionData | Object | false | An Object containing attributes relative to the subscription strategy defined by the sibling `strategy` attribute

**Subscription Strategies**
> Code: **TransbankOneClick**
> Example:
> ```json
> {
>   "subscriptionDate": "2020-04-24T17:43:56.000Z",
>   "authCode": "348238",
>   "creditCardType": "MasterCard",
>   "last4CardDigits": "8891"
> }
> ```
> | Parameter | Type | Nullable | Description
> | ------ | ------ | ------ | ------
> | subscriptionDate | String | false | The effective date of the subscription as an ISO 8601 Date
> | authCode | String | false | Authorization code for this subscription
> | creditCardType | String | false | The credit card type associated to this subscription
> | last4CardDigits | String | false | The credit card's last 4 digits

### VehicleData
This object holds attributes that describe a vehicle.

Example:
```json
{
  "brandCode": "5",
  "displayBrand": "CHEVROLET",
  "modelCode": "1535",
  "displayModel": "AVEO",
  "subModelCode": "",
  "displaySubModel": "",
  "year": "2018",
  "isNew": "2",
  "plate": "JLKK47",
  "vehicleType": "1",
  "usage": "particular",
  "color": "Blanco",
  "engineNumber": "",
  "chassisNumber": "",
  "metadata": {}
}
```

_Note: All attributes on this object could either have a value or be empty, that depending on available data and product configuration_
| Parameter | Type | Nullable | Description
| ------ | ------ | ------ | ------
| brandCode | String | true | Normalized vehicle brand code (e.g. code for Toyota)
| displayBrand | String | true | A human readable name for the vehicle brand, for displaying purposes.
| modelCode | String | true | Normalized vehicle model code (e.g. code for Corolla)
| displayModel | String | true | A human readable name for the vehicle model, for displaying purposes.
| subModel | String | true | Normalized vehicle submodel code (e.g. code for 1.8 Diesel variant)
| displaySubModel | String | true | A human readable name for the vehicle submodel, for displaying purposes.
| year | String | true | Vehicle year model
| isNew | String | true | Normalized code indicating if vehicle is new or used (e.g. 1 for new, 0 for used)
| plate | String | true | Registered vehicle plate
| vehicleType | String | true | Normalized vehicle type (e.g. motorcycle, truck, pickup, etc.)
| usage | String | true | Vehicle usage type (e.g. particular, commercial)
| color | String | true | Color of the vehicle
| engineNumber | String | true | Registered engine number
| chassisNumber | String | true | Registered chassis number
| metadata | Object | false | An object containing client custom vehicle attributes. Attribute definition is subject to product configuration
