Push to the digital wallet
Push to the digital wallet
Overview
Flow
Sequence diagram
Platform integration
Last updated
Was this helpful?
Was this helpful?
//activity: Current activity for OEM Push Provisioning.
//cardID: Card ID received.
fun pushCardToWallet_v2_4_0(d1Task: D1Task, cardID: String, activity: Activity) {
val wallet = OEMPayType.GOOGLE_PAY //GOOGLE_PAY, SAMSUNG_PAY, NONE
val callback: D1Task.Callback<Any?> = object : D1Task.Callback<Any?> {
override fun onSuccess(data: Any?) {
// Handles the `digitalCardStatus` object from the server.
}
override fun onError(exception: D1Exception) {
// Refer to D1 SDK Integration – Error Management section.
}
}
val d1PushWallet : D1PushWallet = d1Task.d1PushWallet
d1PushWallet.addDigitalCardToOEM(cardID, wallet, activity, callback)
}
// NOTE: Implement the `onActivityResult` method to forward all the callback events to the SDK.
// Activity Result: The `onActivityResult` method is received in the issuer app from GPay SDK, and passed back to D1 SDK to handle the result.
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
d1Task.handleCardResult(requestCode, resultCode, data);
}let cardID = "" // Obtained by the issuer application, for example from your backend
let viewController = /* current UIViewController instance presenting the Apple Pay UI */
d1Task.addDigitalCardToOEM(cardID, viewController: viewController) { error in
if let error = error {
// Refer to the D1 SDK integration error management section
} else {
// Update the UI, for example confirm that the card was added to Apple Wallet
}
}