{"id":48934691,"url":"https://github.com/pcriv/go-payoneer","last_synced_at":"2026-04-17T11:01:28.746Z","repository":{"id":344916038,"uuid":"1183651000","full_name":"pcriv/go-payoneer","owner":"pcriv","description":"A high-quality, type-safe, and observable Go SDK for the Payoneer API","archived":false,"fork":false,"pushed_at":"2026-04-14T07:56:43.000Z","size":140,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-04-14T09:34:23.859Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pcriv.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-03-16T20:27:21.000Z","updated_at":"2026-04-14T07:56:45.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/pcriv/go-payoneer","commit_stats":null,"previous_names":["pcriv/go-payoneer"],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/pcriv/go-payoneer","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pcriv%2Fgo-payoneer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pcriv%2Fgo-payoneer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pcriv%2Fgo-payoneer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pcriv%2Fgo-payoneer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pcriv","download_url":"https://codeload.github.com/pcriv/go-payoneer/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pcriv%2Fgo-payoneer/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31926260,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-17T10:35:34.458Z","status":"ssl_error","status_checked_at":"2026-04-17T10:35:09.472Z","response_time":62,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-04-17T11:01:01.299Z","updated_at":"2026-04-17T11:01:28.731Z","avatar_url":"https://github.com/pcriv.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# go-payoneer\n\nA high-quality, type-safe, and observable Go SDK for the Payoneer API.\n\n[![Go Reference](https://pkg.go.dev/badge/github.com/pcriv/go-payoneer.svg)](https://pkg.go.dev/github.com/pcriv/go-payoneer)\n[![Go Report Card](https://goreportcard.com/badge/github.com/pcriv/go-payoneer)](https://goreportcard.com/report/github.com/pcriv/go-payoneer)\n[![codecov](https://codecov.io/gh/pcriv/go-payoneer/graph/badge.svg)](https://codecov.io/gh/pcriv/go-payoneer)\n\n## Features\n\n- **Full Service Coverage**: Accounts, Payouts, Webhooks, and Payee Management.\n- **Robust Authentication**: Secure OAuth 2.0 with eager credential validation and automatic token refreshing.\n- **Observability**: First-class support for `slog` structured logging and OpenTelemetry (Tracing/Metrics).\n- **Resiliency**: Built-in exponential backoff retries and rate-limit handling (429s).\n- **Type-Safety**: Clean Go structs for all API resources, using generics for optional/nullable fields.\n- **Secure Webhooks**: Mandatory HMAC SHA-256 signature validation with an easy-to-use middleware.\n\n## Installation\n\n```bash\ngo get github.com/pcriv/go-payoneer\n```\n\n## Quick Start\n\n### 1. Initialize the Client\n\nThe SDK uses functional options for clean and flexible configuration.\n\n```go\nimport \"github.com/pcriv/go-payoneer/pkg/payoneer\"\n\nclient := payoneer.NewClient(\n    payoneer.WithSandbox(), // Use Sandbox for development\n    payoneer.WithProgramID(\"your-program-id\"),\n    payoneer.WithClientCredentials(\"your-client-id\", \"your-client-secret\"),\n    payoneer.WithRetries(3),\n)\n```\n\n### 2. Authenticate\n\n`Authenticate` eagerly fetches a token to validate your credentials. If the credentials or token endpoint are invalid, it fails immediately with a clear error.\n\n```go\nctx := context.Background()\n\nerr := client.Authenticate(ctx)\nif err != nil {\n    // errors.Is(err, payoneer.ErrAuthenticationFailed) can be used\n    // to programmatically detect auth failures.\n    log.Fatal(err)\n}\n```\n\n## Usage Examples\n\n### Submit a Mass Payout\n\n```go\nrequest := \u0026payoneer.MassPayoutRequest{\n    Payments: []payoneer.PayoutItem{\n        {\n            ClientReferenceID: \"unique-payout-ref-123\",\n            PayeeID:           \"payee-456\",\n            Amount:            15000, // $150.00 (in cents, converted to 150.00 on the wire)\n            Currency:          \"USD\",\n            Description:       \"March payout\",\n        },\n    },\n}\n\nresult, err := client.Payouts.SubmitMany(ctx, request)\n// result.Result — e.g. \"Payments Created\"\n```\n\n### Handle Webhooks (IPCN)\n\nProtect your webhook endpoint using the built-in middleware.\n\n```go\ncfg := payoneer.WebhookConfig{\n    Secret:          \"your-shared-secret\",\n    ExpectedAppName: payoneer.AppNameProduction, // or AppNameSandbox\n    // MaxClockSkew defaults to 5m; set to -1 to disable the timestamp check.\n    // NonceStore: yourStore, // optional replay protection\n}\n\nmux := http.NewServeMux()\n\n// Middleware parses `Authorization: hmacauth \u003cAppName\u003e:\u003cSignature\u003e:\u003cNonce\u003e:\u003cTimestamp\u003e`,\n// verifies the HMAC-SHA256 over payload+nonce+timestamp, and restores the body.\n// Each Payoneer webhook type is delivered to its own endpoint — the event\n// type is implied by the URL, not carried in the body. Unmarshal into the\n// struct that matches the endpoint: PaymentRequestAcceptedEvent,\n// CancelPayoutEvent, PayeeApprovedEvent, PayeeDeclinedEvent.\nmux.Handle(\"/webhooks/cancel-payout\", payoneer.WebhookValidator(cfg)(\n    http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n        wh, err := payoneer.ParseWebhook(r, cfg)\n        if err != nil {\n            http.Error(w, err.Error(), http.StatusUnauthorized)\n            return\n        }\n\n        var ev payoneer.CancelPayoutEvent\n        if err := wh.Decode(\u0026ev); err != nil {\n            http.Error(w, err.Error(), http.StatusBadRequest)\n            return\n        }\n        fmt.Printf(\"Payout %s cancelled for payee %s: %s\\n\",\n            ev.IntPaymentID, ev.PayeeID, ev.ReasonDescription)\n        w.WriteHeader(http.StatusOK)\n    }),\n))\n```\n\n### Payee Onboarding\n\n```go\n// Generate a link for a new payee to register\nresult, err := client.Payees.CreateRegistrationLink(ctx, \"payee-789\",\n    payoneer.WithRedirectURL(\"https://myapp.com/onboarded\"),\n    payoneer.WithLanguage(\"en\"),\n)\n// result.RegistrationLink — the URL to redirect the payee to\n// result.Token           — unique token for this registration session\n```\n\n## Configuration\n\n### Environments\n\n`WithSandbox()` configures both the API base URL (`api.sandbox.payoneer.com`) and the OAuth2 base URL (`login.sandbox.payoneer.com`) in one call. For production, the defaults point to `api.payoneer.com` and `login.payoneer.com` respectively.\n\nYou can override them independently if needed:\n\n```go\nclient := payoneer.NewClient(\n    payoneer.WithBaseURL(\"https://api.payoneer.com\"),\n    payoneer.WithAuthBaseURL(\"https://login.payoneer.com\"),\n)\n```\n\n## Advanced Patterns\n\n### Optional Fields\n\nThe SDK uses a generic `Optional[T]` type to distinguish between empty values and fields omitted by the API.\n\n```go\nif val, ok := payee.FirstName.Get(); ok {\n    fmt.Println(\"First Name:\", val)\n}\n```\n\n### Redacting Logs\n\nSensitive information is automatically redacted in logs.\n\n```go\nclient := payoneer.NewClient(\n    payoneer.WithLogger(slog.Default()), // Integrated with transport redaction\n)\n```\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpcriv%2Fgo-payoneer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpcriv%2Fgo-payoneer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpcriv%2Fgo-payoneer/lists"}