#paypal #api-bindings #strongly-typed #async-api #api-client

paypal-rs

A library that wraps the paypal api asynchronously

21 releases

0.2.6 Jun 3, 2024
0.2.5 Mar 10, 2023
0.2.4 Jan 11, 2023
0.2.3 Nov 11, 2022
0.1.0 Jun 10, 2020

#14 in Finance

Download history 19/week @ 2024-08-14 19/week @ 2024-08-21 11/week @ 2024-08-28 20/week @ 2024-09-04 37/week @ 2024-09-11 76/week @ 2024-09-18 168/week @ 2024-09-25 79/week @ 2024-10-02 72/week @ 2024-10-09 46/week @ 2024-10-16 52/week @ 2024-10-23 309/week @ 2024-10-30 251/week @ 2024-11-06 154/week @ 2024-11-13 99/week @ 2024-11-20 59/week @ 2024-11-27

676 downloads per month

MIT/Apache

140KB
2K SLoC

paypal-rs

Version Downloads License Rust Docs

A rust library that wraps the paypal api asynchronously in a strongly typed manner.

If there is a missing endpoint that you need, you may try to implement the Endpoint and pass it to Client::execute

Currently in early development.

Example

use paypal_rs::{
    Client,
    api::orders::*,
    data::orders::*,
    data::common::Currency,
    PaypalEnv,
};

#[tokio::main]
async fn main() {
    dotenvy::dotenv().ok();
    let clientid = std::env::var("PAYPAL_CLIENTID").unwrap();
    let secret = std::env::var("PAYPAL_SECRET").unwrap();

    let mut client = Client::new(clientid, secret, PaypalEnv::Sandbox);

    client.get_access_token().await.unwrap();

    let order = OrderPayloadBuilder::default()
        .intent(Intent::Authorize)
        .purchase_units(vec![PurchaseUnit::new(Amount::new(Currency::EUR, "10.0"))])
        .build().unwrap();

    let create_order = CreateOrder::new(order);

    let _order_created = client
        .execute(&create_order).await.unwrap();
}

Testing

You need the enviroment variables PAYPAL_CLIENTID and PAYPAL_SECRET to be set.

cargo test

Roadmap

  • Orders API - 0.1.0
    • Create order
    • Update order
    • Show order details
    • Authorize payment for order
    • Capture payment for order
  • Invoicing API - 0.2.0
    • Generate Invoice number
    • Create Draft Invoice
    • Show Invoice Details (Get Invoice)
    • List Invoices
    • Delete Invoice
    • Update Invoice
    • Cancel Invoice
    • Send Invoice
    • Send Invoice Reminder
    • List Templates
    • Create Template
    • Delete Template
    • Fully Update Template
    • Show Template Template
  • Payments API - 0.3.0
  • Tracking API - 0.4.0
  • Subscriptions API - 0.5.0
  • Identity API - 0.6.0
  • Disputes API - 0.7.0
  • Catalog Products API - 0.8.0
  • Partner Referrals API - 0.9.0
  • Payouts API - 0.10.0
  • Transaction Search API - 0.11.0
  • Referenced Payouts API - 0.12.0
  • Vault API - 0.13.0
  • Webhooks Management API - 0.14.0
  • Payment Experience Web Profiles API - 1.0.0

License: MIT OR Apache-2.0

Dependencies

~6–19MB
~270K SLoC