Testing
You test insurance against the live API address, not a separate test address. There is no test-only base address, separate client or different call format.
https://api-gateway.lunixi.com/api/v1How test keys are created and how payments are processed in the test environment is on the general testing page: Testing. This page covers only what is specific to insurance.
What decides the environment
For insurance, your API key decides the environment. Insurance requests go only to your provider connections in the same environment as your key:
| Your API key | Connections used | Payment |
|---|---|---|
Test key (mk_test_…) | Only your connections in the Test environment | Processed in the test environment, no real money moves |
Live key (mk_live_…) | Only your connections in the Live environment | Processed in the live environment |
- Checkout Form path: The environment is the environment of the key you created the payment with. The form of a live payment shows only offers from your live connections; your test connection does not offer to that form.
- Merchant API path: The environment is the environment of the key you sign the request with. When you bind a quote to a payment, if the
paymentIntentIdwas created in the other environment the request is rejected with422and the reasonenvironment_mismatchon thepaymentIntentIdfield. - If you have no connection with the insurance type enabled in your key's environment, no offer is returned for that type.
You can keep the same insurance type enabled on your test and live connections at the same time; the environments do not mix.
Test connection
A test connection is set up with the credentials your provider gave you for its test environment.
- You add the connection in the panel on the POS Center > Insurance page, with Activate on the provider's card. Choose Test as the Environment and enter your provider's test credentials.
- The credentials are written to the secure vault and never shown again. You add a separate connection for the live environment.
- With Test connection you can verify the credentials against the provider. Test results are not stored; each test is a point-in-time check.
The connection's environment also decides which products you can enable on it:
| Product status | Test connection | Live connection |
|---|---|---|
| Available | Can be enabled | Can be enabled |
| Test only | Can be enabled | Cannot be enabled |
| Unavailable | Cannot be enabled | Cannot be enabled |
Steps
Prepare your test key
Sign your requests with your test key; see Authentication. Your key must have access to the insurance product.
Add the test connection and enable the product
Add a connection in the Test environment as described above. On the connection's Products and order screen, enable the product you will test and choose who collects the premium.
If the same insurance type is also enabled on another connection, the connection with the lower order is used first. If you have a live connection, disable that type on the live connection while you test.
Add the insurance fields to your basket items
Which insurance is offered is resolved from the insurance fields on the basket items; see Basket Items › Insurance fields. An item without insurance fields is not offered insurance.
Check that insurance is offered
- API path: Send the items you will send in the payment to
POST /api/v1/insurance/productsincontext.items. Thedata.productslist in the response shows the insurance types offered for these items and which items each type applies to (basketItemIds). This call is read-only; it does not create a quote. - Checkout Form path: Turn insurance on in the panel under Form Settings > Insurance. Then create a payment with your test key and insured basket items, and open the form. If there is an eligible offer, the form shows insurance.
If the list is empty or the form shows no insurance, see the checklist below.
Collect the premium with a test payment
If you collect the premium in a Lunixi payment, the payment is processed in the test environment with your test key and no real money moves. For payment scenarios (successful, declined, timeout), see Testing › TestBank.
If insurance is not offered
When insurance cannot be offered your payment does not stop; insurance is simply not shown and the eligibility list comes back empty. Check the following in order:
- Is insurance enabled on your account? Insurance and the path you use (Checkout Form or API) must be enabled on your account.
- Is insurance on in the panel, with the usage mode of your path selected? On the Insurance > General screen, Insurance on must be on and the mode of the path you use must be selected: Checkout form for the Checkout Form, API — linked to a Lunixi payment or API — external collection for the API. If you query eligibility by
paymentIntentId, the API — linked to a Lunixi payment mode is required: Insurance Menu › Usage mode. - Does the item carry insurance fields? If the item has no
insuranceCategory, or carriesinsuranceEligible: false, it is not offered insurance. - Does the requested type match the item category? A type you request with
insuranceTypesis not offered if it is not linked to the item category (insuranceCategory). - Is the type enabled on your account, and does the item meet the eligibility conditions? You must have enabled and saved the type on the Insurance > Insurance Types screen: Insurance Menu › Insurance Types. For example, if there is an amount limit, the item's insured value must be within it.
- Do you have a usable connection where the type is enabled? The connection must not be Disabled, the product must be enabled on it, and the product must be available in the connection's environment. Test only products are not used on a live connection.
- On the Checkout Form, is the form setting on? If the Form Settings > Insurance setting is off, the form never shows insurance. This setting is locked while you have no active insurance connection.
Test data
- Do not use real personal data. Do not send an identity number, name, date of birth, email, phone number or address that belongs to a real person in test requests.
- Validation is the same in the test environment. Format rules are not relaxed. For example, the check digits of a TCKN are validated in test requests too, so you need a test value that follows the format. Rules: Data Formats.
- If there is no value, do not send the field. Empty text and placeholder values such as "yok" ("none") are not accepted.
- Send times with a time zone. Fields such as the departure time are rejected without a time zone; see Data Formats › Timestamp.
- Amounts are in minor units (kuruş). Amounts in basket items and in insurance requests use the same unit.
Going live
- Register your live API key; the base address does not change.
- Add a new connection in the Live environment with your provider's live credentials and enable the products on it.
- You do not need to disable your test connection; requests made with a live key do not go to it.
- If you use the Checkout Form, check your Form Settings > Insurance setting.
Related
- Testing: test keys and TestBank
- Insurance Types and Schemas: fields and requirements
- Data Formats: amount, time and identity formats
- Basket Items: insurance fields