PHP client

Client for PHP

Mini PHP library in one file: methods rates, create, cancel, tracking, get, balance, buyCheapest, and verifyWebhook. Only curl is required.

Downloadable files

What you’ll need

Step-by-step instructions

  1. Download shippickup.php and place it alongside your script.
  2. Set the key in the environment variable SHIPPICKUP_API_KEY (API address in SHIPPICKUP_API_URL if needed).
  3. Include the file and call methods, example below. API errors throw ShipPickupException with status, error code, and details.

Example

PHP
<?php
require __DIR__ . '/shippickup.php';

$api = new ShipPickup();                       // key: SHIPPICKUP_API_KEY environment variable
$rates = $api->rates(['from' => ['country' => 'US', 'postal_code' => '10001'], 'to' => ['country' => 'DE', 'postal_code' => '10117'],
    'parcel' => ['weight_g' => 800, 'length_mm' => 250, 'width_mm' => 180, 'height_mm' => 80]]);
$shipment = $api->create($body + ['rate_id' => $rates['data'][0]['rate_id']], ShipPickup::idempotencyKey('order-10452'));
$tracking = $api->tracking($shipment['data']['id']);
$api->cancel($shipment['data']['id'], 'Customer cancelled');

// in your webhook handler (raw body and the X-Shipto-Signature header):
$ok = ShipPickup::verifyWebhook($rawBody, $_SERVER['HTTP_X_SHIPTO_SIGNATURE'] ?? '', (string) getenv('SHIPPICKUP_WEBHOOK_SECRET'));

Important to know

Files contain no keys or passwords: all secrets are set by you in environment settings. Do not publish files with your values.

← All ready-made solutions · Common Scenarios