Create a parcel

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.

Building request

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.

Arguments

This API call can receive eight arguments, six are required:

Entry Data type Description
parcel_value Integer Required Total value of the order in euro cents.
first_name String Required Customer first name.
last_name String Required Customer last name.
email String Required Customer email address.
full_address String Required Customer full address.
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.
send_email Boolean Send a confirmation email to the customer. Two possible values: "true" or "false". Default value: "true".
recipient_email String Recipient email address.
lang String Language used for the insurance confirmation email sent to the customer. Two possible values: "fr" or "en". Default value: "en".

Response informations

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.
email String Customer email address.
company String Customer company name.
full_address String Customer full address.
parcel_value Integer Total value of the order in euro cents.
price Integer 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.

Request

curl https://developer.secursus.com/api/parcels/new \
-u your_apiKey:your_secretKey \
-d parcel_value=8000 \
-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 cart_data="{json_object}" \
-d recipient_email="john.doe@domain.com" \
-d send_email=true \
-d lang=en

Response

{
"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,
"cart_data": {json_object},
"invoice_id": null,
"mode": "production",
"creation": "2019-05-25 17:51:51"
}
}
}
...
...