Skip to main content

Available Delivery

GET/api/v1/orders/available-delivery

Lists 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.

cv-api-keyRate Limited
Productionhttps://api.care360-next.carevalidate.com/api/v1/orders/available-delivery
Staginghttps://api-staging.care360-next.carevalidate.com/api/v1/orders/available-delivery

Call 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-keystringrequired
Organization API key for authentication and authorization

Query Parameters​

Query Parameters
postalCodestringrequired
The patient's US shipping zip code: 5 digits, or ZIP+4 (12345-6789). A ZIP+4 is matched on its first 5 digits.
Example: 77002
productIdsarray of strings (UUID)required
The organization product IDs in the cart, 1 to 50. Send them as repeated keys (productIds=id1&productIds=id2), comma-separated (productIds=id1,id2) or as a JSON array (productIds=["id1","id2"]). Duplicates are ignored. Every ID must be an active product of your organization, or the request is rejected with 400.
Example: 9b2f1c4e-1a2b-4c3d-8e9f-0a1b2c3d4e5f

Behavior​

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:

WhenOption addedTurned on by
Before the pharmacy's same-day cutoff, on one of its working daysSAME_DAYOffer 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 offNEXT_DAYOffer 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​

data
postalCodestringoptional
The 5-digit zip code the options apply to.
Example: 77002
productsarray of objectsoptional
One entry per requested product, in the order requested.
Show 2 child properties
productIdstring (UUID)optional
The organization product ID, in lower case.
Example: 9b2f1c4e-1a2b-4c3d-8e9f-0a1b2c3d4e5f
shippingOptionsarray of objectsoptional
An array with one object whose keys are the delivery options offered: SAME_DAY or NEXT_DAY, and STANDARD. Each option key maps to an object holding that option's details.
Show 3 child properties
SAME_DAYobjectoptional
Present when same-day delivery is offered for this product. Never returned together with NEXT_DAY.
Show 3 child properties
additionalPricenumber | nulloptional
The extra charge for the option, in whole US dollars, from your organization's settings. 0 means no extra charge. null means the organization's price setting is invalid.
Example: 25
cutoffTimestring | nulloptional
The same-day order cutoff as HH:mm:ss, in timeZone. Order before it for same-day delivery.
Example: 15:00:00
timeZonestring | nulloptional
IANA time zone of cutoffTime.
Example: America/Chicago
NEXT_DAYobjectoptional
Present when next-day delivery is offered for this product. Never returned together with SAME_DAY.
Show 1 child property
additionalPricenumber | nulloptional
The extra charge for the option, in whole US dollars, from your organization's settings. 0 means no extra charge. null means the organization's price setting is invalid.
Example: 15
STANDARDobjectrequired
Always present.
Show 1 child property
additionalPricenumber | nulloptional
The extra charge for the option, in whole US dollars, from your organization's settings. 0 means no extra charge. null means the organization's price setting is invalid.
0

Placing 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 -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"

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"
}

Try It Out​