reevit 0.2.0

Official Rust SDK for the Reevit payments API
Documentation
use reqwest::Method;

use crate::{CheckoutSession, Client, PaymentIntentRequest, RequestOptions, Result};

/// Server-created checkout session operations.
#[derive(Debug, Clone)]
pub struct CheckoutSessions {
    client: Client,
}

impl CheckoutSessions {
    pub(crate) fn new(client: Client) -> Self {
        Self { client }
    }

    /// Creates a session whose secret can be passed to a Reevit browser SDK.
    pub async fn create(
        &self,
        input: &PaymentIntentRequest,
        options: RequestOptions,
    ) -> Result<CheckoutSession> {
        let request = self
            .client
            .request(Method::POST, "/v1/checkout/sessions")?
            .json(input);
        self.client.send(request, options).await
    }
}