# Importing Native Module in JS

You may now create `PayContactlessSDKPackage` to register the module.

```kotlin

class PayContactlessSDKPackage : ReactPackage {
    override fun createNativeModules(reactContext: ReactApplicationContext): List<NativeModule> {
        return listOf(PayContactlessSDKModule(reactContext))
    }
    override fun createViewManagers(reactContext: ReactApplicationContext): List<ViewManager<*, *>> {
        return emptyList()
    }
}

```

### Registering the Bridge Package

Add the `PayContactlessSDKPackage` in your `MainApplication.java`:

{% code overflow="wrap" %}

```kotlin
@Override
protected List getPackages() {
return Arrays.asList(
new MainReactPackage(),
new PayContactlessSDKPackage()
);
}
```

{% endcode %}

#### Importing the Native Module in JS

```javascript
import { NativeModules } from 'react-native';
const { PayContactlessSDKModule } = NativeModules;
```

**Merchant PayContactless SDK Request & Response Classes**

| Class / Interface        | Type     | Properties                                                                                                                                                                                                                                                                                                                                                                                                | Description                                                                                                                  | Used In                                  |                          |                            |                           |                        |                                          |          |                                                 |                                  |
| ------------------------ | -------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------- | ------------------------ | -------------------------- | ------------------------- | ---------------------- | ---------------------------------------- | -------- | ----------------------------------------------- | -------------------------------- |
| **MerchantInfo**         | Request  | <p>merchantId: string<br>terminalId: string<br>phoneNumber: string<br>businessName: string<br>merchantCategoryCode?: string                                                                                                                                                                                                                                                                               | null<br>city?: string                                                                                                        | null<br>state?: string                   | null<br>country?: string | null<br>firstName?: string | null<br>lastname?: string | null<br>email?: string | null<br>taxIdentificationNumber?: string | null</p> | Merchant details required to initialize the SDK | initialize(apiKey, merchantInfo) |
| **TransactionResult**    | Response | <p>paymentType?: string<br>status: string<br>payWithCardResult?: Transaction<br>error?: any</p>                                                                                                                                                                                                                                                                                                           | Result of a payment or refund operation                                                                                      | doSale, doPreAuth, refunds               |                          |                            |                           |                        |                                          |          |                                                 |                                  |
| **Transaction**          | Response | <p>type: string<br>amount: string<br>code: string<br>date: string<br>time: string<br>respCode: string<br>respDesc: string<br>rrn: string<br>authCode: string<br>stan: string<br>cardNumber: string<br>cardType: string<br>cardBrand: string<br>aid: string<br>isPinUsed: boolean<br>rfuList: Record\<string, any></p>                                                                                     | Detailed card transaction information                                                                                        | TransactionResult.payWithCardResult      |                          |                            |                           |                        |                                          |          |                                                 |                                  |
| **TransactionList**      | Response | <p>transactions: Array<br>empty?: boolean<br>first?: boolean<br>last?: boolean<br>number?: number<br>numberOfElements?: number<br>size?: number<br>totalElements?: number<br>totalPages?: number</p>                                                                                                                                                                                                      | Paginated list of transactions                                                                                               | getTransactionHistory                    |                          |                            |                           |                        |                                          |          |                                                 |                                  |
| **TransactionInfo**      | Response | <p>id: number<br>transactionCode: string<br>cardNumber: string<br>amount: number<br>currency: string<br>dateTime: string<br>status: string<br>modeOfTransaction: string</p>                                                                                                                                                                                                                               | Transaction summary information                                                                                              | TransactionList.transactions             |                          |                            |                           |                        |                                          |          |                                                 |                                  |
| **TransactionDetail**    | Response | <p>id?: number<br>status?: string<br>transactionAmount?: string<br>currency?: string<br>cardNumber?: string<br>transactionType?: string<br>modeOfTransaction?: string<br>transactionDescription?: string<br>responseDetail?: string<br>transactionCode?: string<br>transactionDateTime?: string<br>terminalId?: string<br>merchantCode?: string<br>rrn?: string<br>stan?: string<br>authCode?: string</p> | Detailed transaction information                                                                                             | getTransactionDetail                     |                          |                            |                           |                        |                                          |          |                                                 |                                  |
| **TransactionListQuery** | Request  | <p>page: number<br>size: number<br>direction?: ASC                                                                                                                                                                                                                                                                                                                                                        | DESC<br>transactionCode?: string<br>startDate?: string<br>endDate?: string<br>startAmount?: string<br>endAmount?: string</p> | Query parameters for transaction history | getTransactionHistory    |                            |                           |                        |                                          |          |                                                 |                                  |

{% hint style="info" %}
Network Security Configuration (Optional)

For development and testing purposes, integrators may optionally configure a `network-security-config` to allow cleartext traffic and network inspection tools.

Create and add the lines below to application tag in the Android manifest file.

```
android:networkSecurityConfig="@xml/network_security_config"
android:usesCleartextTraffic="true"
```

**This configuration is NOT required for production** and must be restricted to debug builds only.

Allowing cleartext traffic or user-installed certificates in production environments may violate security and PCI compliance requirements.
{% endhint %}

```xml
<?xml version="1.0" encoding="utf-8"?>
<network-security-config>

    <!-- Production: HTTPS only -->
    <base-config cleartextTrafficPermitted="false">
        <trust-anchors>
            <certificates src="system" />
        </trust-anchors>
    </base-config>

    <!-- Debug / Testing only -->
    <debug-config cleartextTrafficPermitted="true">
        <trust-anchors>
            <certificates src="system" />
            <certificates src="user" />
        </trust-anchors>
    </debug-config>

</network-security-config>

```

**Usage Example**

```javascript
import React from 'react';
import { Button } from 'react-native';
import { NativeModules } from 'react-native';
const { PayContactlessEmbedModule } = NativeModules;
const App = () => {
const handleSale = async () => {
try {
const result = await PayContactlessEmbedModule.doSale('10000', 'Test Sale', '566'); //NGN100 
console.log('Transaction Result:', result);
} catch (error) {
console.error('Transaction Failed:', error);
}
};
return ();
};export default App;
```
