- This pod has been deprecated. It has been continued here.
To run the example project, clone the repo, and run pod install
from the Example directory first.
Paybear.shared.setToken("your-api-key")
Paybear.shared.getCurrencies(completion: { (currencies, error) in
if let currencies = currencies, error == nil {
// Array of currency. Nice
}
})
Paybear.shared.getMarketRates(fiat: .usd) { (rates, error) in
if let rates = rates, error == nil {
// ...
}
}
Paybear.shared.getSingleMarketRate(fiat: .usd, crypto: .btc) { (rate, error) in
if let rate = rate, error == nil {
// ...
}
}
Paybear.shared.createPaymentRequest(crypto: .btc, callbackURL: "http://ryans.online") { (request, error) in
if let request = request, error == nil {
// ...
}
}
Paybear.shared.getPaymentRequestQR(crypto: .btc, amount: 1.0, address: "123", message: "Free money", size: nil) { (image) in
if let image = image {
// QR code image containing a payment URL
}
}
Paybear.shared.login(email: "you@paybear.io", password: "password", twoFactorDelegate: nil) { (token, error) in
if let token = token, error == nil {
// We can now make user-based requests with our stored token!
}
}
Utilize the TwoFactorAuthProtocol
to receive a callback when a 2FA code is requested.
Paybear.shared.login(email: "you@paybear.io", password: "password", twoFactorDelegate: self) { (token, error) in
if let token = token, error == nil {
// We can now make user-based requests with our stored token!
}
}
func paybearDidRequestTwoFactorAuthentication() {
// Prompt for 2FA code here
Paybear.shared.loginTwoFactor(code: "123456") { (success) in
if success {
// We have completed the login process
}
}
}
Paybear.shared.loginTwoFactor(code: "123456") { (success) in
if success {
// We have completed the login process
// Best to call this function on login completion
}
}
Paybear.shared.getUser(completion: { (user, error) in
if let user = user, error == nil {
// We've got a valid user object!
}
})
Paybear.shared.enableCurrency(.btc, enable: true, address: "123", completion: { (success) in
if success {
// Enabled BTC with wallet address 123
}
})
- Alamofire
- Quick/Nimble (to run tests only)
paybear-ios is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod 'paybear-ios'
Ryan Cohen, notryancohen@gmail.com
paybear-ios is available under the MIT license. See the LICENSE file for more info.