This API call is used to create an insurance order for an order of your website.
A parcel object is created and the insurance credentials are returned. Once the object has been created, you have 12 hours if you want to cancel the insurance order.
This API call is made through the POST protocol with the sending of some arguments. Authentication is required and works with the rules of HTTP basic access authentication.
This API call can receive eight arguments, six are required:
Entry | Data type | Description |
---|---|---|
parcel_value | Integer | Required Total value of the order in currency cents. |
first_name | String | Required Customer first name. |
last_name | String | Required Customer last name. |
internal_reference | String | Your parcel internal reference |
String | Required Customer email address. | |
full_address | String | Required Customer full address. |
country_origin | String | Required Country origin of the parcel. |
country_destination | String | Required Country destination of the parcel. |
cart_data | Json | Required Details of cart on your website. No specific format is required, this information will be analyzed for any claim. |
company | String | Customer company name. |
currency | String | Currency used for the insurance. Three possible values: "eur", "gbp" or "usd". Default value: "eur". |
send_email | Boolean | Send a confirmation email to the customer. Two possible values: "true" or "false". Default value: "true". |
lang | String | Language used for the insurance confirmation email sent to the customer. Three possible values: "en", "de" or "fr". Default value: "en". |
recipient_email | String | Recipient email address. |
recipient_lang | String | Language used for the insurance confirmation email sent to the recipient. Three possible values: "en", "de" or "fr". Default value: lang value if is setted, else "en". |
The response data contains these informations :
Entry | Data type | Description |
---|---|---|
type | String | Object type called by the API request. |
id | String | Registered parcel insurance identifier. |
first_name | String | Customer first name. |
last_name | String | Customer last name. |
String | Customer email address. | |
company | String | Customer company name. |
full_address | String | Customer full address. |
parcel_value | Integer | Total value of the order in currency cents. |
price | Integer | Amount of insurance fees in currency cents. |
currency | String | Currency code used for the insurance. |
parcel_value_eur | Integer | Converted total value of the order in euro cents. |
price_eur | Integer | Converted amount of insurance fees in euro cents. |
cart_data | Json | Cart details that you have insured. |
invoice_id | String | Returns the related invoice number of the parcel. If isn't exist return null. |
mode | String | Returns if registered parcel is in test mode or in production mode. |
creation | Datetime | Creation date of the insurance order. |
curl https://developer.secursus.com/api/parcels/new \
-u your_apiKey:your_secretKey \
-d parcel_value=8000 \
-d currency="gbp" \
-d first_name="John" \
-d last_name="Doe" \
-d email="john.doe@domain.com" \
-d company="John Doe Inc." \
-d full_address="10 test road, SW1A 1AA London, UK" \
-d country_origin="gb" \
-d country_destination="gb" \
-d cart_data="{json_object}" \
-d send_email=true \
-d lang=en \
-d recipient_email="john.doe@domain.com" \
-d recipient_lang=en
{
"response": {
"success": true,
"status": "200",
"title": "OK",
"detail": "Transaction successfully completed. This parcel is registered."
},
"data": {
"type": "parcel",
"id": "201905-XXXXXXXX",
"attributes": {
"first_name": "John",
"last_name": "Doe",
"email": "john.doe@domain.com",
"company": "John Doe Inc.",
"full_address": "10 test road, SW1A 1AA London, UK",
"parcel_value": 8000,
"price": 500,
"currency": "gbp",
"parcel_value_eur": 9391,
"price_eur": 587,
"cart_data": {json_object},
"invoice_id": null,
"mode": "production",
"creation": "2019-05-25 17:51:51"
}
}
}