-
Declaration
Swift
public var environment: Environment
-
Declaration
Swift
public static let version: String
-
Declaration
Swift
public static let shared: ForageSDK
-
Declaration
Swift
public struct Config
Parameters
merchantID
The unique merchant ID that Forage provides during onboarding preceded by
mid/
, as inmid/<Merchant ID>
sessionToken
The session token that your backend generates to authenticate your app against the Forage Payments API. The token expires after 15 minutes.
-
Configures the Forage SDK with the given configuration.
This sets up the merchant ID, session token, and other internal state needed to make API calls. It must be called before using the SDK.
Use
updateMerchantID(_:)
to update the merchant ID after configuring.Use
updateSessionToken(_:)
to update the session token after it expires.
Declaration
Swift
public class func setup(_ config: Config)
Parameters
config
The configuration used to setup the SDK.
-
Updates the merchant ID to use for subsequent API calls. Use this method to change the active merchant ID if your app supports multiple merchants.
Declaration
Swift
public static func updateMerchantID(_ newMerchantID: String)
Parameters
newMerchantID
The new merchant ID to set.
-
Updates the session token to use for subsequent API calls.
Session tokens expire after 15 minutes. Use this method to set a new session token after refreshing it from your backend.
Declaration
Swift
public static func updateSessionToken(_ newSessionToken: String)
Parameters
newSessionToken
The new session token to use for subsequent API calls
-
Declaration
Swift
public func tokenizeEBTCard( foragePanTextField: ForagePANTextField, customerID: String, reusable: Bool? = true, completion: @escaping (Result<PaymentMethodModel, Error>) -> Void )
-
Declaration
Swift
public func checkBalance( foragePinTextField: ForagePINTextField, paymentMethodReference: String, completion: @escaping (Result<BalanceModel, Error>) -> Void)
-
Declaration
Swift
public func capturePayment( foragePinTextField: ForagePINTextField, paymentReference: String, completion: @escaping (Result<PaymentModel, Error>) -> Void)