steedy/steedy-client-api-php

PHP Wrapper for Steedy API

1.0.5 2017-11-28 08:46 UTC

This package is not auto-updated.

Last update: 2025-06-22 08:44:14 UTC


README

Steedy PHP Client API

You can view the complete API documentation here. (only in french atm) Feel free to get in touch for anything you'd like to know.

Install

Via Composer:

$ composer require steedy/steedy-client-api-php

Usage

  1. Initialize
  2. Create a delivery quote
  3. Validate a delivery quote
  4. Get a delivery status
  5. Cancel a delivery

Initialize

$client_id = 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'; // contact us at api@1steedy.fr to initiate your API access
$client_secret = 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';
$api = new \Steedy\API($client_id, $client_secret);
// to use the sandbox for testing:
// $api = new \Steedy\API($client_id, $client_secret, 'v1-sandbox');
$api->auth();

Create a Delivery Quote

Before you initiate your delivery, you must create a quote for it.

Notice: You can create a quote with a minimal set of parameters, but we recommend you to set as many information as you can in order to ensure the delivery goes well.

$delivery_quote = $api->post('delivery/create', array(
    'origin_name' => 'Thomas Rambaud',
    'origin_tel' => '0600000000',
    'origin_email' => 'thomas@1steedy.fr',
    'origin_address' => 'Rue de Rivoli, 75001 Paris',
    'origin_commentary' => 'iMac 27 to deliver',
    'destinations' => array(
        array(
            'name' => 'Pierre Guerin',
            'address' => '16 avenue Reille, 75014 Paris',
            'tel' => '0600000000',
            'email' => 'pierre@1steedy.fr',
        )
    )
    'delivery_size' => 3
));
With scheduled pickup

More information about delivery scheduling on our complete documentation.

$delivery_quote = $api->post('delivery/create', array(
    'origin_name' => 'Thomas Rambaud',
    'origin_tel' => '0600000000',
    'origin_email' => 'thomas@1steedy.fr',
    'origin_address' => 'Rue de Rivoli, 75001 Paris',
    'origin_commentary' => 'iMac 27 to deliver',
    'destinations' => array(
        array(
            'name' => 'Pierre Guerin',
            'address' => '16 avenue Reille, 75014 Paris',
            'tel' => '0600000000',
            'email' => 'pierre@1steedy.fr',
        )
    )
    'delivery_size' => 3,
    'schedule_at' => 1511710610
));
Multiple dropoffs
$delivery_quote = $api->post('delivery/create', array(
    'origin_name' => 'Thomas Rambaud',
    'origin_tel' => '0600000000',
    'origin_email' => 'thomas@1steedy.fr',
    'origin_address' => 'Rue de Rivoli, 75001 Paris',
    'origin_commentary' => 'iMac 27 to deliver',
    'destinations' => array(
        array(
            'name' => 'Pierre Guerin',
            'address' => '16 avenue Reille, 75014 Paris',
            'tel' => '0600000000',
            'email' => 'pierre@1steedy.fr',
        ),
        array(
            'name' => 'Réginald Cassius',
            'address' => '14, villa des Coteaux, 93340 Le Raincy',
            'tel' => '0600000000',
            'email' => 'reginald@1steedy.fr',
            'commentary' => 'Door code: XXXX'
        )
    )
    'delivery_size' => 3
));
// print $delivery_quote['quote_id'] ==> 123

Validate a delivery quote

Once you successfully created a Delivery Quote, you can validate it. Validating a Quote will trigger its charge process.

$validate_result = $api->post('delivery/validate', array(
    'quote_id' => $quote_id
));
// print $validate_result['order_id'] ==> 123

Get a delivery status

You can check your delivery status by querying the /delivery/follow endpoint.

$follow_result = $api->get('delivery/follow', array(
    'order_id' => $order_id
));

Cancel a delivery

If your delivery has not been accepted by a steedy yet, you can still cancel it, and get refund. Post to /delivery/cancel to cancel your delivery order.

$cancel_result = $api->post('delivery/cancel', array(
    'order_id' => $order_id
));

Check an address validity

It can sometimes be useful for your app or ecommerce site to check if an address is valid and handled by our services. To do so, use the method below.

$check_result = $api->post('delivery/is-valid-address', array(
    'address' => '16 avenue Reille, 75014 Paris'
));
$is_valid_address = isset($check_result['is_valid_address']) && $check_result['is_valid_address'] === TRUE;