Stripe Provider for Vapor
Branch: master
Clone or download
Andrewangeta Merge pull request #89 from robipresotto/master
Fix balance history endpoint
Latest commit 166b182 Jan 25, 2019
Type Name Latest commit message Commit time
Failed to load latest commit information.
LICENSE Update authors Aug 26, 2017
Package.swift Updated for Vapor 3 official release. May 7, 2018 Implemented file links and file uploads support. Sep 15, 2018
circle.yml Updates for keyDecodingStragety. Apr 1, 2018

Vapor Stripe Provider

Swift Vapor CircleCI

Stripe is a payment platform that handles credit cards, bitcoin and ACH transfers. They have become one of the best platforms for handling payments for projects, services or products.

Getting Started

In your Package.swift file, add the following

.package(url: "", from: "2.2.0")

Register the config and the provider to your Application

let config = StripeConfig(apiKey: "sk_12345678")


try services.register(StripeProvider())

app = try Application(services: services)

stripeClient = try app.make(StripeClient.self)

And you are all set. Interacting with the API is quite easy and adopts the Future syntax used in Vapor 3. Making calls to the api is straight forward.

let cardParams = ["exp_month": 1,
                  "exp_year": 2030,
                  "number": "4242424242424242",
                  "cvc": 123,
                  "object": "card"]

let futureCharge = try stripeClient.charge.create(amount: 2500, currency: .usd, source: cardParams){ (charge) in
    // do something with charge object...
}).catch({ (error) in

And you can always check the documentation to see the required paramaters for specific API calls.

Whats Implemented

Core Resources

  • Balance
  • Charges
  • Customers
  • Disputes
  • Events
  • File Links
  • File Uploads
  • Payouts
  • Refunds
  • Tokens

Payment Methods

  • Bank Accounts
  • Cards
  • Sources


  • Coupons
  • Discounts
  • Invoices
  • Invoice Items
  • Plans
  • Subscriptions
  • Subscription items


  • Account
  • Application Fee Refunds
  • Application Fees
  • Country Specs
  • External Accounts
  • Transfers
  • Transfer Reversals


  • Orders
  • Order Items
  • Products
  • Returns
  • SKUs
  • Ephemeral Keys


Vapor Stripe Provider is available under the MIT license. See the LICENSE file for more info.

Want to help?

Feel free to submit a pull request whether it's a clean up, a new approach to handling things, adding a new part of the API, or even if it's just a typo. All help is welcomed! 😀