A rust library that wraps the paypal api asynchronously in a strongly typed manner.
Go to file
2020-06-10 13:19:27 +02:00
.github/workflows Create rust.yml 2020-06-09 10:06:49 +02:00
src more docs 2020-06-10 13:17:37 +02:00
.gitignore initial commit 2020-06-08 22:31:40 +02:00
Cargo.toml better todo 2020-06-10 13:19:27 +02:00
LICENSE Initial commit 2020-06-08 22:29:59 +02:00
README.md better todo 2020-06-10 13:19:27 +02:00
rustfmt.toml progress with orders 2020-06-10 12:29:13 +02:00

paypal-rs

Rust Docs

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

Crate: https://crates.io/crates/paypal-rs

Documentation: https://docs.rs/paypal-rs

Currently in early development.

Example

use paypal_rs::{
    Client,
    HeaderParams,
    Prefer,
    orders::{OrderPayload, Intent, PurchaseUnit, Amount}
};

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

    let mut client = Client::new(clientid.as_str(), secret.as_str(), true);

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

    let order_payload = OrderPayload::new(
        Intent::Authorize,
        vec![PurchaseUnit::new(Amount::new(
            "EUR", "10.0",
        ))],
    );

    let order = client
        .create_order(
            order_payload,
            HeaderParams {
                prefer: Some(Prefer::Representation),
                ..Default::default()
            },
        )
        .await
        .unwrap();
}

Testing

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

cargo test --lib

TODO

  • Orders API
    • Create order
    • Update order
    • Show order details
    • Authorize payment for order
    • Capture payment for order
    • Error messages
  • Invoicing API
  • Tracking API
  • Subscriptions API
  • Identity API
  • Disputes API
  • Catalog Products API
  • Partner Referrals API
  • Payment Experience Web Profiles API
  • Payments API
  • Payouts API
  • Transaction Search API
  • Referenced Payouts API
  • Vault API
  • Webhooks Management API