Skip to content

zsying/paypal-ipn

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PayPal-IPN

A Paypal IPN listener for Go.

GoDoc

Basic Usage

mux := http.NewServeMux()
mux.Handle("/paypal-ipn", ipn.Listener(func(err error, n *ipn.Notification) {
    if err != nil {
        log.Printf("IPN error: %v", err)
        return
    }

    //It's critical you verify the payment was sent to the correct business in the correct currency
    const (
        BusinessEmail = "ammar@ammar.io"
        Currency      = "USD"
    )
    if n.Business != BusinessEmail {
        log.Printf("Payment sent to wrong business: %v", err)
        return
    }
    if n.Currency != Currency {
        log.Printf("Payment in wrong currency: %v", n.Currency)
        return
    }

    log.Printf("%v sent me %v!", n.PayerEmail, n.Gross)
}))
log.Fatalf("failed to run http server: %v", http.ListenAndServe(":80", mux))

About

Golang PayPal IPN listener

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Go 100.0%