Premium and Payment
This page is for orders whose premium you collect (premiumCollectedBy: MERCHANT). The premium is either an item of your Lunixi payment or a payment you take outside Lunixi. The policy is issued after the premium is collected.
If your provider collects the premium (premiumCollectedBy: PROVIDER), use Provider Collection instead of this page.
| With a Lunixi payment | Outside Lunixi | |
|---|---|---|
| Where the premium is | A separate item in your payment's basket | Your own payment |
| How it is linked to the order | bind-payment, or by the premium item when the payment is captured | confirm-payment |
| When the policy is requested | When the payment is captured, automatically | With issue-policy |
| Premium refund | From your Lunixi payment, for the premium amount | Through your own channel; you report the refund to the API |
With a Lunixi payment
The buyer pays for the product and the insurance in one payment. The premium is a separate item in your payment's basket; the item's ID is the insurance order's ID.
… stands for /api/v1/insurance. The ID of the premium item in the basket is the order ID; you do not call issue-policy in this flow.Get the quote with the items and create the order
Get the quote with the items you will send in the payment (context.items) and create an order with the option the buyer confirmed: Quotes, Orders. The orderId and premiumAmount in the order response are needed for the premium item.
Create the payment with the premium item
Create the payment with POST /api/v1/payments/intents (Checkout Form). The basket contains:
- The items you insure, as you sent them in the quote: same
id, samepriceand same insurance fields. If you sentcontext.items[].insuranceDatain the quote, you do not need to send it again in the payment request: the quote was obtained with these details and the pre-fill data is not compared when binding to the payment. - Your other items.
- The premium item (below).
Bind the order to the payment
Once the payment exists, bind the order to it with bind-payment: Binding to a payment. Binding checks the premium item and the basket right away; if there is an error, you fix it before the buyer pays.
The buyer completes the payment
The buyer completes the payment as usual. When the payment is captured, the premium counts as collected and the policy is requested automatically.
Track the policy
Track the order's policyStatus and policies[] fields through the order endpoint. When the policy is issued, get its document: Policy Document.
Premium item
| Field | Value |
|---|---|
id | The order's orderId value (inso_…). |
price | The order's premiumAmount value, in minor units. |
itemType | VIRTUAL |
name | The name the buyer sees; for example the option's title value. |
category1 | Your own category. |
- The premium item carries no insurance fields. If an item with an
inso_ID carries insurance fields, the payment request is rejected with400 VALIDATION_ERROR. - The basket contains a single premium item per order.
- The sum of the items'
pricevalues must equal the payment request'samountfield. So the payment amount is the sum of your items and the premium. Rule: Basket Items.
A payment request for a basket with two tickets and insurance with a premium of 39.80 TRY. The amounts are examples:
{
"amount": 103980,
"currency": "TRY",
"orderId": "order-1001",
"callbackUrl": "https://example.com/payments/callback",
"basketItems": [
{
"id": "ticket-1",
"name": "Izmir-Ankara train ticket",
"price": 50000,
"category1": "ticket",
"itemType": "VIRTUAL",
"insuranceCategory": "TICKET",
"insuranceTypes": ["TICKET_CANCELLATION"]
},
{
"id": "ticket-2",
"name": "Izmir-Ankara train ticket",
"price": 50000,
"category1": "ticket",
"itemType": "VIRTUAL",
"insuranceCategory": "TICKET",
"insuranceTypes": ["TICKET_CANCELLATION"]
},
{
"id": "inso_<32 hex characters>",
"name": "Ticket cancellation insurance",
"price": 3980,
"category1": "insurance",
"itemType": "VIRTUAL"
}
]
}Binding the order to the payment
- When you bind with
bind-payment, the rules are checked right away and an error is returned in the response. This is the recommended way. - If you do not call
bind-payment, the order is matched by the premium item in the basket and bound to the payment when the payment is captured. If the matching rules are not met, the order is not bound and no policy is requested; the captured amount stays in your payment and the order stays open. You cannot see this through an error response; so usebind-payment. - Bind before the option expires:
bind-paymentreturns409 insurance.quote.expiredfor an expired option. - If the payment's insured items differ from the quoted items (
id, amount or insured value), binding returns409 insurance.quote.stale. Get a new quote and create the order with the new option.
When the premium counts as collected
- The premium counts as collected when the captured amount of the payment reaches the premium: collection becomes
COLLECTEDand the policy is requested asPENDING. - In a pre-authorized payment, the authorization is not enough; a capture is needed. With partial captures, the premium first rule applies: the premium counts as collected when the total captured amount reaches the premium. Until then collection stays
PENDING. - If the payment is cancelled, expires or definitively fails before it is captured, collection becomes
FAILED,errorCodebecomesinsurance.premium.not_capturedand no policy is requested. - The policy is attempted until the product's deadline. If it definitively cannot be issued, the policy becomes
FAILED_FINALand the refundREQUIRED: Cancellation and Premium Refund › Refund required.
The premium in your payment record
- The premium reaches you with your payment as an item of your sale. You transfer the premium to your provider according to your agreement; Lunixi does not hold the premium on its own behalf.
- An amount refund you make from your payment yourself is not linked to the insurance and does not cancel the policy. To cancel the policy and refund the premium, use the insurance endpoints: Cancellation and Premium Refund.
Premium collected outside Lunixi
If you collected the premium through your own payment channel, you report the payment to Lunixi. Lunixi forwards the notification to your provider through your connection; it does not ask for a document or proof.
… stands for /api/v1/insurance. Lunixi forwards your payment notification to your provider through your connection; then you request the policy.Create the order
Get a quote and create an order with the option the buyer confirmed. Do not bind the order to a Lunixi payment.
Collect the premium
Collect the order's premiumAmount in its currency through your own channel.
Report the payment
Report the payment's ID, amount, currency and time with confirm-payment: Reporting a premium collected outside Lunixi. Report before the option expires. Collection becomes COLLECTED.
Request the policy
Request the policy with issue-policy: Requesting the policy. The policy is issued in the background; track the result through the order endpoint.
- The amount and currency you report must equal the order's premium.
- In this flow, refunds, chargebacks and disputes are between you and your provider. When you refund the premium, you report the refund to the API: Cancellation and Premium Refund › Refund outside Lunixi.
Related
- Orders and Payment Binding:
bind-payment,confirm-payment,issue-policy - Basket Items: item fields and the basket total rule
- Concepts and Statuses: collection and policy axes
- Provider Collection: orders whose premium the provider collects
- Insurance-Only Integration: the end-to-end flow without a Lunixi payment