Swiftpack.co - Package - vapor-community/stripe-provider

Vapor Stripe Provider

Swift Vapor Build

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.

Why Create this?

There wasn't a library for it that worked with Vapor, and I needed one for my project. The Stripe API is huge, and therefor I only plan on implementing the things that deal with payments. If there is something you need outside of that scope, feel free to submit a Pull Request.

Getting Started

In your Package.swift file, add a Package For Swift 3

.Package(url: "https://github.com/vapor-community/stripe.git", Version(1,0,0))

For Swift 4

.package(url: "https://github.com/vapor-community/stripe.git", .exact(Version(1,0,0)))

You'll need a config file as well. Place a stripe.json file in your Config folder

    "apiKey": "YOUR_API_KEY"

Add the provider to your droplet

try drop.addProvider(Stripe.Provider.self)

And you are all set. Interacting with the API is quite easy. Everything is Node backed with a simple API.

Making calls to the api is a simple one line

let object = try drop.stripe?.balance.history().serializedResponse()

The object is returned response model, or model array.


To avoid having to remember to add tests to LinuxMain.swift you can use Sourcery to add your tets cases there for you. Just install the sourcery binary with Homebrew brew install sourcery, navigate to your project folder, and from the command line run the following:

sourcery --sources Tests/ --templates Sourcery/LinuxMain.stencil --args testimports='@testable import StripeTests'

It will generate the following with your tests added:

import XCTest
@testable import StripeTests
extension BalanceTests {
static var allTests = [
  ("testBalance", testBalance),

Whats Implemented

  • [x] Balance Fetching
  • [x] Charges
  • [x] Customers
  • [x] Coupons
  • [x] Plans
  • [x] Refunds
  • [x] Tokens
  • [x] Sources
  • [x] Subscriptions
  • [x] Connect account
  • [x] Orders
  • [x] Order Items
  • [x] Products
  • [x] Disputes
  • [x] Invoices
  • [x] Invoice Items
  • [x] 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! 😀


Stars: 55
Help us keep the lights on


Used By

Total: 0


1.0.1 - Nov 12, 2017

Make all the classes open to make it easier to write tests

1.0.0 - Oct 18, 2017

Stripe 1.0.0 is here! 🎉

In your Package.swift file, add a Package For Swift 3

.Package(url: "https://github.com/vapor-community/stripe.git", majorVersion: 1)

For Swift 4

.package(url: "https://github.com/vapor-community/stripe.git", .upToNextMajor(from: "1.0.0"))

Run a vapor update and you're good to go!

1.0.0-beta.18 - Sep 28, 2017

@calebkleveter ++ Added a Swift 4 package manifest

1.0.0-beta.17 - Sep 10, 2017

Cleanup routes and add missing documentation

1.0.0-beta.16 - Sep 7, 2017

Added invoices and invoice items