dcat127

Easypost UDF Print USPS Postage Labels

4 posts in this topic

I created this for a project that I was working on. Hopefully it will be helpful to others.

You need to sign-up for a free account at https://www.easypost.com/ in order to generate your own key. It also requires the base64 udf

#include "base64.au3"
#include "easypost.au3"
#include <IE.au3>
Global $rate
Global $login = ":" ; Enter your own key here

    $from = _getaddress("Test Person", "1234 John Green RD", "", "North Preston", "NY", "14837", "US","1234567890")
    $to = _getaddress("Test Person", "1234 Johnson Road", "", "North Preston", "NY", "14837", "US","1234567890")
    $parcel = _getpackage("Parcel", 24)
    $shipment = _getshipment($to, $from, $parcel)
    $label = _getlabel($shipment, $rate)

    If StringLen($label) > 200 Then
        MsgBox(0, "", "Some Kind of Problem")
        Exit
    EndIf

    _IECreate($label)

easypost.au3

Share this post


Link to post
Share on other sites



Have you compared EasyPost's API to those from USPS? I'm currently using the USPS Address Verification API, and just wondering how the one from EasyPost compares.

Share this post


Link to post
Share on other sites

FWIW, your sample code wouldn't run for me. I had to supply a valid phone number in the From address; otherwise, it returned the following from the GetLabel routine:

{"error":"Missing or invalid data element: FromPhone. Error encountered (Log ID: 48388)"}

Also, seems like you should be checking the return status code for errors.

HTH, Dan

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now