Skip to main content

Card Utilities

You can use these methods for card payment method integration.

Fetch Card Network

The SDK provides a method to get the card network name of the provided card number.
  • At least 6 digits of the card number are required to identify the network.
  • Possible values returned by this method are, visa, mastercard, maestro16, amex, rupay, maestro, diners and unknown.
  • If it is not able to identify the network it returns unknown.
Java

Card Number Validation

The SDK provides a checksum-based method to determine if the entered card number is valid or not.
Java

Fetch Card Number Length for Card Network

The SDK provides a method to get the length of the card number for a specific card network.
Java

Validate VPA

The SDK provides a method to determine if the entered Virtual Payment Address (VPA) is valid or not. A failure response is triggered when the vpaAddress is empty or the device is not connected to data to make the validation.
Java

Fetch Bank Logo URL

The SDK provides a method to fetch the bank logo’s URL, here bankCode is the code of bank, you will be able to get it from the response received in onPaymentMethodsReceived callback.
Java

Fetch Wallet Logo URL

The SDK provides a method to get the wallet logo’s URL.
Java

Fetch Wallet Square Logo URL

The SDK provides a method to get the wallet’s square-shaped logo’s URL.
Java

Data Validation

The SDK provides basic validation for the payment data JSONObject. In case of a validation error, the SDK returns an error map in the onValidationError callback function.

Sample Code

The sample code shown below describes a validation error on the contact field:
Java

Custom WebViewClient and WebChromeClient

Our SDK sets an instance of RazorpayWebViewClient and RazorpayWebChromeClient to the WebView passed to facilitate bank page optimizations. If you want to set your own custom WebViewClient you have to extend RazorpayWebViewClient and pass it to our SDK.
Watch Out!This step is optional and is only required when you want to set a custom WebViewClient/WebChromeClient

Sample Code

The sample code given below shows how to customize the RazorpayWebViewClient:
Java
Similarly, you can set your own WebChromeClient:
Java

Save Customer Data

You can associate card details with a saved customer or create payments using tokens for saved cards. To use this functionality, you must use customer APIs at server side.

Create a Payment With New Card

While creating a payment with new card, you would need to pass the customer_id and save as extra fields, along with the other fields as shown below:
JAVA

Create a Payment With Existing Saved Card

To create a payment with an existing saved card, you have to pass the token instead of the card number, expiry and card holder’s name fields as shown below:
JAVA