How to install
Edit your Package.swift
.package(url: "https://github.com/MihaelIsaev/braintree_swift", from: "0.1.0"),
And add "Braintree"
in targets.
First of all import the lib
import Braintree
and then register it as provider
try services.register(Braintree(environment: .sandbox, merchantId: "YOUR_MERCHANT_ID", publicKey: "YOUR_PUBLIC_KEY", privateKey: "YOUR_PRIVATE_KEY"))
Little example of how to use gateways
e.g. you’d like to generate a token for a user, it is possible through ClientToken
gateway
func clientToken(_ req: Request) throws -> Future<String> {
//get an instance of Braintree provider
let bt = try req.make(Braintree.self)
//access clientToken gateway and call its generate endpoint
return try bt.gateway(container: req).clientToken.generate()
}
Contribution
Please feel free to contribute!
Braintree is a big library with a lot of gateways, its objects and requests.
Below you can see a list of completed and incompleted parts of the lib, and it would be great to get any help with it.
ToDo List
Gateways
Objects
Requests
How to install
Edit your
Package.swift
And add
"Braintree"
in targets.Edit your
configure.swift
First of all import the lib
and then register it as provider
Little example of how to use gateways
e.g. you’d like to generate a token for a user, it is possible through
ClientToken
gatewayContribution
Please feel free to contribute!
Braintree is a big library with a lot of gateways, its objects and requests.
Below you can see a list of completed and incompleted parts of the lib, and it would be great to get any help with it.
ToDo List
Gateways
Objects
Requests