This covers Comprehensive Motor Insurance (Multiple Providers). Your account needs that product enabled. See Onboarding.
Before you start
Register where the embed is allowed to run, in API Management under Yasmina Iframe and WebView. A session can only be opened for something on these lists.
Add every site you will embed from.
https://example.com and https://www.example.com are different sites to a browser, so list both if you serve both.
The flow
1
Send the verification code
Call the Quote OTP API with the customer’s ID, email and phone. This one is yours because it happens before the embed exists.
2
Open a session
Call Create Embed Session with the same payload you would send to Request Quotes, plus where the session will run. We fetch the quotes and hand back a URL.
3
Show it
Put the URL in an iframe or a WebView.
4
Receive the policy
We send you the issued policy, including its payment link. Take the customer to payment from there.
Open a session
Accept: application/json, as with every Yasmina API.
Everything Request Quotes takes, plus:
string
required
web for an iframe, webview for a mobile app. There is no default: each one requires a different field below.string
required
Web only. The site the iframe will sit on, scheme and domain with nothing after it. Must be one of your iframe hosts.
string
required
WebView only. Where your app is reopened once the policy is issued. Must be one of your registered deep links.
string
ar or en. Defaults to the customer’s browser.Response
quote_request_id is yours to keep for your own records. You never have to send it back.
On a website
embed_url you were given rather than hardcoding one:
parent_origin can load the embed. Anywhere else gets a blank frame, refused by the browser.
In a mobile app
Load the sameembed_url in a WebView. When the policy is issued we reopen your app at your deep_link with the policy id on it:
iOS
NSCameraUsageDescription to your Info.plist. Without it iOS terminates the app the moment a customer taps Take Photo on the vehicle photo step. Choosing an existing photo instead goes through a picker that runs outside your app, and needs no key.
Android
CAMERA at runtime if customers will photograph the vehicle in the app.
Getting the whole policy instead of just the id
Optional. If you would rather receive the full policy than look it up, expose a bridge and we will use it, falling back to the deep link if it is not there.What you receive
{ "type": "yasmina:ready" } once it has loaded, which is useful for hiding your own loading state.
The policy is issued but unpaid. Take the customer to payment_link to activate it. Your webhooks fire on payment as they always do.