diff --git a/README.md b/README.md index 865356a..45b2e29 100644 --- a/README.md +++ b/README.md @@ -16,6 +16,22 @@ $retail_rate = RetailPriceChart::getPrice( true); ``` +More complete example for getting the retail rate from EasyPost, then falling back to this tool if possible: +```php +$retail_rate = $rate->retail_rate ?? ($rate->list_rate ?? $rate->rate); +if ($rate->carrier == "USPS" && ($rate->retail_rate == $rate->rate) && ($rate->service == "Priority" || $rate->service == "GroundAdvantage")) { + // EasyPost not providing retail rate, let's look it up ourselves + if ($shipment->parcel->predefined_package == null) { + try { + $retail_rate = RetailPriceChart::getPrice($shipment->parcel->weight, $shipment->usps_zone, $rate->service, + [$shipment->parcel->length, $shipment->parcel->width, $shipment->parcel->height], true); + } catch (Exception $ex) { + + } + } +} +``` + ## Documentation ```php