Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ammario/paypal-ipn
Golang PayPal IPN listener
https://github.com/ammario/paypal-ipn
payment-processing paypal
Last synced: 25 days ago
JSON representation
Golang PayPal IPN listener
- Host: GitHub
- URL: https://github.com/ammario/paypal-ipn
- Owner: ammario
- Created: 2017-05-11T04:22:33.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2018-10-17T09:37:36.000Z (about 6 years ago)
- Last Synced: 2024-06-19T13:40:47.600Z (5 months ago)
- Topics: payment-processing, paypal
- Language: Go
- Size: 7.81 KB
- Stars: 13
- Watchers: 5
- Forks: 9
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# PayPal-IPN
A Paypal IPN listener for Go.
[![GoDoc](https://godoc.org/github.com/leebenson/paypal?status.svg)](https://godoc.org/github.com/ammario/paypal-ipn)
## Basic Usage
```go
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 = "[email protected]"
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))
```