Insurance
API Path
Premium and Payment

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 paymentOutside Lunixi
Where the premium isA separate item in your payment's basketYour own payment
How it is linked to the orderbind-payment, or by the premium item when the payment is capturedconfirm-payment
When the policy is requestedWhen the payment is captured, automaticallyWith issue-policy
Premium refundFrom your Lunixi payment, for the premium amountThrough 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.

Insurance flow linked to a Lunixi paymentProcess: check eligibility, get a quote, create the order, create the payment with the premium item, bind the order to the payment; when the buyer pays and the payment is captured the policy is requested automatically, and you track the order.EligibilityPOST …/productsQuotePOST …/quotesOrderPOST …/ordersPayment + premium itemPOST /payments/intentsBind to the paymentPOST …/{orderId}/bind-paymentBuyer payspolicy requested automaticallyTrack the orderGET …/orders/{orderId}LEGENDYOUR CALLCAPTURED — POLICY REQUESTEDEND
… 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, same price and same insurance fields. If you sent context.items[].insuranceData in 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

FieldValue
idThe order's orderId value (inso_…).
priceThe order's premiumAmount value, in minor units.
itemTypeVIRTUAL
nameThe name the buyer sees; for example the option's title value.
category1Your own category.
  • The premium item carries no insurance fields. If an item with an inso_ ID carries insurance fields, the payment request is rejected with 400 VALIDATION_ERROR.
  • The basket contains a single premium item per order.
  • The sum of the items' price values must equal the payment request's amount field. 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 use bind-payment.
  • Bind before the option expires: bind-payment returns 409 insurance.quote.expired for an expired option.
  • If the payment's insured items differ from the quoted items (id, amount or insured value), binding returns 409 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 COLLECTED and the policy is requested as PENDING.
  • 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, errorCode becomes insurance.premium.not_captured and no policy is requested.
  • The policy is attempted until the product's deadline. If it definitively cannot be issued, the policy becomes FAILED_FINAL and the refund REQUIRED: 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.

Insurance-only flowProcess: check eligibility, get a quote and create the order; you collect the premium through your own channel, report the payment with confirm-payment, which Lunixi forwards to your provider, request the policy with issue-policy and track the order.EligibilityPOST …/productsQuotePOST …/quotesOrderPOST …/ordersCollect the premiumyour own channelReport the paymentPOST …/{orderId}/confirm-paymentRequest the policyPOST …/{orderId}/issue-policyTrack the orderGET …/orders/{orderId}LEGENDYOUR CALLOUTSIDE LUNIXIFORWARDED TO YOUR PROVIDEREND
… 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.

Related