PAN Hash
The PAN Hash plugin retrieves a hash representation of the transaction card PAN (Primary Account Number) and shares it with the integrating app before transaction confirmation.
Installation
Add the GeoiOSPanHashPlugin product using Swift Package Manager:
https://bitbucket.org/geopagos-sdk/ios-panhashplugin-package.git
Import the plugin in the code that configures the SDK:
import GeoiOSPanHashPlugin
Configure the plugin
Plugins are added to the SDK configuration with set(plugins:):
let configuration = try PaymentsConfiguration.Builder(
endpoint: URL(string: "https://your-api.example.com")!,
readerInstallers: readerInstallers
)
.set(plugins: [
SDKPanHashPluginInstallerFactory.getInstaller(
delegate: self,
url: URL(string: "https://your-api.example.com")!
)
])
.build()
PaymentsSDK.configure(paymentsConfiguration: configuration)
SDKPanHashPluginInstallerFactory creates the plugin installer. Its url is the integrating app backend URL that serves the PAN Hash request.
When the PAN Hash is retrieved, the plugin decodes it into PanHashResponseData, which contains the PAN hash and the associated transaction card:
public struct PanHashResponseData {
public let panHash: UUID
public let transactionCard: PanHashTransactionCard
}
If the PAN Hash request fails, the SDK reports a recoverable internalError.
Implement the callback
Implement SDKPanHashCallback to receive the PAN Hash and provide the credentials required by the plugin:
extension PaymentDelegate: SDKPanHashCallback {
func onRetrieved(_ panhash: PanHashResponseData) {
// Store or use panhash.panHash.
}
func getAuthToken() -> String {
authToken
}
func getApplicationKey() -> String {
applicationKey
}
}