Skip to content

voltmx.payment Namespace

The Payment API contains the voltmx.payment Namespace and the following API elements:

Functions

The voltmx.payment Namespace contains the following functions.

voltmx.payment.canWeMakePayment


Determines if users can make payments on their device. When users call this function without specifying the paymentRequirements parameter, it verifies the minimum platform requirements and these requirements differ from platform to platform. Users can enforce additional requirements apart from the minimum platform requirements by using the optional parameter: paymentRequirements.

Syntax


voltmx.payment.canWeMakePayment(canWeMakePaymentCallback,paymentRequirements);

Input Parameters

Parameter Description
paymentRequirements[JSON map object] It is the only optional parameter supported by this function. Once this parameter is set, the canWeMakePayment function returns true if a user has an existing payment method that matches the criteria specified in paymentRequirements. Supported Values paymentRequirements:{"paymentCardNetworks" :[], "paymentMethodType" :[]} 1.1 paymentCardNetworks[JSON List Object] This key is used to check whether any of the specified network cards is available in a user's payment account. If no payment cards have been added, the canWeMakePayment function always returns false. If no cards are specified ,the default supported card networks will be voltmx.payment.NETWORK_MASTERCARD, voltmx.payment.NETWORK_VISA, voltmx.payment.NETWORK_DISCOVER, and voltmx.payment.NETWORK_AMEX. The following constants are applicable for this object: voltmx.payment.NETWORK_MASTERCARD voltmx.payment.NETWORK_VISA voltmx.payment.NETWORK_DISCOVER voltmx.payment.NETWORK_AMEX voltmx.payment.NETWORK_JCB voltmx.payment.NETWORK_INTERAC iOS-specific Constants voltmx.payment.NETWORK_PRIVATELABEL voltmx.payment.NETWORK_IDCREDIT voltmx.payment.NETWORK_SUICA voltmx.payment.NETWORK_QUICPAY voltmx.payment.NETWORK_CHINAUNIONPAY voltmx.payment.NETWORK_CARTESBANCAIRES voltmx.payment.NETWORK_CARTEBANCAIRES voltmx.payment.NETWORK_CARTEBANCAIRE Supported Values paymentCardNetworks : [voltmx.payment.NETWORK_MASTERCARD,voltmx.payment.NETWORK_VISA] 1.2 paymentMethodType[JSON List Object] This key is used to add specified requirements to cards that were added in the paymentCardNetworks Object. The canWeMakePayment function checks for cards in the paymentCardNetworks JSON object with the capabilities mentioned for paymentMethodType[JSON object]. If the payment cards in the user account meet any of the criteria, the canWeMakePayment function returns true; else, the function returns false. The following constants are applicable for this object: iOS-specific Constants voltmx.payment.METHODTYPE_3DS: For 3DS secured payment type. voltmx.payment.METHODTYPE_CREDIT: For Credit payment method type. voltmx.payment.METHODTYPE_DEBIT: For Debit payment method type. voltmx.payment.METHODTYPE_EMV: For EMV secured payment method type. Android-specific Constants voltmx.payment.METHODTYPE_ANDROIDPAY: All the cards added in Android Pay are taken into consideration. voltmx.payment.METHODTYPE_GOOGLE: All the cards added in Google account are taken into consideration. If no payment methods are specified, the default supported payment methods are as follows: For iOS: voltmx.payment.METHODTYPE_3DS For Android: voltmx.payment.METHODTYPE_GOOGLE and voltmx.payment.METHODTYPE_ANDROIDPAY
canWeMakePaymentCallback [Function Object] It is a mandatory parameter. If user can execute a payment transaction on their device or if the paymentRequirements criteria is met, the callback is executed with boolean value as true; else, the callback returns false.

Example


paymentRequirements = {
    paymentCardNetworks: [voltmx.payment.NETWORK_MASTERCARD],
    paymentMethodType: [voltmx.payment.METHODTYPE_CREDIT]
};

function canWeMakePaymentCallback(result) {
    alert(result);
}
voltmx.payment.canWeMakePayment(canWeMakePaymentCallback, paymentRequirements);

Platform Availability

  • Android
  • iOS

voltmx.payment.getPaymentData


This asynchronous API returns paymentResponseData, which contains the necessary information to complete a payment transaction, in the successCallback. This generally requires the UI to be shown to the users so that they can select the payment method, shipping address, and other transaction information. Based on the paymentRequestData object values, the Payment Sheet UI input fields and the values in paymentResponseData are framed.

Syntax


voltmx.payment.getPaymentData(paymentRequestData,successCallback,errorCallback);

Input Parameters

1. paymentRequestData[JSON Map Object]

Based on this object, the Payment Sheet UI input fields and the values in paymentResponseData are framed.

It has the following key-value pairs:

paymentRequestData : { "paymentCardsInfo" : { }, "shippingAddressInfo" : { }, "billingAddressInfo" : { }, "merchantInfo" : { }, "paymentSummary": { } }

1.1 paymentCardsInfo[JSON Map Object]

The information on supported payment cards is configured in this object. It has the following key-value pairs:

paymentCardsInfo : { "paymentCardNetworks" : [ ], "paymentMethodType" : [ ], "supportedCountries" : [ ] }

1.1.1 paymentCardNetworks[JSON List Object]

It has the list of card networks to limit payments to specific network cards. The values allowed for this key are as follows:

  • voltmx.payment.NETWORK_MASTERCARD
  • voltmx.payment.NETWORK_VISA
  • voltmx.payment.NETWORK_DISCOVER
  • voltmx.payment.NETWORK_AMEX
  • voltmx.payment.NETWORK_JCB
  • voltmx.payment.NETWORK_INTERAC

Note: If no cards are specified, the default supported card networks will be voltmx.payment.NETWORK_MASTERCARD, voltmx.payment.NETWORK_VISA, voltmx.payment.NETWORK_DISCOVER, and voltmx.payment.NETWORK_AMEX.

iOS-specific Constants

  • voltmx.payment.NETWORK_SUICA
  • voltmx.payment.NETWORK_QUICPAY
  • voltmx.payment.NETWORK_IDCREDIT
  • voltmx.payment.NETWORK_PRIVATELABEL
  • voltmx.payment.NETWORK_CHINAUNIONPAY
  • voltmx.payment.NETWORK_CARTESBANCAIRES
  • voltmx.payment.NETWORK_CARTEBANCAIRES
  • voltmx.payment.NETWORK_CARTEBANCAIRE

Supported Values


paymentCardNetworks : [voltmx.payment.NETWORK_MASTERCARD, voltmx.payment.NETWORK_VISA]

1.1.2 paymentMethodType[JSON List Object]

It has a list of payment methods to limit payments to specific cards. The values allowed for this key are as follows:

Note: In iOS, 3DS cards are supported by default.

iOS-specific Constants

  • voltmx.payment.METHODTYPE_EMV: For Prepaid payment method type.
  • voltmx.payment.METHODTYPE_CREDIT: For Credit payment method type.
  • voltmx.payment.METHODTYPE_DEBIT: For Debit payment method type.

Example


paymentMethodType : [voltmx.payment.METHODTYPE_CREDIT,voltmx.payment.METHODTYPE_DEBIT,voltmx.payment.METHODTYPE_EMV]

Android-specific Constants

  • voltmx.payment.METHODTYPE_PREPAID: For prepaid cards.
  • voltmx.payment.METHODTYPE_ANDROIDPAY: For cards added in Android Pay.
  • voltmx.payment.METHODTYPE_GOOGLE : For cards added in Google Account.

Note: If no payment methods are specified , the default supported payment methods will be voltmx.payment.METHODTYPE_GOOGLE and voltmx.payment.METHODTYPE_ANDROIDPAY.

Example


paymentMethodType : [voltmx.payment.METHODTYPE_PREPAID]

1.1.3 supportedCountries[JSON List Object]

It contains a list of ISO 3166 country codes to limit payments to cards from specific countries. Only values of type String are allowed for this key.

Platform Availability

  • iOS

Example


supportedCountries : [“IN”,“US”,“AU”]

1.2 shippingAddressInfo[JSON Map Object]

This object enables the Shipping Address fields in the Payment Sheet UI and shipping address values in paymentDataResponse. All the values entered by users in the Payment Sheet UI are returned to you in paymentDataResponse.

shippingAddressInfo has the following key value pairs:

shippingAddressInfo : { "name" : true, "postalAddress" : true , "email" : true, "phoneNumber" : false, "shippingType" : [ ], "shippingMethod" : [ ] }

1.2.1 name[boolean]

If this key value is true, the Name field is enabled under Shipping Address in the Payment Sheet.

Note: By default, the name key value is true.

For Android: The name and postalAddress fields are enabled if the name key value is true.

Example


name : true

1.2.2 postalAddress[boolean]

If this key value is true, the postalAddress field is enabled under Shipping Address of the Payment Sheet.

Note: By default, the postalAddress key value is true.

For Android: The values for the name and postalAddress fields are enabled if the postalAddress key value is true.

Example

postalAddress : true

1.2.3 email[boolean]

The default value is false.

For iOS: If this key value is true, the Email field is enabled under Shipping Address of the Payment Sheet.

For Android: By default, your registered email ID for your Google Play Store account is retrieved and that email ID is auto-populated in t