Paddlex

An Elixir wrapper for the paddle.com API, inspired by paddle_pay and stripity_stripe

Hex.pmHex.pmHex.pmGitHub Workflow Status

Table of Contents

Installation

Add paddlex to your list of dependencies in mix.exs:

def deps do
[
{:paddlex, "~> 0.2.0"}
]
end

Usage

Configuration

Configure the library with the credentials obtained from the Paddle Dashboard:

# config/dev.exs
config :paddlex,
environment: :sandbox,
vendor_id: 12345,
vendor_auth_code: "YOUR SANDBOX VENDOR AUTH CODE"
# config/prod.exs
config :paddlex,
environment: :production, # the default
vendor_id: 12345,
vendor_auth_code: "YOUR PRODUCTION VENDOR AUTH CODE"

Every API function also accepts a trailing keyword list to override configuration per call — useful for multi-tenant apps or tests:

Paddle.Product.list(vendor_id: 67890, vendor_auth_code: "...")
Paddle.Coupon.create(params, vendors_base_url: "http://localhost:4001/api")

Supported override keys: :vendor_id, :vendor_auth_code, :environment, :vendors_base_url, :checkout_base_url, and :req_options (merged into the underlying Req request).

Examples

For examples of usage, please see the HexDocs

Contributing

Feedback, feature requests, and fixes are welcomed and encouraged.

To ensure a commit passes CI you should run mix check

License

Paddlex is released under the MIT license. See the LICENSE.