Code Monkey home page Code Monkey logo

stripe's Introduction

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

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

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
    • History
    • Balance by ID
  • Charges
    • Creating Charges
    • Retrieving a charge by id
    • Listing all charges
    • Updating a charge
    • Capturing a charge
  • Customers
    • Creating
    • Updating
    • Deleting
    • Fetching by Customer ID
    • Listing All Customers (With filters)
  • Coupons
    • Creating
    • Updating
    • Deleting
    • Fetching by Coupon ID
    • Listing All Coupons (With filters)
  • Plans
    • Creating
    • Updating
    • Deleting
    • Fetching by Plan ID
    • Listing All Plans (With filters)
  • Refunds
    • Creating a Refund
    • Retrieval
    • Updating
    • Listing all
  • Tokens
    • Card Creation
    • Bank Creation
    • Token Retrieval
  • Sources
    • Creating
    • Updating
    • Fetching by Source ID
  • Subscriptions
    • Creating
    • Updating
    • Deleting
    • Fetching by subscription ID
    • Listing All Subscriptions (With filters)
  • Connect account
    • Creating
    • Updating
    • Deleting
    • Fetching by account ID
    • Listing All Accounts (With filters)
    • Rejecting accounts
    • Creating dashboard login link for express accounts
  • Disputes
  • Cards
  • Orders
  • Order Items

stripe's People

Contributors

andrewangeta avatar anthonycastelli avatar vzsg avatar andreaferrando avatar

Watchers

James Cloos avatar Patrick Balestra avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.