VGS provides you with a Universal Checkout and User Experience which is fully integrated with our payment optimization solution. We offer a single, customized, consistent experience to your customers across mobile devices with Android OS.
- add-cards-example - sample application of VGS Checkout which shows how to submit card data with VGS.
- vgscheckout - provides an API for interacting with the VGS services.
For integration you need to install the Android Studio and a JDK on your machine.
Integrate the VGS Checkout to your project. If you are using Maven, add the following to your build.gradle file.
|
|
dependencies {
implementation "com.verygoodsecurity:checkout:<latest-version>"
} |
|
To initialize VGS Checkout you have to set your access token, vault id and environment type.
You can find additional information about VGS Checkout configurations at the following section. |
|
class MainActivity : AppCompatActivity() {
private lateinit var checkout: VGSCheckout
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
checkout = VGSCheckout(this)
}
private fun presentVGSCheckout() {
checkout.present("<ACCESS_TOKEN>", "<VAULT_ID>", VGSCheckoutEnvironment.Sandbox())
}
} |
|
In case you need retrieve responses, put VGSCheckoutCallback as a second parameter during initialization VGSCheckout .
|
|
class MainActivity : AppCompatActivity() {
private lateinit var checkout: VGSCheckout
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
checkout = VGSCheckout(this, object : VGSCheckoutCallback {
override fun onCheckoutResult(result: VGSCheckoutResult) {
when (result) {
is VGSCheckoutResult.Success -> {
// TODO: Handle success
}
is VGSCheckoutResult.Failed -> {
// TODO: Handle failed
}
is VGSCheckoutResult.Canceled -> {
// TODO: Handle canceled
}
}
}
})
}
private fun presentVGSCheckout() {
checkout.present("<ACCESS_TOKEN>", "<VAULT_ID>", VGSCheckoutEnvironment.Sandbox())
}
} |
Check out documentation guides:
For a quick start, try our Demo application.
VGS Checkout is released under the MIT license. See LICENSE for details.