I'm using the EasyPost API and I'm having a few blockers along the way. I want to create a Shipment and buy insurance at the same time, but it seems that the API wants you to first purchase the Shipment (the postage), then to buy the insurance, as per this doc: https://www.easypost.com/docs/api/java#shipping-insurance
But the doc of Create Shipment says differently, it takes an insurance amount: https://www.easypost.com/docs/api/java#shipment-object
I came to the conclusion that that the API cannot process them together, even though the Create Shipment says differently, you have to buy the label first and then buy the insurance. But this is counterintuitive for my workflow, I want to use one form to allow the user to set the addresses, the parcel, select if the shipment is insured or not, and buy the label + the insurance in one transaction au lieu of doing two transactions (the postage and the insurance).
Purchasing a shipment is typically a 2 step process:
You can see that insurance amount can be declared when making the buy call. After you have purchased a production shipment, you can confirm that insurance was successfully charged by looking at the objects returned in the "fees" array of the shipment.