Example #1
0
        /// <summary>
        /// Purchase a PostageLabel for a given Shipment and CarrierRate
        /// Warning: This costs money and will only work with a LIVE API KEY
        /// </summary>
        /// <param name="shipmentId">The Id of the Shipment to buy a PostageLabel for</param>
        /// <param name="rate">The CarrierRate, selected from an available rate for the Shipment</param>
        /// <returns>The created PostageLabel</returns>
        /// <seealso cref="http://www.easypost.com/docs#shipments"/>
        public PostageLabel BuyPostageLabel(string shipmentId, CarrierRate rate)
        {
            var url      = string.Format(EasyPostUrls.SHIPMENT_BUY, shipmentId);
            var response = Execute <BuyPostageLabelResponse>(rate, url);

            return(response.PostageLabel);
        }
Example #2
0
 /// <summary>
 /// Purchase a label for this shipment with the given rate.
 /// </summary>
 /// <param name="id">Order id to buy</param>
 /// <param name="rate">Rate object to puchase the shipment with.</param>
 /// <returns>Order instance.</returns>
 public async Task <Order> BuyOrder(
     string id,
     CarrierRate rate)
 {
     return(await BuyOrder(id, rate.Carrier, rate.Service));
 }