Step-by-Step Quote Engine Redirect
Step 1: Request a Quote
This step has moved to a shared guide used by both the redirect and Stripe purchase flows.
➡️ Visit the unified guide: Request a Quote
Return here after you have a quoteId (and optionally quoteLinkUrl).
Note
The example request shows commonly used fields. Refer to the full schema for additional or conditionally required properties.With a successful quote response, a quoteLinkUrl will be returned. In the example above you can see we are setting quoteLinkUrl from the returned premiumSummary.
Quote Response Example:
Step 2: Display Quote Details to Customer
After a successful quote response, display the quote information to the customer as needed.
If the pet information was not added when the quote was generated, you can use the pet endpoint to add a pet. You can check the pet endpoint page for the full endpoint and schemas.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
document.getElementById('quoteDetails').addEventListener('click', function(e){
e.preventDefault();
let data = {
name: document.getElementById('pet-name').value,
breedId: parseInt(document.getElementById('breed').value),
gender: document.getElementById('gender').value,
age: document.getElementById('age').value
};
fetch(`/update-pet`, {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify(data)
})
.then(response => response.json())
.then(data => {
// Pet sends back full quote response
})
.catch(error => {
console.error('Error:', error);
});
});
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
// Add below existing MapPost in Program.cs (before app.Run())
app.MapPost("/update-pet", async (HttpRequest request) =>
{
using var reader = new StreamReader(request.Body, Encoding.UTF8);
var rawBody = await reader.ReadToEndAsync();
if (string.IsNullOrWhiteSpace(rawBody))
{
return Results.BadRequest(new { error = "Request body is empty" });
}
string? quoteId = null;
try
{
using var doc = JsonDocument.Parse(rawBody);
if (doc.RootElement.TryGetProperty("quoteId", out var q))
{
quoteId = q.GetString();
}
}
catch { }
if (string.IsNullOrWhiteSpace(quoteId))
{
return Results.BadRequest(new { error = "quoteId field is required" });
}
var forward = new HttpRequestMessage(HttpMethod.Post, $"https://[embrace-test-endpoint]/v2/quotes/fullquote/{quoteId}/pet")
{
Content = new StringContent(rawBody, Encoding.UTF8, "application/json")
};
forward.Headers.Add("Cache-Control", "no-cache");
forward.Headers.Add("epi-apim-subscription-key", embraceApiKey);
var resp = await httpClient.SendAsync(forward);
var body = await resp.Content.ReadAsStringAsync();
return Results.Content(body, "application/json", resp.StatusCode);
});
Step 3: Redirect Customer to Quote Engine
After the customer has reviewed the quote information, added pets, and is ready purchase the quote, redirect them to Quote Engine using the quoteLinkUrl obtained from the quote response in Step 1.
Feedback
Was this page helpful?
Glad to hear it! Please tell us how we can improve.
Sorry to hear that. Please tell us how we can improve.