MoySklad: shipping label
When creating or updating a shipment, MoySklad calls the bridge script. It takes the address and counterparty from the shipment, buys the cheapest label, and appends the tracking to the shipment description.
Downloadable files
- moysklad-bridge.php MoySklad bridge: shipment webhook, tracking in shipment description
- shippickup.php API client in PHP, single file, no dependencies
What you’ll need
- Server with PHP 7.4+ and HTTPS, MoySklad API token.
- A ShipPickup account and a live API key (
sk_live_…) with the permissions specified in the instructions. The key is created in the dashboard under “API” and stored in your system settings or environment variable.
Step-by-step instructions
- Download
moysklad-bridge.phpandshippickup.php, upload them to the same folder on your server. - In the ShipPickup dashboard, create a live API key (
rates:read,labels:create). Set the environment variables from the top of the file:SHIPPICKUP_API_KEY,SHIPPICKUP_FROM,SHIPPICKUP_PARCEL,BRIDGE_SECRET,MOYSKLAD_TOKEN. - In MoySklad, add a custom field to shipments called “ShipPickup country” (a string with the recipient’s two-letter country code) and, if needed, “ShipPickup weight_g” (weight in grams).
- Fill in the shipment delivery address (postal code, city, street, house) and counterparty with phone number. The shipment amount is used as the declared value.
- Create a webhook via API with method
POST /api/remap/1.2/entity/webhookand body{"url": "https://your-server/moysklad-bridge.php?secret=BRIDGE_SECRET_VALUE", "action": "UPDATE", "entityType": "demand"}using the same token.
Important to know
- After processing, the bridge adds a line “ShipPickup …” to the shipment description. While this line exists, the shipment won’t be processed again: delete the line to retry the purchase.
- Purchase errors are also recorded as a line in the shipment description.
Files contain no keys or passwords: all secrets are set by you in environment settings. Do not publish files with your values.