Available Delivery
/api/v1/orders/available-deliveryLists the delivery options available for each product in the cart, for a shipping zip code, each with your organization's additional price. Call it at checkout to decide whether to offer same-day or next-day delivery.
https://api.care360-next.carevalidate.com/api/v1/orders/available-deliveryhttps://api-staging.care360-next.carevalidate.com/api/v1/orders/available-deliveryCall it from your server with your organization's secret cv-api-key. Don't call it from the browser, since that would expose the key.
Headers
cv-api-keystringrequiredQuery Parameters
postalCodestringrequired77002productIdsarray of strings (UUID)required9b2f1c4e-1a2b-4c3d-8e9f-0a1b2c3d4e5fBehavior
Each product is decided on its own and gets its own shippingOptions. STANDARD is always returned. One expedited option is added when a pharmacy that stocks the product delivers to the zip code and the product's medication allows that option:
| When | Option added | Turned on by |
|---|---|---|
| Before the pharmacy's same-day cutoff, on one of its working days | SAME_DAY | Offer Same-day Delivery in the Products settings |
| After the cutoff, or on a non-working day or holiday, or at any time when same-day is turned off | NEXT_DAY | Offer Next-day Delivery in the Products settings |
The option is left out when your organization hasn't turned it on. A price of 0 offers it for free. A product gets only STANDARD when:
- the zip code isn't covered by a same-day pharmacy, or no pharmacy can deliver right now;
- no pharmacy that delivers to the zip code stocks the product;
- the product's medication isn't set up for same-day or next-day delivery.
The SAME_DAY entry also carries the order cutoff, cutoffTime and timeZone. When several pharmacies can deliver a product same-day, it is the latest of their cutoffs.
Response Fields
postalCodestringoptional77002productsarray of objectsoptionalShow 2 child properties
productIdstring (UUID)optional9b2f1c4e-1a2b-4c3d-8e9f-0a1b2c3d4e5fshippingOptionsarray of objectsoptionalShow 3 child properties
SAME_DAYobjectoptionalShow 3 child properties
additionalPricenumber | nulloptional25cutoffTimestring | nulloptional15:00:00timeZonestring | nulloptionalAmerica/ChicagoNEXT_DAYobjectoptionalShow 1 child property
additionalPricenumber | nulloptional15STANDARDobjectrequiredShow 1 child property
additionalPricenumber | nulloptionalPlacing a Same-day or Next-day Case
A case ships as one order with one delivery option. The cart can use SAME_DAY or NEXT_DAY when at least one of its products lists it. When some product lists SAME_DAY, the cart's option is SAME_DAY, and NEXT_DAY is accepted only when no product can ship same-day.
Send the option the patient picked, shipping: { option: "SAME_DAY" } or shipping: { option: "NEXT_DAY" }, when you create the case, and include its additionalPrice in payment.amount. The option is checked again for the patient's shipping zip code and the case's products when the case request arrives, so an option that wouldn't be offered at that moment, such as SAME_DAY sent after the cutoff, is rejected with 400.
Request Examples
- cURL
- JavaScript
- Python
curl -X GET "https://api.care360-next.carevalidate.com/api/v1/orders/available-delivery?postalCode=77002&productIds=9b2f1c4e-1a2b-4c3d-8e9f-0a1b2c3d4e5f&productIds=4d6e8f0a-2b3c-4d5e-9f1a-2b3c4d5e6f7a" \
-H "cv-api-key: your-api-key-here"
const url = new URL(
'https://api.care360-next.carevalidate.com/api/v1/orders/available-delivery'
);
url.searchParams.set('postalCode', '77002');
url.searchParams.append('productIds', '9b2f1c4e-1a2b-4c3d-8e9f-0a1b2c3d4e5f');
url.searchParams.append('productIds', '4d6e8f0a-2b3c-4d5e-9f1a-2b3c4d5e6f7a');
const response = await fetch(url, {
method: 'GET',
headers: {
'cv-api-key': 'your-api-key-here',
},
});
const data = await response.json();
import requests
response = requests.get(
"https://api.care360-next.carevalidate.com/api/v1/orders/available-delivery",
headers={"cv-api-key": "your-api-key-here"},
params={
"postalCode": "77002",
"productIds": [
"9b2f1c4e-1a2b-4c3d-8e9f-0a1b2c3d4e5f",
"4d6e8f0a-2b3c-4d5e-9f1a-2b3c4d5e6f7a",
],
},
)
print(response.json())
Responses
▶200Same-day availableThe organization offers same-day delivery, and both products can ship same-day before the cutoff.
{
"data": {
"postalCode": "77002",
"products": [
{
"productId": "9b2f1c4e-1a2b-4c3d-8e9f-0a1b2c3d4e5f",
"shippingOptions": [
{
"SAME_DAY": {
"additionalPrice": 25,
"cutoffTime": "15:00:00",
"timeZone": "America/Chicago"
},
"STANDARD": {
"additionalPrice": 0
}
}
]
},
{
"productId": "4d6e8f0a-2b3c-4d5e-9f1a-2b3c4d5e6f7a",
"shippingOptions": [
{
"SAME_DAY": {
"additionalPrice": 25,
"cutoffTime": "15:00:00",
"timeZone": "America/Chicago"
},
"STANDARD": {
"additionalPrice": 0
}
}
]
}
]
},
"status": 200
}
▶200MixedThe first product can ship next-day (past the same-day cutoff); the second is not stocked by a pharmacy that delivers to the zip code, so it gets STANDARD only.
{
"data": {
"postalCode": "77002",
"products": [
{
"productId": "9b2f1c4e-1a2b-4c3d-8e9f-0a1b2c3d4e5f",
"shippingOptions": [
{
"NEXT_DAY": {
"additionalPrice": 15
},
"STANDARD": {
"additionalPrice": 0
}
}
]
},
{
"productId": "4d6e8f0a-2b3c-4d5e-9f1a-2b3c4d5e6f7a",
"shippingOptions": [
{
"STANDARD": {
"additionalPrice": 0
}
}
]
}
]
},
"status": 200
}
▶200Standard onlyThe zip code is not covered, or the organization has not turned on the option that applies right now.
{
"data": {
"postalCode": "10001",
"products": [
{
"productId": "9b2f1c4e-1a2b-4c3d-8e9f-0a1b2c3d4e5f",
"shippingOptions": [
{
"STANDARD": {
"additionalPrice": 0
}
}
]
}
]
},
"status": 200
}
▶400Invalid zip codepostalCode is missing or is not a 5-digit or ZIP+4 US zip code.
{
"status": 400,
"success": false,
"message": "Invalid request",
"error": "postalCode, postalCode must be a valid US zip code (5 digits or 5 digits + hyphen + 4 digits)",
"code": "VALIDATION_ERROR"
}
▶400Invalid productIdsproductIds is missing or empty, lists more than 50 products, or holds a value that is not a UUID.
{
"status": 400,
"success": false,
"message": "Invalid request",
"error": "productIds, productIds must be a list of product UUIDs",
"code": "VALIDATION_ERROR"
}
▶400Unknown productA product ID does not belong to your organization, does not exist, or was deleted. The unknown IDs are listed.
{
"status": 400,
"success": false,
"message": "Invalid request",
"error": "Unknown product(s) for this organization: 4d6e8f0a-2b3c-4d5e-9f1a-2b3c4d5e6f7a",
"code": "VALIDATION_ERROR"
}
▶400Missing API keyThe cv-api-key header is missing.
{
"status": 400,
"success": false,
"error": "Missing cv-api-key header",
"code": "CASE_ERROR"
}
▶401Invalid API keyThe cv-api-key does not belong to an organization.
{
"status": 401,
"success": false,
"message": "Permission Denied",
"error": "Invalid api key",
"code": "PERMISSION_DENIED_ERROR"
}