vapor-community/stripe-provider


Stripe Provider for Vapor

License: MIT

Language: Swift

Keywords: card, payment, stripe, stripe-api, swift4, vapor, vapor-3, vapor-provider, vapor-stripe


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.

Testing

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),
  ...
]
}
.
.
XCTMain([
  testCase(BalanceTests.allTests),
  ...
])

Whats Implemented

  • Balance Fetching
  • Charges
  • Customers
  • Coupons
  • Plans
  • Refunds
  • Tokens
  • Sources
  • Subscriptions
  • Connect account
  • Orders
  • Order Items
  • Products
  • Disputes
  • Invoices
  • Invoice Items
  • Ephemeral Keys

License

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! đŸ˜€

Project Statistics

Sourcerank 6
Repository Size 766 KB
Stars 63
Forks 10
Watchers 7
Open issues 1
Dependencies 2
Contributors 7
Tags 25
Created
Last updated
Last pushed

Top Contributors See all

Anthony Andrew Edwards Caleb Kleveter Patrick Balestra Andrea Zsolt VĂ¡radi Tanner

Packages Referencing this Repo

github.com/github.com/vapor-community/stripe
Stripe Provider for Vapor
Latest release 2.0.0-rc.1.2.0 - Published - 63 stars

Recent Tags See all

2.0.0-rc.1.2.0 April 01, 2018
2.0.0-rc.1.2 April 01, 2018
2.0.0-rc1.1 March 25, 2018
2.0.0-rc.1.1 March 25, 2018
2.0.0-rc.1 March 25, 2018
1.0.1 November 12, 2017
1.0.0 October 18, 2017
1.0.0-beta.18 September 28, 2017
1.0.0-beta.17 September 10, 2017
1.0.0-beta.16 September 07, 2017
1.0.0-beta.15 August 29, 2017
1.0.0-beta.14 August 26, 2017
1.0.0-beta.13 July 12, 2017
1.0.0-beta.12 July 09, 2017
1.0.0-beta.11 June 27, 2017

Something wrong with this page? Make a suggestion

Last synced: 2018-01-16 13:43:07 UTC

Login to resync this repository