{"id":44599212,"url":"https://github.com/bytebury/shima","last_synced_at":"2026-02-14T09:11:32.637Z","repository":{"id":336367484,"uuid":"1149371351","full_name":"bytebury/shima","owner":"bytebury","description":"A lightweight Stripe API library designed for software-as-a-service providers, enabling easy integrations with Stripe's API. Particularly around subscription management.","archived":false,"fork":false,"pushed_at":"2026-02-04T06:09:09.000Z","size":42,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-02-04T15:08:32.080Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bytebury.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-02-04T03:17:01.000Z","updated_at":"2026-02-04T06:07:37.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/bytebury/shima","commit_stats":null,"previous_names":["bytebury/ripe"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/bytebury/shima","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bytebury%2Fshima","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bytebury%2Fshima/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bytebury%2Fshima/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bytebury%2Fshima/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bytebury","download_url":"https://codeload.github.com/bytebury/shima/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bytebury%2Fshima/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29441353,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-14T07:24:13.446Z","status":"ssl_error","status_checked_at":"2026-02-14T07:23:58.969Z","response_time":53,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-02-14T09:11:32.186Z","updated_at":"2026-02-14T09:11:32.632Z","avatar_url":"https://github.com/bytebury.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n  \u003cimg src=\"https://raw.githubusercontent.com/bytebury/asset-manager/refs/heads/main/zebra.svg\" alt=\"ripe logo\" width=\"128\" /\u003e\n  \u003ch1\u003eShima (縞)\u003c/h1\u003e\n  \u003cp\u003e\n    \u003cstrong\u003eShima\u003c/strong\u003e is a lightweight, high-performance Stripe API client library written in Rust.\nThe name comes from the Japanese word \u003cstrong\u003eShima (縞)\u003c/strong\u003e, meaning \"Stripe\" or \"Pattern.\" This library is designed for developers who need a fast, type-safe, and minimal-dependency way to integrate Stripe payments into their Rust applications.\n  \u003c/p\u003e\n\u003c/div\u003e\n\n## Is Shima Right for You?\nShima is a lightweight, high-performance Stripe API client library written in Rust. It is designed for developers who need a fast, type-safe, and minimal-dependency way to integrate Stripe payments into their Rust applications. With that being said, Shima is not suitable for all use cases. Here are some scenarios where Shima might be a good fit:\n\n1. You use Stripe for checkouts and customer management.\n2. You use Stripe for Subscriptions.\n3. You use Stripe for Webhooks regarding Subscriptions.\n\n## Benefits\n* Shima compiles up to 10x faster than `async-stripe`.\n* Fast\n* Type-safe\n* Minimal dependencies\n* Easy to use\n\n## Getting Started\nAdd `shima` to your `Cargo.toml` file:\n\n```sh\ncargo add shima\n```\n\n\n## Usage\n### Generating a new shima client\n```rust\n// You can generate a client directly from your environment variables\n// if you have `STRIPE_SECRET_KEY` and will also set the webhook if\n// `STRIPE_WEBHOOK_SECRET` is set. This is preferred.\nlet client = shima::Client::from_env();\n// Alternatively, you can load it from a string without a webhook secret.\nlet client = shima::Client::new(\"sk_test_123456...\");\n// Or, you can load it from a string with a webhook secret.\nlet client = shima::Client::new(\"sk_test_123456...\").with_webhook_secret(\"whsec_123456...\");\n```\n\n### Creating a Stripe Customer\n```rust\nuse shima::customer::{Customer, CreateCustomer};\n\n// Create a Customer in Stripe.\nasync fn create_customer() -\u003e Result\u003cCustomer, shima::Error\u003e {\n    // Generate a new shima client, reading from our environment variables.\n    let client = shima::Client::from_env();\n\n    // Setup the new Customer.\n    let mut customer = CreateCustomer::new(\"John Doe\", \"john@example.com\");\n    customer.metadata.insert(\"user_id\", \"123456\");\n\n    // Create the customer.\n    Customer::create(\u0026client, customer).await\n}\n```\n\n### Purchasing Subscriptions / Checkout\n```rust\nuse shima::checkout::{CheckoutSession, CreateCheckoutSession};\nuse shima::{CustomerId, PriceId, CancelUrl, SuccessUrl};\n\n// Create a Checkout Session for a Customer.\nasync fn create_checkout_session() -\u003e Result\u003cCheckoutSession, shima::Error\u003e {\n    // Generate a new shima client, reading from our environment variables\n    let client = shima::Client::from_env();\n\n    // Setup the Checkout Session.\n    let mut session = CreateCheckoutSession::new_subscription(\n        CustomerId::try_from(\"cus_1234567\")?,\n        PriceId::try_from(\"price_1234567\")?,\n        SuccessUrl::from(\"https://example.com/success\"),\n        CancelUrl::from(\"https://example.com/cancel\"),\n    );\n    session.metadata.insert(\"user_id\", \"1\"); // Optional metadata\n\n    // Create the Checkout Session.\n    CheckoutSession::create(\u0026client, session).await\n}\n\n```\n\n### Manage Subscriptions / Customer Portal\n```rust\nuse shima::billing::{CustomerPortalSession, CreateCustomerPortalSession};\nuse shima::{CustomerId, ReturnUrl};\n\n// Let customers manage their subscriptions\nasync fn manage_subscription() -\u003e Result\u003cCustomerPortalSession, shima::Error\u003e {\n    // Generate a new shima client, reading from our environment variables.\n    let client = shima::Client::from_env();\n\n    // Get the customer you want to manage.\n    let customer = CustomerId::try_from(\"cus_123456\")?;\n    // When the customer is done with their session, they'll be redirected to this URL.\n    let return_url = ReturnUrl::from(\"https://example.com\");\n\n    // Create the Customer Portal Session.\n    let session = CreateCustomerPortalSession::new(customer, return_url);\n\n    CustomerPortalSession::create(\u0026client, session).await\n}\n```\n\n### Webhooks\n```rust\nuse shima::webhook::ShimaEvent;\n\n// Listen to Stripe events via webhooks\nfn listen_to_webhooks(headers: \u0026http::HeaderMap, body: \u0026str) -\u003e Result\u003c(), shima::Error\u003e {\n    // Generate a new shima client, reading from our environment variables.\n    let client = shima::Client::from_env();\n    let listener = shima::webhook::Listener::new(client);\n    \n    match listener.process(headers, body)? {\n\t\tShimaEvent::CheckoutSessionCompleted(event) =\u003e println!(\"Checkout session completed: {:?}\", event),\n\t\tShimaEvent::InvoicePaymentFailed(event) =\u003e println!(\"Invoice payment failed: {:?}\", event),\n\t\tShimaEvent::CustomerSubscriptionDeleted(event) =\u003e println!(\"Customer subscription deleted: {:?}\", event),\n\t\tShimaEvent::Other(event) =\u003e println!(\"Other event: {:?}\", event),\n    }\n\n    Ok(())\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbytebury%2Fshima","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbytebury%2Fshima","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbytebury%2Fshima/lists"}