{"id":20581825,"url":"https://github.com/paddlehq/paddle-go-sdk","last_synced_at":"2026-02-20T13:06:33.991Z","repository":{"id":238702551,"uuid":"790750226","full_name":"PaddleHQ/paddle-go-sdk","owner":"PaddleHQ","description":"Go SDK for working with the Paddle API in server-side apps.","archived":false,"fork":false,"pushed_at":"2024-08-15T15:50:58.000Z","size":200,"stargazers_count":12,"open_issues_count":1,"forks_count":0,"subscribers_count":10,"default_branch":"main","last_synced_at":"2024-09-17T12:26:50.658Z","etag":null,"topics":["api","go","paddle","sdk"],"latest_commit_sha":null,"homepage":"https://developer.paddle.com","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/PaddleHQ.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-04-23T13:10:25.000Z","updated_at":"2024-08-15T15:50:27.000Z","dependencies_parsed_at":null,"dependency_job_id":"559dfc7d-3c3a-4c0a-9569-3da584d52258","html_url":"https://github.com/PaddleHQ/paddle-go-sdk","commit_stats":null,"previous_names":["paddlehq/paddle-go-sdk"],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PaddleHQ%2Fpaddle-go-sdk","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PaddleHQ%2Fpaddle-go-sdk/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PaddleHQ%2Fpaddle-go-sdk/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PaddleHQ%2Fpaddle-go-sdk/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/PaddleHQ","download_url":"https://codeload.github.com/PaddleHQ/paddle-go-sdk/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224884616,"owners_count":17386121,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["api","go","paddle","sdk"],"created_at":"2024-11-16T06:31:28.473Z","updated_at":"2026-02-20T13:06:33.984Z","avatar_url":"https://github.com/PaddleHQ.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Paddle GO SDK\n\n[Paddle Billing](https://www.paddle.com/billing?utm_source=dx\u0026utm_medium=paddle-go-sdk) is a complete digital product sales and subscription management platform, designed for modern software businesses. It helps you increase your revenue, retain customers, and scale your operations.\n\nThis is a [Go](https://go.dev/) SDK that you can use to integrate Paddle Billing with applications written in server-side Go.\n\nFor working with Paddle in your frontend, use [Paddle.js](https://developer.paddle.com/paddlejs/overview?utm_source=dx\u0026utm_medium=paddle-go-sdk). You can open checkouts, securely collect payment information, build pricing pages, and integrate with Paddle Retain.  \n\n\u003e **Important:** This package works with Paddle Billing. It does not support Paddle Classic. To work with Paddle Classic, see: [Paddle Classic API reference](https://developer.paddle.com/classic/api-reference/1384a288aca7a-api-reference?utm_source=dx\u0026utm_medium=paddle-go-sdk)\n\n## Learn more\n\n- [Paddle API reference](https://developer.paddle.com/api-reference/overview?utm_source=dx\u0026utm_medium=paddle-go-sdk)\n- [Sign up for Paddle Billing](https://login.paddle.com/signup?utm_source=dx\u0026utm_medium=paddle-go-sdk)\n\n## Requirements\n\nGo 1.21 or later\n\n## Before you begin\n\nIf you've used this SDK, we'd love to hear how you found it! Email us at [team-dx@paddle.com](mailto:team-dx@paddle.com) with any thoughts.\n\n## Installation\n\nMake sure your project is using Go Modules (it will have a go.mod file in its root if it already is):\n\n```bash\ngo mod init\n```\n\nTo install the Paddle Go SDK, use the following command:\n\n```bash\ngo get github.com/PaddleHQ/paddle-go-sdk\n```\n\nThen, reference paddle-go-sdk in a Go program with import:\n\n```go\nimport (\n    paddle \"github.com/PaddleHQ/paddle-go-sdk/v5\"\n)\n```\n\n## Usage\n\nTo authenticate, you'll need an API key. You can create and manage API keys in **Paddle \u003e Developer tools \u003e Authentication**.\n\nPass your API key while initializing a new Paddle client.\n\n``` go\nimport (\n    paddle \"github.com/PaddleHQ/paddle-go-sdk/v5\"\n)\n\nclient, err := paddle.New(\n    os.Getenv(\"PADDLE_API_KEY\"),\n    paddle.WithBaseURL(paddle.ProductionBaseURL),\n)\n```\n\nYou can now use the client to make requests to the Paddle API.\n\n## Examples\n\nBelow are some concise examples to get you going. You can also compile and run the [testable examples](#testable-examples).\n\n### List all entities\n\nYou can list supported entities with the `List*` function. It returns an iterator to help when working with multiple pages.\n``` go\nproducts, err := client.ListProducts(ctx, \u0026paddle.ListProductsRequest{IncludePrices: true})\nif err != nil {\n    panic(err)\n}\n\nerr = products.Iter(ctx, func(p *paddle.Product) (bool, error) {\n    // Do something with the product\n    fmt.Printf(\"%+v\\n\", p)\n    return true, nil\n})\nif err != nil {\n    panic(err)\n}\n```\n\n### Create an entity\n\nYou can create a supported entity with the `Create*` function. It accepts the resource's corresponding `Create*Request` operation e.g. `CreateProductRequest`. The created entity is returned.\n\n``` go\nproduct, err := client.CreateProduct(ctx, \u0026paddle.CreateProductRequest{\n    Name:        \"Test Product - GO SDK\",\n    TaxCategory: paddle.TaxCategoryStandard,\n})\nif err != nil {\n    panic(err)\n}\nfmt.Printf(\"%+v\\n\", product)\n```\n\n### Update an entity\n\nYou can update a supported entity with the `Update*` function. It accepts the `ID` of the entity to update and the corresponding `Update*Request` operation e.g. `UpdateProductRequest`. The updated entity is returned.\n\n``` go\nproduct, err := client.UpdateProduct(ctx, \u0026paddle.UpdateProductRequest{\n    ProductID: product.ID,\n    Name:      paddle.NewPatchField(\"Test Product - GO SDK Updated\"),\n})\nif err != nil {\n    panic(err)\n}\nfmt.Printf(\"%+v\\n\", product)\n```\n\n### Get an entity\n\nYou can get an entity with the `Get*` function. It accepts the `ID` of the entity to get and the corresponding `Get*Request` operation e.g. `GetProductRequest`. The entity is returned.\n\n``` go\nproduct, err := client.GetProduct(ctx, \u0026paddle.GetProductRequest{\n    ProductID: productID, \n    IncludePrices: true\n})\nif err != nil {\n    panic(err)\n}\nfmt.Printf(\"%+v\\n\", product)\n```\n\n## Resources\n\n### Webhook signature verification\n\nThe SDK includes a couple of helper functions to verify webhook signatures sent by Notifications from Paddle.\n\nYou could use a middleware to verify the signature of the incoming request before processing it.\n\n```go\nverifier := paddle.NewWebhookVerifier(os.Getenv(\"WEBHOOK_SECRET_KEY\"))\n// Wrap your handler with the verifier.Middleware method\nhandler := verifier.Middleware(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n    // The request making it this far means the webhook was verified\n    // Best practice here is to check if you have processed this webhook already using the event id\n    // At this point you should store for async processing\n    // For example a local queue or db entry\n\n    // Respond as soon as possible with a 200 OK\n    w.Header().Set(\"Content-Type\", \"application/json\")\n    w.WriteHeader(http.StatusOK)\n    w.Write([]byte(`{\"success\": true}`))\n}))\n```\n\nAlternatively you can verify the signature of the incoming request manually.\n\n``` go\nwebhookVerifier := paddle.NewWebhookVerifier(os.Getenv(\"WEBHOOK_SECRET_KEY\"))\n// Note: the request (req *http.Request) should be pass exactly as it comes without altering it.\nok, err := webhookVerifier.Verify(req)\n```\n\n### Testable examples\n\nThe SDK uses [testable examples](https://go.dev/blog/examples) in Go, which are compiled and executed as part of testing the package.\n\nThese testable examples use a mock server that returns predefined responses. This approach means you can make sure the examples compile and execute as expected.\n\n- [Create](./example_create_test.go)\n- [Get](./example_get_test.go)\n- [Update](./example_update_test.go)\n- [List](./example_list_test.go)\n- [List Events](./example_list_events_test.go)\n- [Simulations](./example_simulations_test.go)\n- [Webhook Unmarshalling](./example_webhook_unmarshal_test.go)\n- [Webhook Verification](./example_webhook_verifier_test.go)\n- [429 Error Retry Handling](./example_retry_after_test.go)\n\nThese are not intended to be comprehensive for each and every operation. Instead, they cover the general flow of operations for entities as well as some useful examples. \n\n## Learn more\n\n- [Paddle API reference](https://developer.paddle.com/api-reference/overview?utm_source=dx\u0026utm_medium=paddle-go-sdk)\n- [Sign up for Paddle Billing](https://login.paddle.com/signup?utm_source=dx\u0026utm_medium=paddle-go-sdk)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpaddlehq%2Fpaddle-go-sdk","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpaddlehq%2Fpaddle-go-sdk","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpaddlehq%2Fpaddle-go-sdk/lists"}