A PayPal Golang SDK.
package main
import (
"context"
"fmt"
"github.com/adobaai/paypal"
)
func main() {
ctx := context.Background()
pc := paypal.NewClient(
"https://api-m.sandbox.paypal.com",
os.Getenv("PAYPAL_ID"),
os.Getenv("PAYPAL_SECRET"),
)
order, err := pc.CreateOrder(ctx, &paypal.CreateOrderReq{
Order: &paypal.Order{
Intent: paypal.OICapture,
PurchaseUnits: []*paypal.PurchaseUnit{
{
Amount: &paypal.Amount{
CurrencyCode: "USD",
Value: "8.88",
},
Description: "Hello order",
},
},
},
})
if err != nil {
panic(err)
}
fmt.Println(order)
}
See https://developer.paypal.com/api/rest/webhooks/event-names/ or Wayback Machine.
- Codecov
- Dependabot
- Unit test in GitHub Action
- Enable secret scanning
- Enable CodeQL