Skip to main content

Crate ferro_stripe

Crate ferro_stripe 

Source
Expand description

§ferro-stripe

Stripe payment integration for the Ferro framework, organized along the capability axis: checkout, refund, account, idempotency, webhook.

§Quick Start

use ferro_stripe::{Stripe, StripeConfig};

// Initialize once at app startup.
let config = StripeConfig::from_env().expect("Stripe config not set");
Stripe::init(config);

§Creating a Checkout session

use ferro_stripe::{CheckoutBuilder, Mode, LineItem};

let intent = CheckoutBuilder::new(Mode::Payment)
    .line_item(LineItem {
        name: "Widget".into(),
        description: None,
        unit_amount_cents: 1000,
        quantity: 1,
        currency: "usd".into(),
    })
    .success_url("https://example.com/ok")
    .cancel_url("https://example.com/cancel")
    .idempotency_key("order-42")
    .create()
    .await?;

§Webhook idempotency

Implement ProcessedEventLog against your database (see the module docs on idempotency for the recommended SQL schema). Use MemoryProcessedLog in tests and single-process development only.

Re-exports§

pub use account::billing_portal_url;
pub use account::create_account;
pub use account::retrieve_account;
pub use checkout::CheckoutBuilder;
pub use checkout::CheckoutIntent;
pub use checkout::LineItem;
pub use checkout::Mode;
pub use client::Stripe;
pub use config::StripeConfig;
pub use error::Error;
pub use idempotency::MemoryProcessedLog;
pub use idempotency::ProcessedEventLog;
pub use webhook::events::StripeEvent;
pub use webhook::events::StripeChargeDisputeCreated;
pub use webhook::events::StripeChargeRefunded;
pub use webhook::events::StripeCheckoutCompleted;
pub use webhook::events::StripeCheckoutExpired;
pub use webhook::events::StripeConnectAccountUpdated;
pub use webhook::events::StripeConnectPaymentSucceeded;
pub use webhook::events::StripeInvoicePaid;
pub use webhook::events::StripePaymentIntentAmountCapturableUpdated;
pub use webhook::events::StripePaymentIntentCanceled;
pub use webhook::events::StripePaymentIntentFailed;
pub use webhook::events::StripeSubscriptionDeleted;
pub use webhook::events::StripeSubscriptionUpdated;
pub use webhook::events::WebhookEvent;
pub use webhook::queue::ProcessStripeWebhook;
pub use webhook::sync::SyncDispatcher;
pub use webhook::verify::verify_webhook;

Modules§

account
Stripe Connect account operations — create, link, retrieve, billing portal.
checkout
Stripe Checkout Session builder.
client
config
error
idempotency
Idempotency primitives for Stripe webhook processing.
payment_intent
Payment intent capture and cancel operations.
refund
Refund operations over Stripe charges.
webhook
Stripe webhook handling — signature verification, typed event structs, synchronous dispatch registry, and queue-path job.