Library for Secursus API.

V1.0.3 2020-01-15 23:20 UTC

This package is not auto-updated.

Last update: 2020-09-10 02:22:31 UTC


README

Secursus is the most powerful digital insurance for parcels, covering the most sensitive items and up to €100,000 per parcel. To integrate the insurance service in your website, we provide this php library that will allow you to automate your insurance orders.

For more information about the product, please visit our website : https://www.secursus.com/integration/

Prerequisite

To use the Secursus API, you need to create an account on our platform and activate it.

https://www.secursus.com/integration/registration.php

Installation

composer require secursus/api

Usage

use Secursus\Api;

// Set your API credentials here
$secursus = new Api(
    "YOUR_API_ID", 
    "YOUR_API_KEY"
);

// And call methods after
$action = $secursus->retrieveParcelOrder("YOUR_PARCEL_ID");

Documentation

Get the insurance amount fees

This method is used to calculate the amount of insurance fees.

More details : https://developer.secursus.com/parcels/fees

Usage

$insuranceAmount = $secursus->getInsuranceAmount(10000);

Argument

The create parcel order method can receive only one argument, the parcel value. This argument need to be an integer and represents the total value of the parcel in euro cents.

Create parcel order

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.

More details : https://developer.secursus.com/parcels/create

Usage

$parcelOrder = $secursus->createParcelOrder($data);

Data argument

The create parcel order method can receive an Array who can contains these eight arguments (six are required):

EntryRequiredData typeDescription
parcel_valueYesIntegerTotal value of the order in euro cents.
first_nameYesStringCustomer first name.
last_nameYesStringCustomer last name.
emailYesStringCustomer email address.
full_addressYesStringCustomer full address.
cart_dataYesJsonDetails of cart on your website. No specific format is required, this information will be analyzed for any claim.
companyNoStringCustomer company name.
langNoStringLanguage used for the insurance confirmation email sent to the customer. Two possible values: "fr" or "en". Default value: "en".

Retrieve a parcel order

This method is used to get the insurance credentials and parcel informations.

Usage

$parcelOrder = $secursus->retrieveParcelOrder($idParcelOrder);

Argument

The retrieve parcel order method can receive only one argument, the parcel id. This argument need to be a string and is the insurance id generated by the createParcelOrder method.

Retrieve a current parcel report

This method is used to get the list of all parcels to due during the current month.

Usage

$parcelOrder = $secursus->retrieveCurrentReport();

Retrieve a history parcel report

This method is used to get the list of all parcels of the account.

Usage

$parcelOrder = $secursus->retrieveHistoryReport();

Cancel a parcel order

This method is used to cancel an insurance order that you previously sent.

Note: Once the insurance request has been created, you have 12 hours if you want to cancel the insurance order. After this period, the insurance order is considered as confirmed and can't be canceled. The insurance fees are then payable.

More details : https://developer.secursus.com/parcels/cancel

Usage

$parcelOrder = $secursus->cancelParcelOrder($idParcelOrder);

Argument

The retrieve parcel order method can receive only one argument, the parcel id. This argument need to be a string and is the insurance id generated by the createParcelOrder method.