Paddle Rust SDK
Rust SDK for working with the Paddle API in server-side apps. (Unofficial)
Installation and Usage
To install the Paddle Rust SDK, run the following Cargo command in your project directory:
To authenticate, you'll need an API key. You can create and manage API keys in Paddle > Developer tools > Authentication.
Pass your API key while initializing a new Paddle client.
use Paddle;
async
Fetching Entities
You can list supported entities with the *-list()
builders on the Paddle client. It returns an iterator-like struct to help when working with multiple pages.
Example for customers:
use Paddle;
async
Additionally all entities can be fetched via the .all()
method.
use Paddle;
async
Webhook signature verification
Use the Paddle::unmarshal
method to verify that received events are genuinely sent from Paddle. Additionally, this method returns the deserialized event struct.
Example handling webhook delivery with Actix:
use ;
use ;
async
/// http://127.0.0.1:8080/paddle-callback
async
This lib also provides the list live and sandbox IPs that webhook requests originate from.
Use the Paddle::ALLOWED_WEBHOOK_IPS_PRODUCTION
and Paddle::ALLOWED_WEBHOOK_IPS_SANDBOX
constants to check that a requests is made from a Paddle server. Actix example:
async
Running examples
<YOUR_API_KEY>
must be generated in the sandbox environment. All examples call the sandbox endpoints.
PADDLE_API_KEY=<YOUR_API_KEY> cargo
Paddle API Coverage
The following list outlines the current coverage of the Paddle API in this crate.
- ✅ Products
- ✅ Prices
- ✅ Discounts
- ✅ Customers
- ✅ Addresses
- ✅ Businesses
- ✅ Payment methods
- ✅ Customer portal sessions
- ✅ Transactions
- ✅ Subscriptions
- ✅ Adjustments
- ✅ Pricing preview
- ✅ Reports
- ✅ Events
- 🚧 Notifications
- 🚧 Simulations
License
- Apache License, Version 2.0 (LICENSE or http://www.apache.org/licenses/LICENSE-2.0)