diff --git a/Chargebee/Classes/Configuration/CBEnvironment.swift b/Chargebee/Classes/Configuration/CBEnvironment.swift index ca1eaf5..cec6001 100644 --- a/Chargebee/Classes/Configuration/CBEnvironment.swift +++ b/Chargebee/Classes/Configuration/CBEnvironment.swift @@ -6,18 +6,18 @@ import Foundation class CBEnvironment { static var site: String = "" - static var publishableApiKey: String = "" + static var apiKey: String = "" static var encodedApiKey: String = "" static var baseUrl: String = "" static var allowErrorLogging: Bool = true static var sdkKey : String = "" static var version : CatalogVersion = .unknown - static func configure(site: String, publishableApiKey: String, allowErrorLogging: Bool, sdkKey: String? = nil) { + static func configure(site: String, apiKey: String, allowErrorLogging: Bool, sdkKey: String? = nil) { CBEnvironment.site = site - CBEnvironment.publishableApiKey = publishableApiKey + CBEnvironment.apiKey = apiKey CBEnvironment.allowErrorLogging = allowErrorLogging - CBEnvironment.encodedApiKey = CBEnvironment.publishableApiKey.data(using: .utf8)?.base64EncodedString() ?? "" + CBEnvironment.encodedApiKey = CBEnvironment.apiKey.data(using: .utf8)?.base64EncodedString() ?? "" CBEnvironment.baseUrl = "https://\(CBEnvironment.site).chargebee.com/api" CBEnvironment.version = .unknown diff --git a/Chargebee/Classes/Configuration/Chargebee.swift b/Chargebee/Classes/Configuration/Chargebee.swift index 7c02e7a..b36149f 100644 --- a/Chargebee/Classes/Configuration/Chargebee.swift +++ b/Chargebee/Classes/Configuration/Chargebee.swift @@ -9,7 +9,7 @@ public class Chargebee { public init() { } - public static func configure(site: String, publishableApiKey: String, sdkKey: String? = nil, allowErrorLogging: Bool = true) { - CBEnvironment.configure(site: site, publishableApiKey: publishableApiKey, allowErrorLogging: allowErrorLogging, sdkKey: sdkKey) + public static func configure(site: String, apiKey: String, sdkKey: String? = nil, allowErrorLogging: Bool = true) { + CBEnvironment.configure(site: site, apiKey: apiKey, allowErrorLogging: allowErrorLogging, sdkKey: sdkKey) } } diff --git a/Chargebee/Classes/Token/CBPaymentConfigResource.swift b/Chargebee/Classes/Token/CBPaymentConfigResource.swift index 465d4d3..3a5e8a6 100644 --- a/Chargebee/Classes/Token/CBPaymentConfigResource.swift +++ b/Chargebee/Classes/Token/CBPaymentConfigResource.swift @@ -11,7 +11,7 @@ final class CBPaymentConfigResource: CBAPIResource { var baseUrl: String var authHeader: String? { get { - "Basic \(CBEnvironment.publishableApiKey)" + "Basic \(CBEnvironment.apiKey)" } } var methodPath: String = "/internal/component/retrieve_config" diff --git a/Example/Chargebee/AppDelegate.swift b/Example/Chargebee/AppDelegate.swift index 01087d7..4926b9e 100644 --- a/Example/Chargebee/AppDelegate.swift +++ b/Example/Chargebee/AppDelegate.swift @@ -19,7 +19,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate { // Override point for customization after application Chargebee.configure(site: "Site Name", - publishableApiKey: "API Key",sdkKey: "ResourceID/SDK Key") + apiKey: "API Key- (full Access)",sdkKey: "ResourceID/SDK Key") return true } } diff --git a/Example/Chargebee/CBSDKConfigurationViewController.swift b/Example/Chargebee/CBSDKConfigurationViewController.swift index fca1fca..af45fbc 100644 --- a/Example/Chargebee/CBSDKConfigurationViewController.swift +++ b/Example/Chargebee/CBSDKConfigurationViewController.swift @@ -44,7 +44,7 @@ final class CBSDKConfigurationViewController: UIViewController { @IBAction private func initializeClicked(_ sender: UIButton) { // guard canInitialise() else { return } Chargebee.configure(site: siteNameTextField.unwrappedText, - publishableApiKey: apiKeyTextField.unwrappedText, + apiKey: apiKeyTextField.unwrappedText, sdkKey: sdkKeyTextField.unwrappedText, allowErrorLogging: true) } diff --git a/README.md b/README.md index 95bbac2..e3f8d87 100644 --- a/README.md +++ b/README.md @@ -40,19 +40,19 @@ You can initialize the SDK during your app startup by including the following in import Chargebee Chargebee.configure(site: "your-site", - publishableApiKey: "api_key", + apiKey: "api_key", sdkKey: "sdk_key") } ``` ### Configuration for using tokenization only -If you want to use the Chargebee iOS SDK only for tokenizing credit card details, you can initialize the SDK with your Chargebee Site and Publishable API key alone. You can initialize the SDK during your app startup by including the following in your app delegate. +If you want to use the Chargebee iOS SDK only for tokenizing credit card details, you can initialize the SDK with your Chargebee Site and API key alone. You can initialize the SDK during your app startup by including the following in your app delegate. ```swift import Chargebee -Chargebee.configure(site: "your-site", publishableApiKey: "api_key") +Chargebee.configure(site: "your-site", apiKey: "api_key") ```