All Projects → wyyerd → Stripe Rs

wyyerd / Stripe Rs

Licence: other
Rust API bindings for the Stripe HTTP API.

Programming Languages

rust
11053 projects

Labels

Projects that are alternatives of or similar to Stripe Rs

Parabol
Free online agile retrospective meeting tool
Stars: ✭ 1,145 (+816%)
Mutual labels:  stripe
Cordova Plugin Stripe
A Cordova plugin that lets you use Stripe's Native SDKs for Android and iOS.
Stars: ✭ 90 (-28%)
Mutual labels:  stripe
Commerce.js
Open source, JS eCommerce SDK for building headless, Jamstack applications. Build custom storefronts, carts, and checkouts in any frontend framework, platform, or device. Integrates with Stripe, Square, PayPal, Paymill and Razorpay with support for 135+ currencies.
Stars: ✭ 112 (-10.4%)
Mutual labels:  stripe
Sample Vue Shop
See readme for newer repo details! A sample shop that shows how to manage payments with Vue, Stripe, and Serverless Functions
Stars: ✭ 1,166 (+832.8%)
Mutual labels:  stripe
React Native Stripe Payments
Lightweight, easy to integrate and use React native library for Stripe payments (using Payment Intents) compliant with SCA (strong customer authentication)
Stars: ✭ 78 (-37.6%)
Mutual labels:  stripe
Gatsby Starter Stripe
🛒 A starter storefront & admin UI with Gatsby, Stripe, & Netlify Functions.
Stars: ✭ 92 (-26.4%)
Mutual labels:  stripe
Tipsi Stripe
React Native Stripe binding for iOS/Android platforms
Stars: ✭ 1,106 (+784.8%)
Mutual labels:  stripe
Payumlaravelpackage
Payum offers everything you need to work with payments. From simplest use cases to very advanced ones.
Stars: ✭ 121 (-3.2%)
Mutual labels:  stripe
Stripe Payments Demo
Sample store accepting universal payments on the web with Stripe Elements, Payment Request, Apple Pay, Google Pay, Microsoft Pay, and the PaymentIntents API. 💳🌍✨
Stars: ✭ 1,287 (+929.6%)
Mutual labels:  stripe
Invoice As A Service
💰 Simple invoicing service (REST API): from JSON to PDF
Stars: ✭ 106 (-15.2%)
Mutual labels:  stripe
Nova Stripe Theme
A Laravel Nova theme closely resembling Stripe.
Stars: ✭ 71 (-43.2%)
Mutual labels:  stripe
Nuxt Stripe Module
A NuxtJS module to import Stripe client script.
Stars: ✭ 72 (-42.4%)
Mutual labels:  stripe
Payumserver
Payment processing microservice. Written in Symfony4
Stars: ✭ 103 (-17.6%)
Mutual labels:  stripe
Ecommerce Netlify
🛍 A JAMstack Ecommerce Site built with Nuxt and Netlify Functions
Stars: ✭ 1,147 (+817.6%)
Mutual labels:  stripe
Firebase Subscription Payments
Example web client for the `firestore-stripe-subscriptions` Firebase Extension using Stripe Checkout and the Stripe Customer Portal.
Stars: ✭ 119 (-4.8%)
Mutual labels:  stripe
Stripe Elixir
Stripe API client for Elixir
Stars: ✭ 66 (-47.2%)
Mutual labels:  stripe
Chip
A drop-in subscription billing UI for Laravel
Stars: ✭ 91 (-27.2%)
Mutual labels:  stripe
Stripe Ruby
Ruby library for the Stripe API.
Stars: ✭ 1,634 (+1207.2%)
Mutual labels:  stripe
Stripe Sdk
A simple and flexible Stripe library for Flutter with complete support for SCA and PSD2.
Stars: ✭ 120 (-4%)
Mutual labels:  stripe
Creditcardform Ios
CreditCardForm is iOS framework that allows developers to create the UI which replicates an actual Credit Card.
Stars: ✭ 1,431 (+1044.8%)
Mutual labels:  stripe

stripe-rust

stripe-rust on Travis CI stripe-rust on crates.io stripe-rust on docs.rs

Rust API bindings for the Stripe v1 HTTP API.

This is compatible with all currently supported versions of Stripe's client-side libraries including https://js.stripe.com/v2/ and https://js.stripe.com/v3/.

API Version

The latest supported version of the Stripe API is w2020-03-02. Set the corresponding crate version depending on which version of the Stripe API you are pinned to. If you don't see the specific version you are on, prefer the next available version.

  • 0.13.* - stripe version 2020-03-02 (not yet published)
  • 0.12.* - stripe version 2019-09-09

Usage

Add this to your Cargo.toml:

[dependencies]
stripe-rust = "0.13.*"

To see how the library is used, look through the examples folder.

Getting Started

To get started, we need to create a client:

  let client = stripe::Client::new("sk_test_YOUR_STRIPE_SECRET");

Then we can begin making requests as we'd like. Most Stripe requests accept many optional parameters, so we usually get the ::default() params and then set the ones we want from there.

Most requests for creating or updating a Stripe object use the same Rust struct, so you may frequently need to refer to the official API docs to determine which fields are required for either request.

  /* Creating a Stripe Charge */

  let token = "TOKEN_FROM_CHECKOUT".parse().expect("token to be valid");
  let mut params = stripe::CreateCharge::new();

  // NOTE: Stripe represents currency in the lowest denominations (e.g. cents)
  params.amount = Some(1095); // e.g. $10.95
  params.source = Some(stripe::ChargeSourceParams::Token(token));

  // Example: Override currency to be in Canadian Dollars
  params.currency = Some(stripe::Currency::CAD);

  let charge = stripe::Charge::create(&client, params).unwrap();
  println!("{:?}", charge); // =>  Charge { id: "ch_12345", amount: 1095, .. }
  /* Listing Stripe Charges */

  let params = stripe::ListCharges::new();
  let charges = stripe::Charge::list(&client, params).unwrap();
  println!("{:?}", charges); // =>  List { data: [Charge { id: "ch_12345", .. }] }

Using Custom Connect accounts

This crate supports impersonating a custom connect account.

To impersonate the account get a new Client and pass in the account id.

  let mut headers = stripe::Headers::default();
  headers.stripe_account = Some("acct_ABC".to_string());
  headers.client_id = Some("ca_XYZ".to_string());
  let client = client.with_headers(headers);

  // Then, all requests can be made normally
  let params = stripe::CustomerListParams::default();
  let customers = stripe::Customer::list(&client, params).unwrap();
  println!("{:?}", customers); // =>  List { data: [Customer { .. }] }

Feature Flags

By default the full stripe api is enabled.

To reduce code size, disable default features and enable just the APIs you use:

# Example: Core-only (enough to create a `Charge` or `Card` or `Customer`)
stripe-rust = { version = "*", default-features = false, features = ["default-tls"] }

# Example: Support for "Subscriptions" and "Invoices"
stripe-rust = { version = "*", default-features = false, features = ["default-tls", "billing"] }

Refer to the Stripe API docs to determine which APIs are included as part of each feature flag.

Contributing

Code Generation

This library is (mostly) authored via code generation by parsing the OpenAPI specification for Stripe.

To update the generated code, use the included scripts:

# Generate files into the ./openapi/out directort (working directory must be project root)
> ./openapi/build

# Copy reviewed files to ./src/resources
> ./openapi/commit
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].