Jump to content

Easypost UDF Print USPS Postage Labels


Recommended Posts

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")



Link to comment
Share on other sites

  • 1 year later...

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

Link to comment
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

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...