Purchase Insurance Products
Purchase an Insurance Product
You can make it possible for customers to purchase any insurance product from your user interface; under the hood, they are making a POST request to the Purchase an insurance product for a customer endpoint.
Required Parameters
When purchasing any insurance product, a bunch of parameters is required in the body of your request:
product_code
: the code of the insurance product to be purchased; this can be found on the list of each available insurance product.customer_ref
: this is a unique identifier for each customer making the order. It is generated when a customer is created.payment_type
: This indicates how a customer wants to pay for the purchase/order. The values are wallet or bank_transfer.policy_start_date
: This denotes when the insurance policy would start coverage. It is in date format.
List an Insurance Type
To obtain the list of a particular type of insurance, you simply pass the query parameter type and the insurance type as its value to the List available insurance products endpoint.
'https://api.playbox.grow.curacel.co/api/v1/products?type=<value>'
If you want to see every available insurance type, List Insurance Product Type.
At this point, let's walk through some of the insurance product types available on the Grow API.
Pre-requisites
- You need to have cURL installed on your PC or Mac. In case you do not have cURL installed, check out this guide.
- Your unique API key to authenticate requests to the server. If you do not have an API key, generate Grow API key here.
- (Optional) A Postman environment, to make easy API requests to every endpoint at a go. Set up Grow with Postman here.
Marine Insurance 🚢
The body parameters associated with marine insurance types are explained thus:
Parameter | Description |
---|---|
asset_value | The value of the asset the product covers |
pickup_location | The pickup location of the shipment/parcel. Usually the origin port |
dropoff_location | The dropoff location of the shipment/parcel. Usually the destination port |
asset_ref | This represents the asset the order covers |
Right now, let's purchase a marine product on the Sandbox server called SMART INSURE LITE, with the id
of 7. Using its code
of 435te
, you now have one of the required parameters, the product_code
.
Request
curl --location --request POST 'https://api.playbox.grow.curacel.co/api/v1/orders' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer <YOUR_API_KEY>' \
--data-raw '{
"product_code": "435te",
"customer_ref": "189jwsf7",
"payment_type": "wallet",
"policy_start_date": "2023-01-28",
"asset_value": 12500.58,
"pickup_location": "fugiat est ullamco tempor",
"dropoff_location": "cupidatat id laboris dolore",
"asset_ref": "rwt345"
}'
Response
{
"order": {
"id": 4866,
"asset_ref": "rwt345",
"product_price": 34.38,
"partner_commission": 0.34,
"amount_due": 34.04,
"currency": "NGN",
"payment_instructions": {
"message": "Payment successful",
"success": true
},
"payment_gateway_charge": null,
"status": "paid"
}
}
Credit Life Insurance 💵
Purchasing credit life insurance may involve even more information parameters due to the number of things it covers.
Parameter | Description |
---|---|
asset_value | This is also the same as the loan amount |
maturity_date | The date when the final payment of a loan, bond or other financial product is due |
loan_duration | The duration of the loan to be insured in months, should not exceed 12 months |
monthly_loan_instalment | This is for loans lasting more than one month, the amount returned every month by the customer |
business_address | The address of the customer's business/company |
nature_of_business | The nature of business the customer operates |
Request
On your terminal or Git Bash, make a POST request to purchase a credit life product.
curl --location --request POST 'https://api.playbox.grow.curacel.co/api/v1/orders' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer <YOUR_API_KEY>' \
--data-raw '{
"product_code": "435te",
"customer_ref": "189jwsf7",
"payment_type": "wallet",
"policy_start_date": "2023-04-28",
"asset_value": 12500.58,
"asset_ref": "rwt345",
"loan_duration": 4,
"maturity_date": "2022-01-31",
"monthly_loan_instalment": 900,
"business_address": "Block A, Lagos street, ...",
"nature_of_business": "Logistics"
}'
Response
{
"order": {
"id": 4867,
"asset_ref": "rwt345",
"product_price": 34.38,
"partner_commission": 0.34,
"amount_due": 34.04,
"currency": "NGN",
"payment_instructions": {
"message": "Payment successful",
"success": true
},
"payment_gateway_charge": null,
"status": "paid"
}
}
Goods In Transit (GIT) 🚚
For this type of product, similar to the marine product, pickup and dropoff locations should be specified alongside other parameters.
Parameter | Description |
---|---|
asset_value | The value of the asset the product covers |
pickup_location | This is the pickup address |
dropoff_duration | This is the destination address |
trip_frequency | This indicates whether it is a one-off or recurring trip. It takes two values single and recurring . The default is recurring if none is specified |
trips_per_day | This is required when trip_frequency is set to recurring . It indicates the number of trips per day |
trip_days_per_year | This is required when trip_frequency is set to recurring . It indicates the number of days in a year that has trips (max of 365) |
Request
curl --location --request POST 'https://api.playbox.grow.curacel.co/api/v1/orders' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer <YOUR_API_KEY>' \
--data-raw '{
"product_code": "435te",
"customer_ref": "189jwsf7",
"payment_type": "wallet",
"policy_start_date": "2022-04-28",
"asset_value": 12500.58,
"trip_frequency": "recurring",
"trips_per_day": 92155490,
"trip_days_per_year": -64146670,
"pickup_location": "fugiat est ullamco tempor",
"dropoff_location": "cupidatat id laboris dolore"
}'
Response
{
"order": {
"id": 4868,
"asset_ref": null,
"product_price": 34.38,
"partner_commission": 0.34,
"amount_due": 34.04,
"currency": "NGN",
"payment_instructions": {
"message": "Payment successful",
"success": true
},
"payment_gateway_charge": null,
"status": "paid"
}
}
Travel Insurance 🛫
When purchasing travel products, the travel_duration
parameter is required; it represents the number of days the travel is billed to last. This means it takes a maximum value of 365
curl --location --request POST 'https://api.playbox.grow.curacel.co/api/v1/orders' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer <YOUR_API_KEY>' \
--data-raw '{
"product_code": "435te",
"customer_ref": "189jwsf7",
"payment_type": "wallet",
"policy_start_date": "2022-04-28",
"asset_value": 12500.58,
"travel_duration": 365
}'
Response
{
"order": {
"id": 4869,
"asset_ref": null,
"product_price": 34.38,
"partner_commission": 0.34,
"amount_due": 34.04,
"currency": "NGN",
"payment_instructions": {
"message": "Payment successful",
"success": true
},
"payment_gateway_charge": null,
"status": "paid"
}
}
For full details of the parameters that can be used when making a purchase, refer to the Purchase an insurance product for a customer reference.