Android
Payment SDK (Android, Kotlin)
Features
Installation
allprojects
repositories
SDK integration
Initialization
Add the PaymentView
to your activity
<money.paybox.payboxsdk.view.PaymentView
android:id="@+id/paymentView"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
Pass the instance of paymentView
to the SDK
To track the progress of loading the payment page, use WebListener
SDK Configuration
Test mode
Region selection
Region.DEFAULT
is the default value
Region
class has the following values:Parameter | Value |
---|---|
DEFAULT | Kazakhstan and other countries of presence |
RU | Russia |
UZ | Uzbekistan |
KG | Kyrgyzstan |
Payment System selection
Payment currency selection
Auto-clearing activation
Encoding configuration
Lifetime of the recurring profile
Lifetime of the payment page, within which the payment must be completed
Enabling recurring payment mode
false
Setup customer's phone
Setup customer's email
Language of the payment page
To transmit information from the payment gateway
Display a Frame instead of the payment page
false
Working with the SDK
Creating a payment
paymentView
.Recurring payment
Fetching the payment status
Payment clearing
null
is specified instead of the clearing amount, the clearing will be processed for the full payment amount.
Payment cancellation
Payment refund
Saving the card
paymentView
.Retrieve the list of saved cards
Removing a saved card
Creating a payment with a saved card
createCardPayment
method using cardId
is deprecated
Confirming the payment of a created payment
paymentView
.Confirming the payment of a created payment with a direct debit (without acceptance)
Google Pay Integration
Add the dependency to your build.gradle
Next, update the AndroidManifest
<application>
...
<!-- Enables the Google Pay API -->
<meta-data android:name="com.google.android.gms.wallet.api.enabled"
android:value="true" />
</application>
Add the PayButton
to your XML
<com.google.android.gms.wallet.button.PayButton
android:id="@+id/buttonPaymentByGoogle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
/>
Initializing the payment button for Google Pay PayButton
Initializing the PaymentsClient
Wallet.getPaymentsClient
is the method to get an instance of PaymentsClient
.Parameter | Value |
---|---|
ENVIRONMENT_PRODUCTION | production environment |
ENVIRONMENT_TEST | test environment |
THEME_LIGHT | light theme |
Creating a payment using Google Pay
sdk.createGooglePayment
— Creating a payment using Google Pay.createPaymentDataRequest()
— A method that returns a PaymentDataRequest
object. This object defines the parameters and requirements for the payment data request, such as payment methods, shipping address, and more (the code is provided below).loadPaymentData()
— Initiates an asynchronous task to load payment data using the provided request.AutoResolveHelper.resolveTask<PaymentData>()
— A method used to handle the payment data loading task.REQUEST_CODE
— A request code used to identify the result of the task in the onActivityResult
method.The createPaymentDataRequest()
method creates and returns a PaymentDataRequest
object for use with the Google Pay API
PaymentDataRequest.newBuilder()
- Creates a new builder for the payment data request.setTransactionInfo()
- Sets transaction information, such as the total payment amount and currency code.PaymentMethodTokenizationParameters.newBuilder()
- Creates a builder for the payment method tokenization parameters.setPaymentMethodTokenizationType()
- Sets the tokenization type (in this case, a payment gateway).addParameter()
- Adds parameters for the payment gateway, such as gateway
and gatewayMerchantId
.setPaymentMethodTokenizationParameters()
- Sets the tokenization parameters in the payment data request.Get the result in onActivityResult()
onActivityResult
- Used to handle the results returned by the Google Pay integration activity.data
- The object containing the data returned by the activity.Activity.RESULT_OK
- This constant indicates the successful completion of the operation.AutoResolveHelper.RESULT_ERROR
- This constant is used to indicate that an error occurred while resolving the request.Payment confirmation
Support
If you have questions or need help, feel free to reach out! 👋
Modified at 2025-02-17 19:28:25