> For the complete documentation index, see [llms.txt](https://docs.kkiapay.me/v1/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.kkiapay.me/v1/en-1.0.0/plugin-et-sdk/sdk-react-native.md).

# SDK React-Native

## Installation

```groovy
npx expo install react-native-webview
npm install @kkiapay-org/react-native-sdk
```

## Usage

1. Import KKiaPay provider to access all context's features

```groovy
// In your app file -- App
import { KkiapayProvider } from '@kkiapay-org/react-native-sdk';

import TestComponent from './TestComponent';

export default function App() {
  return (
    <KkiapayProvider>
      <TestComponent />
    </KkiapayProvider>
  );
}
```

2. Use the **useKkiapay** hook and get all available functions

```groovy
// In your component -- TestComponent
import { useKkiapay } from '@kkiapay-org/react-native-sdk';
import { useEffect } from 'react';
import { Button, View } from 'react-native';

export default function TestComponent() {
  const { openKkiapayWidget, addSuccessListener, addFailedListener } = useKkiapay();

  useEffect(() => {
    addSuccessListener(data => {
      console.log('data ', data);
    });
    
    addFailedListener(data => {
      console.log('data ', data);
    });
  }, []);

  const openWidget = () => {
    openKkiapayWidget({
      amount: 4000,
      api_key: "xxxxxxxxxxxxxxxxxx",
      sandbox: true,
      email: "randomgail@gmail.com",
      phone: "97000000",
    });
  };

  return (
    <View>
      <Button title="Pay now" onPress={openWidget} />
    </View>
  );
}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.kkiapay.me/v1/en-1.0.0/plugin-et-sdk/sdk-react-native.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
