vapor-community / stripe

Stripe library for Vapor

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Better Setup Walkthrough

lukenewman opened this issue · comments

The README would benefit from a more in-depth setup explanation.

For example, I added the Package line, ran vapor update, regen'd the xcodeproj, and then tried the setup steps, but I don't know what to import. Tried Stripe, StripeProvider, and StripeClient to no avail. Also, I think the "Register the config and the provider to your Application" code example could be explained better. Does all of that go in app.swift? configure.swift?

Would really appreciate the additional explanation because following the current steps does not work for me. Thanks!

@lukenewman did you make sure to add Stripe to the dependencies?
Also the import is just Stripe.
The configure goes in where you want. Usually it might go into configure.swift or app.swift depending on how you use it.

@Andrewangeta Thanks for the quick response!

Still curious about this line: stripeClient = try app.make(StripeClient.self).

Does that go in controllers/functions where you need to use the library?

I tried putting it in a route handler and got the following error: Value of type '(Environment) throws -> Application' has no member 'make'

I plan on opening a README-updating PR for this, so any and all info you can provide will go a long way. Thanks!

@lukenewman It should be

let client = try req.make(StripeClient.self)
// ... Anything I need to do with it