This section provides detailed integration instructions for integrating the WLPG SDK with merchant mobile applications.
5.1 Integration of WLPG SDK to Merchant Application
5.1.1 Copy .aar File
The merchant must place the pgsdk.aar file in the merchant mobile application library directory:
app/libs/pgsdk.aar
5.1.2 Mapping .aar File to Gradle
In the merchant application's build.gradle (app module) file, add the following configuration:
repositories {
flatDir {
dirs 'libs'
}
}
dependencies {
implementation(name: 'pgsdk', ext: 'aar')
}After updating the build.gradle file, Gradle must be synchronized to apply the changes.
5.1.3 Permissions
The merchant application must declare the following permission in AndroidManifest.xml:
<uses-permission android:name="android.permission.INTERNET" />5.1.4 Initialize Transaction/Payments
The merchant application must invoke the SDK's initiatePayment API to initiate transactions with WLPG. The API requires the following parameters:
Required Parameters:
- terminalId
- terminalPassword
- jwtUsername
- jwtPassword
- action
- currencyCode
- ipAddress
- amount
- trackId
- firstName
- lastName
- countryCode
- postalCode
- administrativeArea
- address1
- locality
- cardType
- phoneNumber
Implementation Code:
val paymentData = PaymentData(
terminalId,
terminalPassword,
jwtUsername,
jwtPassword,
action,
currencyCode,
ipAddress,
amount,
trackId,
firstName,
lastName,
countryCode,
postalCode,
administrativeArea,
email,
address1,
locality,
cardType,
phoneNumber
)
PGService().initiatePayment(
this@CurrentActivity,
paymentData,
object : PGInterface {
override fun onPGResult(result: PaymentResult) {
// Handle payment result
}
}
)Parameter Details:
| Field Name | Field Description | Mandatory | Field Type | Min/Max Length | Sample |
|---|---|---|---|---|---|
| TerminalID | Terminal ID provided in Merchant integration KIT | M | Alphanumeric | Min 2 - Max 16 | ipay12345abcdef |
| TerminalPassword | Terminal Password provided in Merchant integration KIT | M | Alphanumeric | Max 3000 | T@3093099 |
| JWTUserName | JWT User Name provided in Merchant integration KIT | M | Alphanumeric | - | PINEUSER123 |
| JWTPassword | JWT Password provided in Merchant integration KIT | M | Alphanumeric | - | PINEPASS123 |
| Action | Type of Transaction | M | Numeric | - | 1 |
| CurrencyCode | Currency Code of Transaction | M | Numeric | - | 784 |
| IPAddress | IP Address of the Merchant | M | Numeric with dot | - | 10.44.6.66 |
| Amount | Transaction amount | M | Numeric with dot | - | 70.00 |
| TrackID | Unique ID of the transaction | M | Alphanumeric | - | 123456789012 |
| FirstName | Customer First name | M | Alphabetic | - | TestFirstName |
| LastName | Customer Last name | M | Alphabetic | - | TestLastName |
| CountryCode | Country code | M | Alphabetic | - | India |
| PostalCode | Postal Code | M | Alphanumeric | - | India |
| AdminArea | Administrative Area | M | Alphanumeric | - | ewet |
| Email address of the customer | M | Alphanumeric | - | [email protected] | |
| Address1 | Address of the customer | M | Alphanumeric | - | Abc |
| Locality | Locality of the customer | M | Alphabetic | - | Xyz |
| CardType | Card Type of the transaction | M | Alphabetic | - | C |
| PhoneNumber | Phone number of the customer | M | Numeric | - | 1234567890 |
5.1.5 Handle Payment Response
The SDK provides callback results through the onPGResult callback function. The payment result contains the following fields:
override fun onPGResult(result: PaymentResult) {
// Process payment result
val paymentId = result.paymentId
val transactionResult = result.result
val authCode = result.auth
// Additional processing based on result
}Payment Result Response Fields:
| Field Name | Field Description | Mandatory | Field Type | Min/Max Length | Sample |
|---|---|---|---|---|---|
| paymentId | Unique ID generated by Payment Gateway. This is the same ID that Payment Gateway had provided along with the Payment Page URL for the initial request in case merchant has used Bank Hosted environment for processing purchase request. | M | Alphanumeric | Max 100 | 202421594762867 |
| result | Transaction response. Merchant to evaluate the transaction result and take further action accordingly. | M | Alphanumeric | Max 100 | CAPTURED |
| auth | The resulting authorization number of the transaction from the issuing bank. This number or series of letters is used for referential purposes by some acquiring/issuing bank/institutions and should be stored properly. | M | Alphanumeric | Max 6 | 000000 |
| avr | AVR status of the transaction. | M | Alphabetic | Max 1 | N |
| ref | The resulting reference number of the transaction. This number or series of letters is used for referential purposes by some acquiring/issuing bank/institutions and should be stored properly. | M | Alphanumeric | Max 12 | 935110000001 |
| tranId | Unique Transaction ID generated by Payment Gateway. | M | Numeric | Max 19 | 201931951332346 |
| postDate | Transaction Date in the format of the authorization system. Post Date is business logic date of respective issuing bank and may not be same as the actual date. | M | Numeric | Max 4 | 1217 |
| trackId | A unique tracking ID issued by the merchant's system which is stored with the transaction. | M | Alphanumeric | Max 25 | k1rmMwTSUPiH7V5Ya8di |
| udf1 | A unique tracking ID issued by the merchant's system which is stored with the transaction. | O | Alphanumeric | Max 255 | 1003383844 |
| udf2 | Same udf2 value that merchant has sent in the initial transaction request to Payment Gateway. | O | Alphanumeric | Max 255 | Address 1 |
| udf3 | Same udf3 value that merchant has sent in the initial transaction request to Payment Gateway. | O | Alphanumeric | Max 255 | Address 2 |
| udf4 | Same udf4 value that merchant has sent in the initial transaction request to Payment Gateway. | O | Alphanumeric | Max 255 | City |
| udf5 | Same udf5 value that merchant has sent in the initial transaction request to Payment Gateway. | M (Supporting Transactions only) | Alphanumeric | Max 255 | 1003383844 |
| udf6 | The user (merchant) defines these fields. The field data is passed along with a transaction request and then returned in the transaction response. Merchant should ensure that field is left blank when no data needs to be passed. | O | Alphanumeric | Max 255 | [email protected] |
| udf7 | The user (merchant) defines these fields. The field data is passed along with a transaction request and then returned in the transaction response. Merchant should ensure that field is left blank when no data needs to be passed. | O | Alphanumeric | Max 255 | [email protected] |
| udf8 | The user (merchant) defines these fields. The field data is passed along with a transaction request and then returned in the transaction response. Merchant should ensure that field is left blank when no data needs to be passed. | O | Alphanumeric | Max 255 | [email protected] |
| udf9 | The user (merchant) defines these fields. The field data is passed along with a transaction request and then returned in the transaction response. Merchant should ensure that field is left blank when no data needs to be passed. | O | Alphanumeric | Max 255 | [email protected] |
| udf10 | The user (merchant) defines these fields. The field data is passed along with a transaction request and then returned in the transaction response. Merchant should ensure that field is left blank when no data needs to be passed. | O | Alphanumeric | Max 255 | [email protected] |
| udf11 | The user (merchant) defines these fields. The field data is passed along with a transaction request and then returned in the transaction response. Merchant should ensure that field is left blank when no data needs to be passed. | O | Alphanumeric | Max 255 | [email protected] |
| udf12 | The user (merchant) defines these fields. The field data is passed along with a transaction request and then returned in the transaction response. Merchant should ensure that field is left blank when no data needs to be passed. | O | Alphanumeric | Max 255 | [email protected] |
| udf13 | The user (merchant) defines these fields. The field data is passed along with a transaction request and then returned in the transaction response. Merchant should ensure that field is left blank when no data needs to be passed. | O | Alphanumeric | Max 255 | [email protected] |
| udf14 | The user (merchant) defines these fields. The field data is passed along with a transaction request and then returned in the transaction response. Merchant should ensure that field is left blank when no data needs to be passed. | O | Alphanumeric | Max 255 | [email protected] |
| udf15 | The user (merchant) defines these fields. The field data is passed along with a transaction request and then returned in the transaction response. Merchant should ensure that field is left blank when no data needs to be passed. | O | Alphanumeric | Max 255 | [email protected] |
| udf16 | The user (merchant) defines these fields. The field data is passed along with a transaction request and then returned in the transaction response. Merchant should ensure that field is left blank when no data needs to be passed. | O | Alphanumeric | Max 255 | [email protected] |
| udf17 | The user (merchant) defines these fields. The field data is passed along with a transaction request and then returned in the transaction response. Merchant should ensure that field is left blank when no data needs to be passed. | O | Alphanumeric | Max 255 | [email protected] |
| udf18 | The user (merchant) defines these fields. The field data is passed along with a transaction request and then returned in the transaction response. Merchant should ensure that field is left blank when no data needs to be passed. | O | Alphanumeric | Max 255 | [email protected] |
| udf19 | The user (merchant) defines these fields. The field data is passed along with a transaction request and then returned in the transaction response. Merchant should ensure that field is left blank when no data needs to be passed. | O | Alphanumeric | Max 255 | [email protected] |
| udf20 | The user (merchant) defines these fields. The field data is passed along with a transaction request and then returned in the transaction response. Merchant should ensure that field is left blank when no data needs to be passed. | O | Alphanumeric | Max 255 | [email protected] |
| amt | Transaction Amount as sent by merchant in the request. | M | Numeric | Max 10 | 11.25 |
| error | Error code of the transaction. This will have data in case transaction decline. | M (Failure status only) | Alphanumeric | Max 100 | IPAY0100215 |
| errorText | Error description of the transaction. This will have data in case transaction decline. | M (Failure status only) | Alphanumeric | Max 255 | !ERROR!-IPAY0100215 - Invalid tranportal i |