Skip to content

Commit

Permalink
API Key changes
Browse files Browse the repository at this point in the history
  • Loading branch information
imayaselvan committed Dec 16, 2021
1 parent 1af0834 commit 0bd2763
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 12 deletions.
8 changes: 4 additions & 4 deletions Chargebee/Classes/Configuration/CBEnvironment.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions Chargebee/Classes/Configuration/Chargebee.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
2 changes: 1 addition & 1 deletion Chargebee/Classes/Token/CBPaymentConfigResource.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion Example/Chargebee/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
2 changes: 1 addition & 1 deletion Example/Chargebee/CBSDKConfigurationViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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")

```

Expand Down

0 comments on commit 0bd2763

Please sign in to comment.