Last active
April 18, 2016 15:59
-
-
Save zra95/094e3520e0ab3ac6f7605c62a23d8139 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
import Stripe | |
struct StripeTools { | |
//store stripe secret key | |
private var stripeSecret = "mysecrettestkey" | |
//generate token each time you need to get an api call | |
func generateToken(card: STPCardParams, completion: (token: STPToken?) -> Void) { | |
STPAPIClient.sharedClient().createTokenWithCard(card) { token, error in | |
if let token = token { | |
completion(token: token) | |
} | |
else { | |
print(error) | |
completion(token: nil) | |
} | |
} | |
} | |
func getBasicAuth() -> String{ | |
return "Bearer \(self.stripeSecret)" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment