forked from arlyon/async-stripe
-
Notifications
You must be signed in to change notification settings - Fork 0
/
strategy.rs
26 lines (22 loc) · 876 Bytes
/
strategy.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
//! Payment Link
//! ============
//!
//! Reference: <https://stripe.com/docs/api/payment_links/payment_links>
//!
//! This example shows how to create a payment link for
//! a particular product and price. The nice thing with
//! this API is the lack of associated customer.
use stripe::{Client, Customer, ListCustomers, RequestStrategy};
#[tokio::main]
async fn main() {
let secret_key = std::env::var("STRIPE_SECRET_KEY").expect("Missing STRIPE_SECRET_KEY in env");
let client = Client::new(secret_key).with_strategy(RequestStrategy::idempotent_with_uuid());
let first_page =
Customer::list(&client, &ListCustomers { limit: Some(1), ..Default::default() })
.await
.unwrap();
println!(
"first page of customers: {:#?}",
first_page.data.iter().map(|c| c.name.as_ref().unwrap()).collect::<Vec<_>>()
);
}