Subscription Timing API
Use the Subscription Timing API to determine when a shipment should drop to the FC and ship by, in order to arrive in a specified postal code by a specified date.
Syntax
This example shows the call syntax:
shipiumClient.getSubscriptionTiming({
customerCountryCode: 'US',
customerPostalCode: '98101',
desiredDeliveryDate: '2020-06-01T00:00:00.000000Z',
shippingOptions: {
fromCountry: 'US',
fromPostalCode: '98104',
shipOption: 'TwoDay',
}
}); // Returns a promise containing a Subscription Timing object
Parameters
This table shows the parameters used:
Parameter (Type) | Description |
---|---|
desiredDeliveryDate (string) | A valid date in ISO 8601 format representing the estimated delivery date to a customer configured in the call parameters for a given partner. Note: this value will be represented in the appropriate time zone for the customer delivery zip code. |
customerPostalCode (string) | The postal code of the subscription recipient. For US zip codes, zero-padded zip5 strings must be used. |
customerCountryCode (string) | The ISO 3166-1 country code for the customer shipping address. |
shippingOptions (object) | A map of keys and values describing shipping options for this call. |
shippingOptions.fromCountry (string) | The ISO 3166-1 country code from where the package is shipping. |
shippingOptions.fromPostalCode (string) | A country-appropriate postal code for the country defined in shippingOptions.fromCountry. |
shippingOptions.shipOption (string) | A high-level shipping option shown to or selected by a customer. The valid values are: Standard StandardPlus SameDay NextDay TwoDay ThreeDay |
Return value (Promise)
This example shows the parameters returned:
{
"subscriptionTimingRequestId": "f9b67320-6e7a-4381-a86b-575122d7b9b3",
"customerCountryCode": "US",
"customerPostalCode": "98101",
"shippingOptions": {
"shipOption": "TwoDay",
"fromCountry": "US",
"fromPostalCode": "98104"
},
"desiredDeliveryDate": "2020-06-01T00:00:00Z",
"shipByDate": "2020-05-30T00:00:00-07:00",
"fcDropByDate": "2020-05-29T14:00:00-07:00",
"subscriptionTimingRequestExpiration": "2020-05-27T20:54:14.015918Z"
}
Sample usage
This example shows the usage:
const result = await shipiumClient.getSubscriptionTiming({
customerCountryCode: 'US',
customerPostalCode: '98101',
desiredDeliveryDate: '2020-06-01T00:00:00.000000Z',
shippingOptions: {
fromCountry: 'US',
fromPostalCode: '98104',
shipOption: 'TwoDay',
}
});
// 2020-05-29T14:00:00-07:00
console.log(result.fcDropByDate);
// Once a subscription timing request has been made, it is possible to refetch it by calling the method
// getSubscriptionTimingById() with the subscriptionTimingRequestId returned with the original call.
const result = await shipiumClient.getSubscriptionTimingById('f9b67320-6e7a-4381-a86b-575122d7b9b3');
// 2020-05-29T14:00:00-07:00
console.log(result.fcDropByDate);
More information on the API responses
As with all Shipium API responses, this API follows the API Response Codes standards unless otherwise specified.
Updated 6 months ago