Hi, I am trying to use VIZA API in Android/Kotlin and I am not able to fine any sample in Java or kotlin for Android, there was some samples they are in Java but not fit for Android. Generally I need to add card/bank account in my app and use lock/unlock, change merchant type and transaction type options etc. ?
Solved! Go to Solution
Hey @Shant,
First, check out our API Browser for an API that fits your use case - https://developer.visa.com/apibrowser
Looking at your use case, I'd recommend you to use the Visa Transaction Controls API.
VTC Overview - https://developer.visa.com/capabilities/vctc
VTC Documentation - https://developer.visa.com/capabilities/vctc/docs-getting-started
VTC API Reference - https://developer.visa.com/capabilities/vctc/reference
As a use case example, I'm also providing to you a use case below of what MSU Federal Credit Union did for their app that can lock card and unlock card. Click on this link for the MSU Federal Credit Union use case here - https://developer.visa.com/use-cases/partner-showcase/michigan-state-university
Also, you can download the Sample Code from the VDP website, if you login to your VDP account and go to “My Account” > “Dashboard” > select Project Name > “Sample Code” > then select the code language and click on the “Download … Code” button
Hi Diana,
Thanks for response, unfortunatly provided information not been very helpfull.. For MSU Federal Credit Union its not showing as any source code so we can understand how its been implemented, they just telling use case which not helpfull at all.
Regarding Sample source code which I mentioned, as I said I saw that before but samples are not for android.
Hope you can provide some official sample which I can use/run in Android.
Regards,
Shant
Hey @Shant,
I'll take a look to see what we have and I'll get back to you soon!
Thanks
Hi Diana
Am adding visa checkout to an android application. but i havent seen any documentation on how to go about it can you help.
Hey @kennehsq,
If you'd like to integrate with Visa Checkout, you can use the integration guides below.
https://developer.visa.com/capabilities/visa_checkout/docs
Currently, Visa Checkout is not running any promotions or facilitating integration assistance for donations.
You'll need to remember that you need to have an active merchant acquiring account to process Visa Checkout transactions.
Have a good weekend!
Hey @Shant,
To follow up, while you might be trying to use VTC APIs, I think the question is really a VDP question and how one talks with VDP APIs. At this time, it looks like Visa APIs don’t support Android.
Hi @Diana
I done investigation and found way how to integrate VTC API calls and how to use some features of VDP in android application.
I will tell steps so its might be helpfull some other people as well.
1. You can use this URL to get JAR fine and install it in your PC to be able to check API calls https://developer.visa.com/pages/visa-developer-center-playground
The same time you can use that app to generate merged certificate by including to it public and private keys (like cert.pem and private.pem)
2. Then we need to generate BKS cetificate from that, because in Android we need to use BKS as certificate format(lets call it key_store.bks)
3. Then adding that BKS certificate in android project (for example in raw folder)
4. Then we need manually read that certificate and "attache" to OkHttpClient
STORE_PASSWORD is that password which was set by developer when generating BKS
Sample here
fun provideHttpClient(context: Context): OkHttpClient =
OkHttpClient.Builder()
.ensureSecureConnection(context)
.readTimeout(TIMEOUT, TimeUnit.SECONDS)
.build()
@Throws(GeneralSecurityException::class, IOException::class)
fun OkHttpClient.Builder.ensureSecureConnection(context: Context): OkHttpClient.Builder {
httpLoggingConf(this)
val password = STORE_PASSWORD.toCharArray()
val keyStore = KeyStore.getInstance(KeyStore.getDefaultType())
keyStore.load(null, UUID.randomUUID().toString().toCharArray())
val inputStream = context.resources.openRawResource(R.raw.key_store)
keyStore.load(inputStream, password)
val keyManagerFactory = KeyManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm())
keyManagerFactory.init(keyStore, password)
val trustManagerFactory = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm())
trustManagerFactory.init(keyStore)
val sslContext: SSLContext = SSLContext.getInstance("TLS")
sslContext.init(keyManagerFactory.keyManagers, trustManagerFactory.trustManagers, null)
val sslSocketFactory = sslContext.socketFactory
val trustManagers: Array<TrustManager> = trustManagerFactory.trustManagers
if (trustManagers.isEmpty() || trustManagers.first() !is X509TrustManager) {
throw IllegalStateException("Unexpected default trust managers:" + trustManagers.contentToString())
}
val trustManager = trustManagers.first() as X509TrustManager
this.addInterceptor(BasicAuthInterceptor())
.sslSocketFactory(sslSocketFactory, trustManager)
return this
}
Hey @Shant,
Thanks for your detailed explanation, it is truly helpful to the Visa developer community! Have a nice weekend 🙂