Skip to main content

Payments

Trait Payments 

Source
pub trait Payments: Send + Sync {
    // Required methods
    fn create_checkout<'life0, 'life1, 'async_trait>(
        &'life0 self,
        request: &'life1 CheckoutRequest,
    ) -> Pin<Box<dyn Future<Output = Result<CheckoutSession, PaymentsError>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             'life1: 'async_trait,
             Self: 'async_trait;
    fn create_subscription_checkout<'life0, 'life1, 'async_trait>(
        &'life0 self,
        request: &'life1 SubscriptionCheckoutRequest,
    ) -> Pin<Box<dyn Future<Output = Result<CheckoutSession, PaymentsError>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             'life1: 'async_trait,
             Self: 'async_trait;
    fn create_connect_account_link<'life0, 'life1, 'async_trait>(
        &'life0 self,
        request: &'life1 ConnectAccountLinkRequest,
    ) -> Pin<Box<dyn Future<Output = Result<ConnectAccountLink, PaymentsError>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             'life1: 'async_trait,
             Self: 'async_trait;
    fn charge_with_transfer<'life0, 'life1, 'async_trait>(
        &'life0 self,
        request: &'life1 TransferCharge,
    ) -> Pin<Box<dyn Future<Output = Result<Charge, PaymentsError>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             'life1: 'async_trait,
             Self: 'async_trait;
    fn refund<'life0, 'life1, 'async_trait>(
        &'life0 self,
        request: &'life1 RefundRequest,
    ) -> Pin<Box<dyn Future<Output = Result<Refund, PaymentsError>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             'life1: 'async_trait,
             Self: 'async_trait;
    fn verify_webhook<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        signature_header: &'life1 str,
        body: &'life2 [u8],
    ) -> Pin<Box<dyn Future<Output = Result<WebhookEvent, PaymentsError>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             Self: 'async_trait;
}
Expand description

Moves money for a venture. Stripe today; the trait names only Stripe identifiers and hosted URLs, never card data.

Required Methods§

Source

fn create_checkout<'life0, 'life1, 'async_trait>( &'life0 self, request: &'life1 CheckoutRequest, ) -> Pin<Box<dyn Future<Output = Result<CheckoutSession, PaymentsError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

A one-time hosted checkout. Returns the URL to redirect the browser to.

Source

fn create_subscription_checkout<'life0, 'life1, 'async_trait>( &'life0 self, request: &'life1 SubscriptionCheckoutRequest, ) -> Pin<Box<dyn Future<Output = Result<CheckoutSession, PaymentsError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

A recurring hosted checkout against a configured Stripe Price.

A Connect onboarding link for a coach’s account.

Source

fn charge_with_transfer<'life0, 'life1, 'async_trait>( &'life0 self, request: &'life1 TransferCharge, ) -> Pin<Box<dyn Future<Output = Result<Charge, PaymentsError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

A destination charge with an application fee (the platform’s cut).

Source

fn refund<'life0, 'life1, 'async_trait>( &'life0 self, request: &'life1 RefundRequest, ) -> Pin<Box<dyn Future<Output = Result<Refund, PaymentsError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

Refunds a prior payment, in whole or in part.

Source

fn verify_webhook<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, signature_header: &'life1 str, body: &'life2 [u8], ) -> Pin<Box<dyn Future<Output = Result<WebhookEvent, PaymentsError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, Self: 'async_trait,

Verifies a webhook’s signature and timestamp and returns the event. signature_header is the raw Stripe-Signature header; body is the exact bytes received (verification is over the raw body). Returns PaymentsError::SignatureInvalid if verification fails.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl Payments for FakePayments

Source§

fn create_checkout<'life0, 'life1, 'async_trait>( &'life0 self, _request: &'life1 CheckoutRequest, ) -> Pin<Box<dyn Future<Output = Result<CheckoutSession, PaymentsError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, FakePayments: 'async_trait,

Source§

fn create_subscription_checkout<'life0, 'life1, 'async_trait>( &'life0 self, _request: &'life1 SubscriptionCheckoutRequest, ) -> Pin<Box<dyn Future<Output = Result<CheckoutSession, PaymentsError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, FakePayments: 'async_trait,

Source§

fn charge_with_transfer<'life0, 'life1, 'async_trait>( &'life0 self, _request: &'life1 TransferCharge, ) -> Pin<Box<dyn Future<Output = Result<Charge, PaymentsError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, FakePayments: 'async_trait,

Source§

fn refund<'life0, 'life1, 'async_trait>( &'life0 self, _request: &'life1 RefundRequest, ) -> Pin<Box<dyn Future<Output = Result<Refund, PaymentsError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, FakePayments: 'async_trait,

Source§

fn verify_webhook<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, signature_header: &'life1 str, _body: &'life2 [u8], ) -> Pin<Box<dyn Future<Output = Result<WebhookEvent, PaymentsError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, FakePayments: 'async_trait,

Source§

impl Payments for Stripe

Source§

fn create_checkout<'life0, 'life1, 'async_trait>( &'life0 self, request: &'life1 CheckoutRequest, ) -> Pin<Box<dyn Future<Output = Result<CheckoutSession, PaymentsError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Stripe: 'async_trait,

Source§

fn create_subscription_checkout<'life0, 'life1, 'async_trait>( &'life0 self, request: &'life1 SubscriptionCheckoutRequest, ) -> Pin<Box<dyn Future<Output = Result<CheckoutSession, PaymentsError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Stripe: 'async_trait,

Source§

fn charge_with_transfer<'life0, 'life1, 'async_trait>( &'life0 self, request: &'life1 TransferCharge, ) -> Pin<Box<dyn Future<Output = Result<Charge, PaymentsError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Stripe: 'async_trait,

Source§

fn refund<'life0, 'life1, 'async_trait>( &'life0 self, request: &'life1 RefundRequest, ) -> Pin<Box<dyn Future<Output = Result<Refund, PaymentsError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Stripe: 'async_trait,

Source§

fn verify_webhook<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, signature_header: &'life1 str, body: &'life2 [u8], ) -> Pin<Box<dyn Future<Output = Result<WebhookEvent, PaymentsError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, Stripe: 'async_trait,

Implementors§