1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
use crate::client::{Client, Response};
use crate::ids::CheckoutSessionId;
use crate::params::Expand;
use crate::resources::CheckoutSession;

impl CheckoutSession {
    /// Retrieves a Session object.
    ///
    /// For more details see <https://stripe.com/docs/api/checkout/sessions/retrieve>.
    pub fn retrieve(
        client: &Client,
        id: &CheckoutSessionId,
        expand: &[&str],
    ) -> Response<CheckoutSession> {
        client.get_query(&format!("/checkout/sessions/{}", id), &Expand { expand })
    }

    /// Expires a checkout session.
    ///
    /// For more details see <https://stripe.com/docs/api/checkout/sessions/expire>.
    pub fn expire(client: &Client, id: &CheckoutSessionId) -> Response<CheckoutSession> {
        client.post(&format!("/checkout/sessions/{}/expire", id))
    }
}