> ## Documentation Index
> Fetch the complete documentation index at: https://www.cashfree.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# React Native Element Integration

> Integrate the Cashfree Payment Gateway Element SDK into your React Native app to accept payments via card, net banking, and UPI Intent.

The Cashfree Payment Gateway Element SDK lets you build a fully custom payment experience within your React Native application. Unlike the hosted checkout, you collect payment details directly in your own UI and pass them to the SDK, giving you complete control over the look and feel of your payment flow.

The SDK supports three Element payment methods: card (including saved card), net banking, and UPI Intent. It runs on both Android and iOS from a single integration.

<Note>
  This page describes the raw card flow, where your application collects the card number directly and is responsible for PCI DSS (Payment Card Industry Data Security Standard) compliance. To avoid handling raw card numbers, use the [React Native Custom Card Component](/docs/payments/online/element/custom-card/react-native-custom-card) instead, which captures the card number inside an SDK-managed input field.
</Note>

## Prerequisites

Complete the following tasks before you start the integration:

* Create a [Cashfree Merchant Account](https://merchant.cashfree.com/merchants/signup).
* Log in to the [Merchant Dashboard](https://merchant.cashfree.com/auth/login) and generate an **App ID** and **Secret Key**. Learn how to [generate API keys](/docs/api-reference/authentication#generate-api-keys).
* Use Cashfree React Native SDK version **2.4.0** or above. Get it from [npm](https://www.npmjs.com/package/react-native-cashfree-pg-sdk).
* Set your Android application's `minSdkVersion` to API level 19 or higher.
* Set your iOS minimum deployment target to 10.3 or higher.

The integration consists of three steps:

<CardGroup cols={3}>
  <Card title="Step 1" icon="money-bill-wave" href="/docs/payments/online/element/mobile/react-native#step-1-create-an-order-server-side">
    Create an order
  </Card>

  <Card title="Step 2" icon="desktop" href="/docs/payments/online/element/mobile/react-native#step-2-open-the-payment-page-client-side">
    Open the payment page
  </Card>

  <Card title="Step 3" icon="circle-check" href="/docs/payments/online/element/mobile/react-native#step-3-confirm-the-payment-server-side">
    Confirm the payment
  </Card>
</CardGroup>

## Step 1: Create an order <Badge color="green">Server-side</Badge>

Create an order from your backend server before you process any payment.

<Note>This API requires your secret key. Create orders through your server only. Do not call this API directly from your mobile application.</Note>

##### API request for creating an order

Here's a sample request for creating an order using your desired backend language. Cashfree offers backend [SDKs](/docs/api-reference/payments/sdk#payment-sdk) to simplify the integration process.

<CodeGroup>
  ```bash curl theme={"dark"}
  curl --location 'https://sandbox.cashfree.com/pg/orders' \
  --header 'X-Client-Secret: {{clientKey}}' \
  --header 'X-Client-Id: {{clientId}}' \
  --header 'x-api-version: 2025-01-01' \
  --header 'Content-Type: application/json' \
  --header 'Accept: application/json' \
  --data-raw '{
    "order_amount": 10.10,
    "order_currency": "INR",
    "customer_details": {
      "customer_id": "USER123",
      "customer_name": "joe",
      "customer_email": "joe.s@cashfree.com",
      "customer_phone": "+919876543210"
    },
    "order_meta": {
      "return_url": "https://b8af79f41056.eu.ngrok.io?order_id=order_123"
    }
  }'
  ```

  ```javascript nodejs theme={"dark"}
  import { Cashfree, CFEnvironment } from "cashfree-pg";

  const cashfree = new Cashfree(
  	CFEnvironment.PRODUCTION,
  	"{Client ID}",
  	"{Client Secret Key}"
  );

  function createOrder() {
  	var request = {
  		order_amount: "1",
  		order_currency: "INR",
  		customer_details: {
  			customer_id: "node_sdk_test",
  			customer_name: "",
  			customer_email: "example@gmail.com",
  			customer_phone: "9999999999",
  		},
  		order_meta: {
  			return_url:
  				"https://test.cashfree.com/pgappsdemos/return.php?order_id=order_123",
  		},
  		order_note: "",
  	};

  	cashfree
  		.PGCreateOrder(request)
  		.then((response) => {
  			console.log("Order created successfully:", response.data);
  		})
  		.catch((error) => {
  			console.error("Error setting up order request:", error.response.data);
  		});
  }
  ```

  ```python python theme={"dark"}
  from cashfree_pg.models.create_order_request import CreateOrderRequest
  from cashfree_pg.api_client import Cashfree
  from cashfree_pg.models.customer_details import CustomerDetails


  Cashfree.XClientId = {Client ID}
  Cashfree.XClientSecret = {Client Secret Key}
  Cashfree.XEnvironment = Cashfree.XSandbox
  x_api_version = "2023-08-01"

  def create_order():
          customerDetails = CustomerDetails(customer_id="123", customer_phone="9999999999")
          createOrderRequest = CreateOrderRequest(order_amount=1, order_currency="INR", customer_details=customerDetails)
          try:
              api_response = Cashfree().PGCreateOrder(x_api_version, createOrderRequest, None, None)
              print(api_response.data)
          except Exception as e:
              print(e)
  ```

  ```java java theme={"dark"}
  import com.cashfree.*;

  Cashfree.XClientId = {Client Key};
  Cashfree.XClientSecret = {Client Secret Key};
  Cashfree.XEnvironment = Cashfree.SANDBOX;

  static void createOrder() {
    CustomerDetails customerDetails = new CustomerDetails();
    customerDetails.setCustomerId("123");
    customerDetails.setCustomerPhone("9999999999");

    CreateOrderRequest request = new CreateOrderRequest();
    request.setOrderAmount(1.0);
    request.setOrderCurrency("INR");
    request.setCustomerDetails(customerDetails);
    try {
      Cashfree cashfree = new Cashfree();
      ApiResponse<OrderEntity> response = cashfree.PGCreateOrder("2023-08-01", request, null, null, null);
      System.out.println(response.getData().getOrderId());

    } catch (ApiException e) {
      throw new RuntimeException(e);
    }
  }
  ```

  ```go go theme={"dark"}
  import (
    cashfree "github.com/cashfree/cashfree-pg/v3"
  )

  func createOrder() {

  clientId := {Client ID}
  clientSecret := {Client Secret Key}
  cashfree.XClientId = &clientId
  cashfree.XClientSecret = &clientSecret
  cashfree.XEnvironment = cashfree.SANDBOX

  request := cashfree.CreateOrderRequest{
  		OrderAmount: 1,
  		CustomerDetails: cashfree.CustomerDetails{
  			CustomerId:    "1",
  			CustomerPhone: "9999999999",
  		},
  		OrderCurrency: "INR",
  		OrderSplits:   []cashfree.VendorSplit{},
  	}
  	version := "2023-08-01"
  	response, httpResponse, err := cashfree.PGCreateOrder(&version, &request, nil, nil, nil)
  	if err != nil {
  		fmt.Println(err.Error())
  	} else {
  		fmt.Println(httpResponse.StatusCode)
  		fmt.Println(response)
      }
  }
  ```

  ```csharp .net theme={"dark"}
  using cashfree_pg.Client;
  using cashfree_pg.Model;

  Cashfree.XClientId = {Client ID};
  Cashfree.XClientSecret = {Client Secret Key};
  Cashfree.XEnvironment = Cashfree.PRODUCTION;
  var cashfree = new Cashfree();
  var xApiVersion = "2023-08-01";

  void CreateOrder() {
      var customerDetails = new CustomerDetails("123", null, "9999999999");
      var createOrdersRequest = new CreateOrderRequest(null, 1.0, "INR", customerDetails);
      try {
          // Create Order
          var result = cashfree.PGCreateOrder(xApiVersion, createOrdersRequest, null, null, null);
          Console.WriteLine(result);
          Console.WriteLine(result.StatusCode);
          Console.WriteLine((result.Content as OrderEntity));
      } catch (ApiException e) {
          Console.WriteLine("Exception when calling PGCreateOrder: " + e.Message);
          Console.WriteLine("Status Code: " + e.ErrorCode);
          Console.WriteLine(e.StackTrace);
      }
  }
  ```

  ```php php theme={"dark"}
  \Cashfree\Cashfree::$XClientId = "<x-client-id>";
  \Cashfree\Cashfree::$XClientSecret = "<x-client-secret>";
  \Cashfree\Cashfree::$XEnvironment = Cashfree\Cashfree::$SANDBOX;

  $cashfree = new \Cashfree\Cashfree();

  $x_api_version = "2023-08-01";
  $create_orders_request = new \Cashfree\Model\CreateOrdersRequest();
  $create_orders_request->setOrderAmount(1.0);
  $create_orders_request->setOrderCurrency("INR");
  $customer_details = new \Cashfree\Model\CustomerDetails();
  $customer_details->setCustomerId("123");
  $customer_details->setCustomerPhone("9999999999");
  $create_orders_request->setCustomerDetails($customer_details);

  try {
      $result = $cashfree->PGCreateOrder($x_api_version, $create_orders_request);
      print_r($result);
  } catch (Exception $e) {
      echo 'Exception when calling PGCreateOrder: ', $e->getMessage(), PHP_EOL;
  }
  ```
</CodeGroup>

After successfully creating an order, you will receive a unique `order_id` and `payment_session_id` that you need for subsequent steps.

You can view the complete API request and response for `/orders` in the [Create Order API](/docs/api-reference/payments/latest/orders/create-order).

## Step 2: Open the payment page <Badge color="orange">Client-side</Badge>

After you create the order, open the payment page so the customer can provide payment details.

### 1. Set up the SDK

The React Native SDK is hosted on [npm](https://www.npmjs.com/). You can get the SDK [2.4.0](https://www.npmjs.com/package/react-native-cashfree-pg-sdk). The React Native SDK supports Android SDK version 19 and above and iOS minimum deployment target of 10.3 and above.

Install the SDK in your React Native project:

<CodeGroup>
  ```npm npm theme={"dark"}
  npm install react-native-cashfree-pg-sdk@2.4.0
  ```

  ```yarn yarn theme={"dark"}
  yarn add react-native-cashfree-pg-sdk@2.4.0
  ```

  ```expo expo theme={"dark"}
  npx expo install react-native-cashfree-pg-sdk
  npx expo install expo-dev-client
  npx expo prebuild
  npx expo run:android
  npx expo run:ios
  ```
</CodeGroup>

#### iOS configuration

To provide UPI payments on iOS, add the following to your application's `info.plist` file:

```xml theme={"dark"}
<key>LSApplicationQueriesSchemes</key>
<array>
  <string>amazonpay</string>
  <string>upi</string>
  <string>credpay</string>
  <string>bhim</string>
  <string>paytmmp</string>
  <string>phonepe</string>
  <string>tez</string>
  <string>navipay</string>
  <string>mobikwik</string>
  <string>myairtel</string>
  <string>popclubapp</string>
  <string>super</string>
  <string>kiwi</string>
  <string>simplypayupi</string>
  <string>whatsapp</string>
</array>
```

For iOS, run the following commands:

```bash theme={"dark"}
cd ios
pod install --repo-update
```

### 2. Select a payment method

The Element SDK supports the following payment methods:

<Tabs>
  <Tab title="Card">
    In this flow, the customer enters their card details directly in your application UI. Your application receives the raw card number and passes it to the SDK, so your application remains in PCI DSS scope for card data. To avoid handling raw card numbers, use the [React Native Custom Card Component](/docs/payments/online/element/custom-card/react-native-custom-card) instead. You can also charge a previously saved card by passing the saved card instrument ID and CVV.
  </Tab>

  <Tab title="Net banking">
    In this flow, you identify the customer's bank using a bank code. The SDK opens Cashfree's hosted net banking screen so the customer can log in and authorise the payment.
  </Tab>

  <Tab title="UPI Intent">
    In this flow, the SDK discovers the UPI apps installed on the customer's device and launches the selected app so the customer can authorise the payment.
  </Tab>
</Tabs>

### 3. Complete the payment

To complete the payment, follow these steps:

1. Set up the payment callback.
2. Create a `CFSession` object.
3. Create the payment object for the selected payment method.
4. Initiate the payment using `makePayment()`.

#### Set up the payment callback

The SDK exposes a `CFCallback` interface to receive callbacks from the SDK once the payment flow ends. The callback supports two methods:

```typescript theme={"dark"}
onVerify(orderID: string): void
onError(error: CFErrorResponse, orderID: string): void
```

<Tip>
  Set the callback in `componentDidMount` and remove it in `componentWillUnmount`. This configuration also handles activity restart cases and prevents memory leaks.
</Tip>

<Tip>Always call `setCallback` before calling `makePayment`.</Tip>

```typescript theme={"dark"}
import { Component } from 'react';
import {
  CFErrorResponse,
  CFPaymentGatewayService,
} from 'react-native-cashfree-pg-sdk';

export default class App extends Component {
  componentDidMount() {
    CFPaymentGatewayService.setCallback({
      onVerify(orderID: string): void {
        // Verify the order status from your backend.
      },
      onError(error: CFErrorResponse, orderID: string): void {
        console.log(JSON.stringify(error), orderID);
      },
    });
  }

  componentWillUnmount() {
    CFPaymentGatewayService.removeCallback();
  }
}
```

#### Create a session

The `CFSession` object holds the session context for the payment. It accepts the `payment_session_id` and `order_id` obtained from [Step 1](#step-1-create-an-order-server-side), and the Cashfree environment (`CFEnvironment.SANDBOX` or `CFEnvironment.PRODUCTION`).

```typescript theme={"dark"}
import {
  CFEnvironment,
  CFSession,
} from 'cashfree-pg-api-contract';

try {
  const session = new CFSession(
    '<PAYMENT_SESSION_ID>',
    '<ORDER_ID>',
    CFEnvironment.SANDBOX // or CFEnvironment.PRODUCTION
  );
} catch (e: any) {
  console.log(e.message);
}
```

#### Create a payment object

The SDK provides a dedicated payment class for each supported payment method. Build only the object that corresponds to the payment method your customer has selected.

Card objects can be of two types: `Card` for a new card payment, and `SavedCard` for a previously saved instrument.

| Object      | Fields                                                                                |
| ----------- | ------------------------------------------------------------------------------------- |
| `Card`      | `cardNumber`, `cardHolderName`, `cardExpiryMM`, `cardExpiryYY`, `cardCvv`, `saveCard` |
| `SavedCard` | `instrumentId`, `cardCvv`                                                             |

<Tabs>
  <Tab title="Card">
    Use the following code to create a card payment object. This is the raw card flow. Your application passes the full card number to the SDK.

    ```typescript theme={"dark"}
    import {
      Card,
      CFCardPayment,
      CFEnvironment,
      CFSession,
    } from 'cashfree-pg-api-contract';
    import { CFPaymentGatewayService } from 'react-native-cashfree-pg-sdk';

    async _startCardPayment() {
      try {
        const session = new CFSession(
          '<PAYMENT_SESSION_ID>',
          '<ORDER_ID>',
          CFEnvironment.SANDBOX
        );

        const card = new Card(
          '<CARD_NUMBER>',
          '<CARD_HOLDER_NAME>',
          '<CARD_EXPIRY_MM>',
          '<CARD_EXPIRY_YY>',
          '<CARD_CVV>',
          false // set true to save the card for future payments
        );

        const cardPayment = new CFCardPayment(session, card);
        CFPaymentGatewayService.makePayment(cardPayment);
      } catch (e: any) {
        console.log(e.message);
      }
    }
    ```
  </Tab>

  <Tab title="Saved card">
    Use `SavedCard` when the customer pays with a previously saved card instrument. Pass the saved card `instrumentId` and the card CVV.

    ```typescript theme={"dark"}
    import {
      CFCardPayment,
      CFEnvironment,
      CFSession,
      SavedCard,
    } from 'cashfree-pg-api-contract';
    import { CFPaymentGatewayService } from 'react-native-cashfree-pg-sdk';

    async _startSavedCardPayment() {
      try {
        const session = new CFSession(
          '<PAYMENT_SESSION_ID>',
          '<ORDER_ID>',
          CFEnvironment.SANDBOX
        );

        const card = new SavedCard(
          '<INSTRUMENT_ID>',
          '<CARD_CVV>'
        );

        const cardPayment = new CFCardPayment(session, card);
        CFPaymentGatewayService.makePayment(cardPayment);
      } catch (e: any) {
        console.log(e.message);
      }
    }
    ```
  </Tab>

  <Tab title="Net banking">
    The `CFNB` constructor accepts the bank code of the customer's bank.

    ```typescript theme={"dark"}
    import {
      CFEnvironment,
      CFNB,
      CFNBPayment,
      CFSession,
    } from 'cashfree-pg-api-contract';
    import { CFPaymentGatewayService } from 'react-native-cashfree-pg-sdk';

    async _makeNBPayment() {
      try {
        const session = new CFSession(
          '<PAYMENT_SESSION_ID>',
          '<ORDER_ID>',
          CFEnvironment.SANDBOX
        );

        const nb = new CFNB('<BANK_CODE>');
        CFPaymentGatewayService.makePayment(
          new CFNBPayment(session, nb)
        );
      } catch (e: any) {
        console.log(e.message);
      }
    }
    ```
  </Tab>

  <Tab title="UPI Intent">
    Use `getInstalledUpiApps()` to discover the UPI apps installed on the customer's device, then build a `CFUPI` object using the selected app identifier. On Android, pass the app package name. On iOS, pass the UPI app URI scheme (for example, `tez://`).

    ```typescript theme={"dark"}
    import {
      CFEnvironment,
      CFSession,
      CFUPI,
      CFUPIPayment,
      UPIMode,
    } from 'cashfree-pg-api-contract';
    import { CFPaymentGatewayService } from 'react-native-cashfree-pg-sdk';

    async _makeUpiIntentPayment() {
      try {
        const apps = await CFPaymentGatewayService.getInstalledUpiApps();
        let appId = '';
        JSON.parse(apps as string).forEach((item: any) => {
          appId = item.appPackage;
        });

        const session = new CFSession(
          '<PAYMENT_SESSION_ID>',
          '<ORDER_ID>',
          CFEnvironment.SANDBOX
        );

        const upi = new CFUPI(UPIMode.INTENT, appId);
        CFPaymentGatewayService.makePayment(
          new CFUPIPayment(session, upi)
        );
      } catch (e: any) {
        console.log(e.message);
      }
    }
    ```
  </Tab>
</Tabs>

#### Initiate the payment

Call `makePayment()` to open the Cashfree payment flow for the selected method. Pass the payment object you created in the previous step (`CFCardPayment`, `CFNBPayment`, or `CFUPIPayment`).

```typescript theme={"dark"}
CFPaymentGatewayService.makePayment(cardPayment);
// or: CFPaymentGatewayService.makePayment(nbPayment);
// or: CFPaymentGatewayService.makePayment(upiPayment);
```

<Note>
  `doCardPayment()` is deprecated. Use `makePayment()` for card, net banking, and UPI Element payments.
</Note>

#### Sample code

The following example shows a complete integration, including session creation, payment object setup for each method, and payment initiation.

<AccordionGroup>
  <Accordion title="Element checkout sample">
    ```typescript theme={"dark"}
    import { Component } from 'react';
    import {
      CFErrorResponse,
      CFPaymentGatewayService,
    } from 'react-native-cashfree-pg-sdk';
    import {
      Card,
      CFCardPayment,
      CFEnvironment,
      CFNB,
      CFNBPayment,
      CFSession,
      CFUPI,
      CFUPIPayment,
      SavedCard,
      UPIMode,
    } from 'cashfree-pg-api-contract';

    export default class App extends Component {
      componentDidMount() {
        CFPaymentGatewayService.setCallback({
          onVerify(orderID: string): void {
            // Verify the order status from your backend.
            console.log('orderId is :' + orderID);
          },
          onError(error: CFErrorResponse, orderID: string): void {
            console.log(
              'exception is : ' + JSON.stringify(error) + '\norderId is :' + orderID
            );
          },
        });
      }

      componentWillUnmount() {
        CFPaymentGatewayService.removeCallback();
      }

      getSession(): CFSession {
        return new CFSession(
          '<PAYMENT_SESSION_ID>',
          '<ORDER_ID>',
          CFEnvironment.SANDBOX
        );
      }

      async _startCardPayment() {
        try {
          const card = new Card(
            '<CARD_NUMBER>',
            '<CARD_HOLDER_NAME>',
            '<CARD_EXPIRY_MM>',
            '<CARD_EXPIRY_YY>',
            '<CARD_CVV>',
            false
          );
          CFPaymentGatewayService.makePayment(
            new CFCardPayment(this.getSession(), card)
          );
        } catch (e: any) {
          console.log(e.message);
        }
      }

      async _startSavedCardPayment() {
        try {
          const card = new SavedCard('<INSTRUMENT_ID>', '<CARD_CVV>');
          CFPaymentGatewayService.makePayment(
            new CFCardPayment(this.getSession(), card)
          );
        } catch (e: any) {
          console.log(e.message);
        }
      }

      async _makeNBPayment() {
        try {
          const nb = new CFNB('<BANK_CODE>');
          CFPaymentGatewayService.makePayment(
            new CFNBPayment(this.getSession(), nb)
          );
        } catch (e: any) {
          console.log(e.message);
        }
      }

      async _makeUpiIntentPayment() {
        try {
          const apps = await CFPaymentGatewayService.getInstalledUpiApps();
          let appId = '';
          JSON.parse(apps as string).forEach((item: any) => {
            appId = item.appPackage;
          });

          const upi = new CFUPI(UPIMode.INTENT, appId);
          CFPaymentGatewayService.makePayment(
            new CFUPIPayment(this.getSession(), upi)
          );
        } catch (e: any) {
          console.log(e.message);
        }
      }
    }
    ```
  </Accordion>
</AccordionGroup>

#### Sample GitHub code

You can explore a working integration example on GitHub:

[GitHub sample](https://github.com/cashfree/react-native-cashfree-pg-sdk/blob/d162bf61751e66eb848f3c612ce825d25c8a9941/example/App.tsx#L166)

[Sample UPI Test APK](/docs/payments/online/mobile/misc/cashfree_upi_simulator_apk#cashfree-upi-intent-simulator-apk)

## Step 3: Confirm the payment <Badge color="green">Server-side</Badge>

After the SDK delivers a callback via `onVerify`, confirm the payment status from your backend before taking any action. The SDK callback signals only that the payment flow has ended. It does not guarantee a successful payment.

To verify an order you can call our `/pg/orders` endpoint from your backend. You can also use our SDK to achieve the same.

<CodeGroup>
  ```bash curl theme={"dark"}
  curl --request GET \
       --url https://sandbox.cashfree.com/pg/orders/{order_id} \
       --header 'accept: application/json' \
       --header 'x-api-version: 2025-01-01' \
       --header 'x-client-id: "YOUR APP ID GOES HERE"' \
       --header 'x-client-secret: "YOUR SECRET KEY GOES HERE"'
  ```

  ```javascript nodejs theme={"dark"}
  cashfree
  .PGFetchOrder("<order_id>")
  .then((response) => {
  	console.log("Order fetched successfully:", response.data);
  })
  .catch((error) => {
  	console.error("Error:", error.response.data.message);
  });
  ```

  ```python python theme={"dark"}
  from cashfree_pg.models.create_order_request import CreateOrderRequest
  from cashfree_pg.api_client import Cashfree
  from cashfree_pg.models.customer_details import CustomerDetails
  from cashfree_pg.models.order_meta import OrderMeta

  Cashfree.XClientId = "<x-client-id>"
  Cashfree.XClientSecret = "<x-client-secret>"
  Cashfree.XEnvironment = Cashfree.SANDBOX
  x_api_version = "2023-08-01"

  try:
      api_response = Cashfree().PGFetchOrder(x_api_version, "order_3242X4jQ5f0S9KYxZO9mtDL1Kx2Y7u", None)
      print(api_response.data)
  except Exception as e:
      print(e)

  ```

  ```java java theme={"dark"}
  import com.cashfree.*;
  //other code

  try {
      Cashfree.XClientId = "<x-client-id>";
      Cashfree.XClientSecret = "<x-client-secret>";
      Cashfree.XEnvironment = Cashfree.SANDBOX;

      Cashfree cashfree = new Cashfree();
      String xApiVersion = "2023-08-01";

      ApiResponse<OrderEntity> responseFetchOrder = cashfree.PGFetchOrder(xApiVersion, "<order_id>", null, null, null);
      System.out.println(response.getData().getOrderId());
  } catch (ApiException e) {
      throw new RuntimeException(e);
  }
  ```

  ```go go theme={"dark"}
  version := "2023-08-01"
  response, httpResponse, err := cashfree.PGFetchOrder(&version, "<order_id>", nil, nil, nil)
  if err != nil {
  	fmt.Println(err.Error())
  } else {
  	fmt.Println(httpResponse.StatusCode)
  	fmt.Println(response)
  }
  ```

  ```csharp .net theme={"dark"}
  using cashfree_pg.Client;
  using cashfree_pg.Model;

  Cashfree.XClientId = "<x-client-id>";
  Cashfree.XClientSecret = "<x-client-secret>";
  Cashfree.XEnvironment = Cashfree.SANDBOX;
  var cashfree = new Cashfree();
  var xApiVersion = "2023-08-01";

  try {
      var result = cashfree.PGFetchOrder(xApiVersion, "<order_id>>", null, null);
      Console.WriteLine(result);
      Console.WriteLine(result.StatusCode);
      Console.WriteLine((result.Content as OrderEntity));
  } catch (ApiException e) {
      Console.WriteLine("Exception when calling PGFetchOrder: " + e.Message);
      Console.WriteLine("Status Code: " + e.ErrorCode);
      Console.WriteLine(e.StackTrace);
  }
  ```

  ```php php theme={"dark"}
  $x_api_version = "2023-08-01";
  try {
      $response = $cashfree->PGFetchOrder($x_api_version, "<order_id>");
      print_r($response);
  } catch (Exception $e) {
      echo 'Exception when calling PGFetchOrder: ', $e->getMessage(), PHP_EOL;
  }
  ```
</CodeGroup>

<Note>
  Always verify the order status from your backend before you deliver goods or services to the customer. You can use the [Get Order API](/docs/api-reference/payments/latest/orders/get-order) for this. An order is successful when the `order_status` is `PAID`.
</Note>

## Testing

After you integrate a payment method, verify that it behaves as expected. Follow these steps to test:

1. Trigger a payment using each method you have integrated.
2. Confirm that the SDK opens the correct payment screen for the method (Cashfree's hosted card or net banking screen, or the selected UPI app).
3. Confirm that `onVerify` or `onError` is called when the payment flow ends.

Use the [sandbox environment](/docs/payments/online/resources/sandbox-environment) to test payments before you go live.

## Error codes

To confirm the error returned in your React Native application, you can view the error codes exposed by the SDK.

<Accordion title="Show error codes">
  The following are some of the error codes that are exposed by the SDK:

  | Error code               | Message                                       |
  | ------------------------ | --------------------------------------------- |
  | `MISSING_CALLBACK`       | The callback is missing in the request.       |
  | `ORDER_ID_MISSING`       | The "order\_id" is missing in the request.    |
  | `SESSION_OBJECT_MISSING` | The "session" is missing in the request.      |
  | `PAYMENT_OBJECT_MISSING` | The "payment" is missing in the request.      |
  | `ENVIRONMENT_MISSING`    | The "environment" is missing in the request.  |
  | `ORDER_TOKEN_MISSING`    | The "order\_token" is missing in the request. |
</Accordion>

<div
  className="callout info"
  style={{
backgroundColor: 'light-dark(#f9f7fd, #2d1b4e)',
borderColor: 'light-dark(#cdbaef, #6930ca)',
color: 'light-dark(#000000, #ffffff)'
}}
>
  <p style={{fontSize: '1.3em', fontWeight: '500', marginBottom: '16px'}}>Affiliate partner program</p>

  <p>As a developer building payment experiences for your clients, you can earn additional income while providing them with industry-leading payment solutions.</p>

  <p>Join the <a href="https://partner.cashfree.com/partner-ui/authentication/signup?source-action=Affiliate%20Program%20LP&action=Sign%20Up&button-id=StartNow_CashfreeAffiliatePartnerProgram">Cashfree affiliate partner program</a> and get rewarded every time your clients use Cashfree.</p>

  <p>**What you get:**</p>

  <ul>
    <li>Earn up to 0.25% commission on every transaction.</li>
    <li>Become a trusted fintech partner for your clients.</li>
    <li>Access to a dedicated partner manager for expert support.</li>
  </ul>

  <p>**What your clients get:**</p>

  <ul>
    <li>Instant activation and go live in minutes.</li>
    <li>Industry-best success rate across all payment modes.</li>
    <li>Effortless acceptance of international payments in 140+ currencies.</li>
  </ul>

  <p>Get started today. <a href="https://partner.cashfree.com/partner-ui/authentication/signup?source-action=Affiliate%20Program%20LP&action=Sign%20Up&button-id=StartNow_BecomeAPartner">Become a partner now</a>.</p>
</div>

<div class="hidden" data-table-of-contents="bottom">
  <p class="mt-4 font-medium flex items-center gap-2 related-docs-heading">
    <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" class="w-4 h-4">
      <path d="M3 4h7a2 2 0 0 1 2 2v13a2 2 0 0 0-2-2H3z" />

      <path d="M21 4h-7a2 2 0 0 0-2 2v13a2 2 0 0 1 2-2h7z" />
    </svg>

    <span>Related topics</span>
  </p>

  <ul>
    <li><a href="/docs/docs/api-reference/payments/latest/orders/create-order">Create Order API</a></li>
    <li><a href="/docs/docs/api-reference/payments/latest/orders/get-order">Get Order API</a></li>
    <li><a href="/docs/docs/payments/online/element/custom-card/react-native-custom-card">React Native Custom Card Component</a></li>
    <li><a href="/docs/docs/payments/online/element/overview">Element Overview</a></li>
    <li><a href="https://github.com/cashfree/react-native-cashfree-pg-sdk" target="_blank">React Native SDK on GitHub</a></li>
  </ul>
</div>
