[−][src]Crate paypal_rs
A rust library that wraps the paypal api asynchronously in a stringly 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}, common::Currency, }; #[tokio::main] async fn main() { dotenv::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, 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
Roadmap
- [x] Orders API - 0.1.0
-
- [x] Create order
-
- [x] Update order
-
- [x] Show order details
-
- [x] Authorize payment for order
-
- [x] 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
Modules
common | Common paypal object definitions used amon 2 or more APIs |
errors | Errors created by this crate. |
invoice | Use the Invoicing API to create, send, and manage invoices. You can also use the API or webhooks to track invoice payments. When you send an invoice to a customer, the invoice moves from draft to payable state. PayPal then emails the customer a link to the invoice on the PayPal website. Customers with a PayPal account can log in and pay the invoice with PayPal. Alternatively, customers can pay as a guest with a debit card or credit card. For more information, see the Invoicing Overview and the Invoicing Integration Guide. |
orders | An order represents a payment between two or more parties. |
Structs
AccessToken | Represents the access token returned by the OAuth2 authentication. |
Auth | Stores OAuth2 information. |
Client | Represents a client used to interact with the paypal api. |
HeaderParams | Represents the optional header values used on paypal requests. |
Query | Represents the query used in most GET api requests. |
Enums
Prefer | The preferred server response upon successful completion of the request. |
Constants
LIVE_ENDPOINT | The paypal api endpoint used on a live application. |
SANDBOX_ENDPOINT | The paypal api endpoint used on when testing. |