1. Go to this page and download the library: Download aglipanci/postmates-api library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
$delivery_quote = new Postmates\Resources\DeliveryQuote($client);
$delivery_quote->getQuote('501-525 Brannan St, San Francisco, CA 94107', '6 Colin P Kelly Jr St, San Francisco, CA 94107');
$delivery_zones = new Postmates\Resources\DeliveryZones($client);
$delivery_zones->listZones();
$delivery = new Postmates\Resources\Delivery($client);
$params = [
'manifest' => 'test manifest',
'pickup_name' => 'test pickup nanme',
'pickup_address' => '501-525 Brannan St, San Francisco, CA 94107',
'pickup_phone_number' => '222 551 1234',
'dropoff_name' => 'test dropoff name',
'dropoff_address' => '6 Colin P Kelly Jr St, San Francisco, CA 94107',
'dropoff_phone_number' => '222 555 5432',
];
$delivery->create($params);
$delivery = new Postmates\Resources\Delivery($client);
$delivery->listDeliveries();
$delivery = new Postmates\Resources\Delivery($client);
$delivery->get('del_LAPCo_EAxDv6z-');
$delivery = new Postmates\Resources\Delivery($client);
$delivery->cancel('del_LAPCo_EAxDv6a-');
$delivery = new Postmates\Resources\Delivery($client);
$delivery->addTip('del_LAPCo_EAxDv6a-', 1000); // amount in cents
$webhook = new Postmates\PostmatesWebhook('signature_secret_key');
$webhook_request = $webhook->parseRequest() // this will validate and return the webhook request
if($webhook_request['kind'] == Delivery::EVENT_DELIVERY_STATUS) {
//this is a delivery status event
}
if($webhook_request['kind'] == Delivery::EVENT_COURIER_UPDATE) {
//this is a courrier update event
}
$webhook = new Postmates\PostmatesWebhook('signature_secret_key');
$webhook_request_is_valid = $webhook->validateRequest($payload, $key)
$params = [
'manifest' => 'test manifest',
'pickup_name' => 'test pickup nanme',
'pickup_address' => '501-525 Brannan St, San Francisco, CA 94107',
'pickup_phone_number' => '222 551 1234',
'dropoff_name' => 'test dropoff name',
'dropoff_address' => '6 Colin P Kelly Jr St, San Francisco, CA 94107',
'dropoff_phone_number' => '222 555 5432',
];
try {
$delivery->create($params);
} catch (Postmates\PostmatesException $e) {
$e->getMessage();
$e->getInvalidParams();
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.