Skip to content

dougkirkley/usps

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

usps

Example of calculating shipping rate for one package.

package main

import (
	"encoding/xml"
	"fmt"
	"github.com/dougkirkley/usps"
	"github.com/dougkirkley/usps/rate"
	"log"
)

func main() {
	u := &usps.USPS{
		Username: "USERID",
	}
	rates := []rate.Request{
		{
			XMLName:        xml.Name{Local: "Package"},
			ID:             "1st",
			Service:        "PRIORITY",
			ZipOrigination: "21212",
			ZipDestination: "20759",
			Pounds:         "0",
			Ounces:         "12",
			Container:      "VARIABLE",
		},
	}
	cost, err := rate.NewRate(*u).Calculate(rates)
	if err != nil {
		log.Print(err)
	}
	fmt.Print(cost)
}

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages