Although we'll be using Ruby in these example scripts, this functionality could be integrated into any app written with Python, PHP, Java, and other languages with EasyPost's official client libraries and Stripe’s client libraries.
Once EasyPost is setup as your Stripe Relay shipping provider you will receive real-time rates whenever a Stripe Order is created.
You or your customer will select a Stripe Order shipping_method, and pay for the Order.
EasyPost can help you fulfill your paid Stripe Orders. We'll purchase the "selected_shipping_method", return a shipping label, and mark the Stripe Order as "fulfilled".
If your Stripe Order already has a "selected_shipping_method", it's simple to purchase that rate. If not, you can implement your own rate shopping logic here - for now we'll default to the lowest rate option.
By default Stripe will create an EasyPost Shipment for each Relay Order. However, because EasyPost Shipments are immutable, you may wish to create a new Shipment with custom options before purchasing a shipping label.
This sample script is a good starting point for thinking about how to automate the fulfillment of your Stripe Relay Orders. Automatic label printing would be a good next step - either using PrintNode, or by sending the label directly to a connected printer.
If you have any trouble please feel free to reach out to email@example.com!