Code Monkey home page Code Monkey logo

paypal-rs's Introduction

paypal-rs

Crates.io 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.

Note: This README shows how to use the prerelease version, to view the README for 0.1.0 go here.

Some code in this repository is generated using https://github.com/edg-l/payhelper

Example

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

#[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, secret, true);

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

    let order_payload = OrderPayload::new(
        Intent::Authorize,
        vec![PurchaseUnit::new(Amount::new(Currency::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

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
  • 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

paypal-rs's People

Contributors

edg-l avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.