This is the home page of the Adyen Issuing SDKs.
The repository contains the following SDKs:
Adyen Google Wallet Provisioning Android SDK simplifies integration with Google Wallet.
The SDK is available from Maven Central.
- Import the SDK by adding this line to your
build.gradlefile.
implementation("com.adyen.issuing.provisioning:provisioning-sdk:0.4.1")See here for instructions on how to request and install the Google Push Provisioning API.
The SDK interaction is performed through calls to an instance of CardProvisioning. This instance is provided by a static function of the CardProvisioning class:
fun create(
sdkInput: String,
activityProvider: () -> Activity,
): CardProvisioningCreateResultThe CardProvisioning class utilises suspend functions which return when the requested operation has either completed or failed and return objects which can be queried for the request state:
suspend fun canProvision(): CanProvisionResult
suspend fun provision(cardDisplayName: String, cardAddress: CardAddress, opcProvider: OpcProvider): ProvisionResultPerform a GET request to endpoint /paymentInstruments/{paymentInstrumentId}/networkTokenActivationData from your backend. The response contains sdkInput data.
Make a call to the CardProvisioning.create() static function passing in the sdkInput data and a function which returns an Activity (this function should return the Activity which hosts your application's card issuing functionality, or the main Activity for a single Activity application).
The create() function returns a result object which indicates success or failure of the operation. Possible failure reasons are that Google Pay is not supported for the given card or the the sdkInput data is invalid and cannot be parsed.
val result = CardProvisioning.create(
sdkInput = sdkInput,
activityProvider = { cardIssuingActivity },
)
val cardProvisioning = when(result) {
is CardProvisioningCreateResult.Success -> result.cardProvisioning
is CardProvisioningCreateResult.Failure.GooglePayNotSupported -> throw Exception("The card does not support Google Pay")
is CardProvisioningCreateResult.Failure.InvalidSdkInput -> throw Exception("The sdk input data is invalid")
}Check if the cardholder can add a payment card to their Google Wallet.
val canProvision = cardProvisioning.canProvision() == CanProvisionResult.CanBeProvisionedWhen the cardholder opts to add a card to Google Wallet, initiate provisioning by performing the following steps:
- Implement the
OpcProviderinterface. This interface is responsible for fetching the Opaque Payment Card (OPC) data from your backend. ThefetchOpcfunction will be called by the SDK during the provisioning flow. InsidefetchOpc, make aPOSTpaymentInstruments/{paymentInstrumentId}/networkTokenActivationDatarequest from your backend. The body must contain thesdkOutputprovided by the SDK. The response contains thesdkInputobject (which is the OPC).
val opcProvider = OpcProvider { paymentInstrumentId, sdkOutput ->
// Make network request to your backend to get the OPC
// POST /paymentInstruments/{paymentInstrumentId}/networkTokenActivationData
// Body: { "sdkOutput": sdkOutput }
// Return the OPC string from the response
return@OpcProvider opcString
}- Make a call to
cardProvisioning.provision()passing the cardholder name string, an instance ofCardAddress, and theopcProvider:
cardProvisioning.provision(
cardDisplayName = "John Doe",
cardAddress = CardAddress(),
opcProvider = opcProvider
)Note: If you provide an empty CardAddress, as above, then the user will be prompted to enter their address during the Google Wallet provisioning flow.
For more documentation refer to our complete documentation
- Example App
- Full Documentation
- SDK Reference Adyen Google Pay Provisioning
- Data security at Adyen
- Migrating from SDK versions prior to 0.4.0
- Troubleshooting
This SDK is available under the Apache License, Version 2.0. For more information, see the LICENSE file.