Prompt
How do I generate shipping labels automatically after an order is paid?
Latest observation
Nov 4, 2026
OpenAI APIWeb search: off
To automatically generate shipping labels after an order is marked as paid, you generally want this workflow:
-
Detect the payment event
- Listen for an “order paid” event in your platform.
- Examples:
- Shopify:
orders/paidwebhook - WooCommerce:
order.paid/order.updatedwhen status changes to paid - Stripe-based custom app: webhook like
checkout.session.completedorpayment_intent.succeeded
- Shopify:
-
Send the order to a shipping provider
- Use a shipping API such as:
- Shippo
- ShipStation
- EasyPost
- Sendcloud
- Carrier APIs directly (UPS/FedEx/DHL, if supported)
- Your app should create a shipment using:
- Sender/origin address
- Recipient address
- Package weight/dimensions
- Service level (e.g. ground, express)
- Use a shipping API such as:
-
Generate the label
- The shipping provider returns:
- Label PDF/ZPL
- Tracking number
- Shipment ID
- Store these in your system and attach them to the order.
- The shipping provider returns:
-
Mark the order as fulfilled
- Update the order status in your e-commerce platform.
- Optionally email the customer the tracking number.
-
Handle exceptions
- If address validation fails, weight is missing, or label purchase fails, flag the order for manual review.
Typical implementation pattern
Webhook flow:
- Payment completed →
- Webhook hits your backend →
- Backend validates the order →
- Backend creates shipping label via API →
- Save label + tracking →
- Mark order fulfilled →
- Notify customer
Example pseudo-flow
Order paid event
→ check if label already created
→ validate shipping address
→ calculate package weight
→ call Shippo/EasyPost API to buy label
→ store label URL + tracking number
→ update order status to fulfilled
→ send confirmation email
If you want to build this yourself
You’ll need:
- A webhook endpoint
- Database field to prevent duplicate label creation
- Shipping API credentials
- PDF label storage
- Retry/error handling
Best practice
Use an idempotency check so if the webhook is delivered twice, you don’t buy two labels for the same order.
If you tell me what platform you’re using (Shopify, WooCommerce, custom app, etc.), I can give you the exact steps or code example.