paypal-rs/README.md

78 lines
1.8 KiB
Markdown
Raw Normal View History

2020-06-09 08:08:22 +00:00
# paypal-rs
![Rust](https://github.com/edg-l/paypal-rs/workflows/Rust/badge.svg)
2020-06-09 16:23:46 +00:00
![Docs](https://docs.rs/paypal-rs/badge.svg)
2020-06-08 20:30:45 +00:00
2020-06-10 10:29:13 +00:00
A rust library that wraps the [paypal api](https://developer.paypal.com/docs/api) asynchronously in a strongly typed manner.
2020-06-08 20:30:45 +00:00
2020-06-09 16:27:51 +00:00
Crate: https://crates.io/crates/paypal-rs
2020-06-09 13:04:14 +00:00
Documentation: https://docs.rs/paypal-rs
2020-06-09 16:26:31 +00:00
Currently in early development.
2020-06-10 11:03:18 +00:00
## Example
```rust
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();
}
```
2020-06-09 16:26:31 +00:00
## Testing
You need the enviroment variables PAYPAL_CLIENTID and PAYPAL_SECRET to be set.
2020-06-10 11:03:18 +00:00
`cargo test --lib`
## TODO
2020-06-10 14:29:15 +00:00
- [x] Orders API
2020-06-10 11:19:27 +00:00
- - [x] Create order
- - [x] Update order
- - [x] Show order details
- - [x] Authorize payment for order
- - [x] Capture payment for order
2020-06-10 11:03:18 +00:00
- [ ] 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