https://github.com/integready/stamps-api-client
Stamps API Client for creating shipping labels, envelopes, checking addresses, etc.
https://github.com/integready/stamps-api-client
api php stamps-com
Last synced: 9 months ago
JSON representation
Stamps API Client for creating shipping labels, envelopes, checking addresses, etc.
- Host: GitHub
- URL: https://github.com/integready/stamps-api-client
- Owner: IntegReady
- Created: 2019-07-15T15:56:57.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2021-12-06T13:26:09.000Z (over 4 years ago)
- Last Synced: 2025-08-22T01:26:30.077Z (10 months ago)
- Topics: api, php, stamps-com
- Language: PHP
- Homepage:
- Size: 21.5 KB
- Stars: 1
- Watchers: 2
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Stamps.com API Client
Stamps API Client for creating shipping labels, envelopes, checking addresses, etc.
### Usage
```php
$to = []; // Sender's address
$from = []; // Address of the recipient
$toAddress = (new \integready\stamps\address\Address())
->setFullname($to['fullname'])
->setAddress1($to['address1'])
->setAddress2($to['address2'])
->setCity($to['city'])
->setState($to['state'])
->setZipcode($to['zipCode'])
->setCountry($to['country']);
$fromAddress = (new \integready\stamps\address\Address())
->setFullname($from['fullname'])
->setAddress1($from['address1'])
->setAddress2($from['address2'])
->setCity($from['city'])
->setState($from['state'])
->setZipcode($from['zipCode'])
->setCountry($from['country']);
try {
$shippingLabel = (new \integready\stamps\api\Envelope())
->setApiUrl(API_URL) // Leave out for default
->setApiIntegrationId(YOUR_API_INTEGRATION_ID)
->setApiUserId(YOUR_API_USER_ID)
->setApiPassword(YOUR_API_PASSWORD)
->setImageType(\integready\stamps\api\Envelope::IMAGE_TYPE_PNG)
->setPackageType(\integready\stamps\api\Envelope::RATE_PACKAGE_TYPE_LETTER)
->setServiceType(\integready\stamps\api\Envelope::RATE_SERVICE_TYPE_US_FC)
->setPrintLayout(\integready\stamps\api\Envelope::RATE_PRINT_LAYOUT_ENVELOPE10)
->setMode(\integready\stamps\api\Envelope::MODE_NOPOSTAGE)
->setFrom($fromAddress)
->setTo($toAddress)
->setIsSampleOnly(false)
->setShowPrice(true)
->setWeightOz(100)
->setShipDate(date('Y-m-d'));
$labelUrl = $shippingLabel->create();
} catch(Exception $e) {
// Handle exception
}
```