> ## Documentation Index
> Fetch the complete documentation index at: https://razorpay-881012b3.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Additional Support For Payment Methods

> Additional support features available for card, netbanking, EMI and more.

<div style={{display:"flex",flexWrap:"wrap",alignItems:"center",gap:"0.35rem 0.9rem",border:"1px solid rgba(128,128,128,0.28)",borderRadius:"0.5rem",padding:"0.45rem 0.75rem",margin:"0 0 1.25rem",fontSize:"0.875rem"}}>
  <span style={{fontWeight:600}}>Available in</span>
  <span>🇮🇳 India</span>
</div>

The Razorpay iOS Custom SDK lets you integrate the supported payment methods on your iOS app's Checkout form.

## Fetch Payment Methods

Use the [Fetch Payment Methods API](/docs/payments/payment-gateway/android-integration/custom/build-integration#1-4-fetch-payment-methods) to fetch the payment methods available for your account.

Below are the sample payloads for each payment method.

## Debit and Credit Card

Add the following code where you want to initiate a card payment:

<CodeGroup>
  ```swift ViewController.swift theme={null}
  let options: [String: Any] = [
      "amount": 100, // amount in currency subunits. Defaults to INR. 100 = 100 paise = INR 1.
      "currency": "INR", // We support international currencies.
      "email": "gaurav.kumar@example.com",
      "contact": "9000090000",
      "order_id": "order_DBJOWzybf0sJbb",
      "method": "card",
      "card[name]": "Gaurav Kumar",
      "card[number]": "4386289407660153",
      "card[expiry_month]": 06,
      "card[expiry_year]": 30,
      "card[cvv]": "123"
  ]
  razorpay.authorize(options)
  ```

  ```objectivec ViewController.m theme={null}
  NSDictionary *options = @{
      @"amount": @"100", // amount in currency subunits. Defaults to INR. 100 = 100 paise = INR 1.
      @"currency": @"INR", // We support international currencies.
      @"email": @"gaurav.kumar@example.com",
      @"contact": @"9000090000",
      @"order_id": @"order_4xbQrmEoA5WJ0G",
      @"method": @"card",
      @"card[name]": @"Gaurav Kumar",
      @"card[number]": @"4386289407660153",
      @"card[expiry_month]": @"06",
      @"card[expiry_year]": @"30",
      @"card[cvv]": @"123"
  };

  [_razorpay authorize: options];
  ```
</CodeGroup>

Check the [list of supported cards](/docs/payments/payment-gateway/web-integration/standard/configure-payment-methods/supported-methods#supported-cards).

## Bank Transfer

This payment method allows you to display your Customer Identifier details on checkout. Your customers can make online bank transfers to this account.

<Info>
  **Feature Request**

  This is an on-demand feature. Please raise a request with our [Support team](https://razorpay.com/support/#request) to get this feature activated on your Razorpay account.
</Info>

There are no specific request parameters to be passed. Instead, you must pass the `fetchVirtualAccount` method for your Customer Identifier to get created and the details to appear on the checkout. Know more about [integrating bank transfer with Custom Checkout](/docs/payments/payment-methods/bank-transfer/custom-integration).

## EMI on Debit and Credit Cards

Add the following code where you want to initiate an EMI payment:

<CodeGroup>
  ```swift ViewController.swift theme={null}
  let options: [String: Any] = [
      "amount": 100, // amount in currency subunits. Defaults to INR. 100 = 100 paise = INR 1.
      "currency": "INR",
      "email": "gaurav.kumar@example.com",
      "contact": "9000090000",
      "order_id": "order_DBJOWzybf0sJbb",
      "method": "emi",
      "emi_duration": 9,
      "card[name]": "Gaurav Kumar",
      "card[number]": "4386289407660153",
      "card[expiry_month]": 06,
      "card[expiry_year]": 30,
      "card[cvv]": "123"
  ]
  razorpay.authorize(options)
  ```

  ```objectivec ViewController.m theme={null}
  NSDictionary *options = @{
      @"amount": @"100", // amount in currency subunits. Defaults to INR. 100 = 100 paise = INR 1.
      @"currency": @"INR",
      @"email": @"gaurav.kumar@example.com",
      @"contact": @"9000090000",
      @"order_id": @"order_4xbQrmEoA5WJ0G",
      @"method": @"emi",
      @"emi_duration": @"9",
      @"card[name]": @"Gaurav Kumar",
      @"card[number]": @"4386289407660153",
      @"card[expiry_month]": @"06",
      @"card[expiry_year]": @"30",
      @"card[cvv]": @"123"
  };

  [_razorpay authorize: options];
  ```
</CodeGroup>

Check the list of supported [debit card](/docs/payments/payment-methods/emi/debit-card-emi#supported-banks-for-debit-card-emis) and [credit card](/docs/payments/payment-methods/emi/credit-card-emi#supported-banks-for-credit-card-emis) EMI providers.

## Cardless EMI

Add the following code where you want to initiate a cardless EMI payment:

<CodeGroup>
  ```swift ViewController.swift theme={null}
  let options: [String: Any] = [
      "amount": 100, // amount in currency subunits. Defaults to INR. 100 = 100 paise = INR 1.
      "currency": "INR",
      "email": "gaurav.kumar@example.com",
      "contact": "9000090000",
      "order_id": "order_DBJOWzybf0sJbb",
      "method": "cardless_emi",
      "provider": "earlysalary"
  ]
  razorpay.authorize(options)
  ```

  ```objectivec ViewController.m theme={null}
  NSDictionary *options = @{
      @"amount": @"100", // amount in currency subunits. Defaults to INR. 100 = 100 paise = INR 1.
      @"currency": @"INR",
      @"email": @"gaurav.kumar@example.com",
      @"contact": @"9000090000",
      @"order_id": @"order_4xbQrmEoA5WJ0G",
      @"method": @"cardless_emi",
      @"provider": @"earlysalary"
  };

  [_razorpay authorize: options];
  ```
</CodeGroup>

Check the [list of supported cardless EMI providers](/docs/payments/payment-methods/emi/cardless-emi#supported-payment-partners).

## Netbanking

Add the following code where you want to initiate a netbanking payment:

<CodeGroup>
  ```swift ViewController.swift theme={null}
  let options: [String: Any] = [
      "amount": 100, // amount in currency subunits. Defaults to INR. 100 = 100 paise = INR 1.
      "currency": "INR", // We support international currencies.
      "email": "gaurav.kumar@example.com",
      "contact": "9000090000",
      "order_id": "order_DBJOWzybf0sJbb",
      "method": "netbanking",
      "bank": "HDFC"
  ]
  razorpay.authorize(options)
  ```

  ```objectivec ViewController.m theme={null}
  NSDictionary *options = @{
      @"amount": @"100", // amount in currency subunits. Defaults to INR. 100 = 100 paise = INR 1.
      @"currency": @"INR", // We support international currencies.
      @"email": @"gaurav.kumar@example.com",
      @"contact": @"9000090000",
      @"order_id": @"order_4xbQrmEoA5WJ0G",
      @"method": @"netbanking",
      @"bank": @"HDFC"
  };

  [_razorpay authorize: options];
  ```
</CodeGroup>

Check the [list of supported banks](/docs/payments/payment-methods/netbanking).

## Pay Later

Add the following code where you want to initiate a Pay Later payment:

<CodeGroup>
  ```swift ViewController.swift theme={null}
  let options: [String: Any] = [
      "amount": 100, // amount in currency subunits. Defaults to INR. 100 = 100 paise = INR 1.
      "currency": "INR",
      "email": "gaurav.kumar@example.com",
      "contact": "9000090000",
      "order_id": "order_DBJOWzybf0sJbb", // From response of Step 3
      "method": "paylater",
      "provider": "icic"
  ]
  razorpay.authorize(options)
  ```

  ```objectivec ViewController.m theme={null}
  NSDictionary *options = @{
      @"amount": @"100", // amount in currency subunits. Defaults to INR. 100 = 100 paise = INR 1.
      @"currency": @"INR",
      @"email": @"gaurav.kumar@example.com",
      @"contact": @"9000090000",
      @"order_id": @"order_4xbQrmEoA5WJ0G",
      @"method": @"paylater",
      @"provider": @"icic"
  };

  [_razorpay authorize: options];
  ```
</CodeGroup>

Check the [list of Pay Later providers](/docs/payments/payment-methods/pay-later/custom-integration#providers).

## Wallet

Add the following code where you want to initiate a wallet payment:

<CodeGroup>
  ```swift ViewController.swift theme={null}
  let options = [
      "amount": "100",
      "currency": "INR",
      "email": "gaurav.kumar@example.com",
      "order_id": "order_4xbQrmEoA5WJ0G",
      "contact": "9000090000",
      "method": "wallet",
      "wallet": "mobikwik",
     ]
  razorpay.authorize(options)
  ```

  ```objectivec ViewController.m theme={null}
  NSDictionary *options = @{
      @"amount": @"100",
      @"currency": @"INR",
      @"email": @"gaurav.kumar@example.com",
      @"contact": @"9000090000",
      @"order_id": @"order_4xbQrmEoA5WJ0G",
      @"method": @"wallet",
      @"wallet": @"mobikwik"
  };

  [_razorpay authorize: options];
  ```
</CodeGroup>

## UPI

Specify `upi` the `method` parameter for UPI payments. The SDK supports two flows:

* Collect
* Intent

#### Collect Flow

Customers enter their `vpa` or [phone number](#upi-payments-using-phone-number) on your UI and complete the payments on their respective UPI apps in collect flow.

You can now pass the `vpa` parameter in the `upi` array as shown below.

<Warning>
  **UPI Collect Flow Deprecated**

  According to NPCI guidelines, the UPI Collect flow is being deprecated effective 28 February 2026. Customers can no longer make payments or register UPI mandates by manually entering VPA/UPI id/mobile numbers.

  **Exemptions:** UPI Collect will continue to be supported for:

  * MCC 6012 & 6211 (IPO and secondary market transactions).
  * iOS mobile app and mobile web transactions.
  * UPI Mandates (execute/modify/revoke operations only)
  * eRupi vouchers.
  * PACB businesses (cross-border/international payments).

  **Action Required:**

  * If you are a new Razorpay user, use [UPI Intent](/docs/payments/payment-gateway/web-integration/custom/payment-methods#intent-flow).
  * If you are an existing Razorpay user not covered by exemptions, you must migrate to UPI Intent or UPI QR code to continue accepting UPI payments. For detailed migration steps, refer to the [migration documentation](/docs/announcements/upi-collect-migration/custom-integration).
</Warning>

#### Sample Code

The sample code below sends a collect request to the `gaurav.kumar@exampleupi` handle:

<CodeGroup>
  ```swift ViewController.swift theme={null}
  let options: [String: Any] = [
      "amount": 100, // amount in currency subunits. Defaults to INR. 100 = 100 paise = INR 1.
      "currency": "INR",
      "email": "gaurav.kumar@example.com",
      "contact": "9000090000",
      "order_id": "order_DBJOWzybf0sJbb",
      "method": "upi",
      "_[flow]": "collect",
      "vpa": "gaurav.kumar@exampleupi"
  ]
  razorpay.authorize(options)
  ```

  ```objectivec ViewController.m theme={null}
  NSDictionary *options = @{
      @"amount": @"100", // amount in currency subunits. Defaults to INR. 100 = 100 paise = INR 1.
      @"currency": @"INR",
      @"email": @"gaurav.kumar@example.com",
      @"contact": @"9000090000",
      @"order_id": @"order_4xbQrmEoA5WJ0G",
      @"method": @"upi",
      @"_[flow]": @"collect",
      @"vpa": @"gaurav.kumar@exampleupi"
  };

  [_razorpay authorize: options];
  ```
</CodeGroup>

<AccordionGroup>
  <Accordion title="UPI Payments Using Phone Number">
    You can accept UPI payments using phone number for the collect flow. Follow the steps given below:

    1. You must collect the customer's phone number from your end.
    2. Check if any `vpa` is associated with the given number and get the `vpa_token` for that number using the sample code given below:

    <CodeGroup>
      ```swift ViewController.swift theme={null}
      self.razorpay?.isValidVpa("9000090000", withSuccessCallback: { response in
          // VPA Validation Successful
          // get and store response.vpa_token for initiating payment
          // you will get response.masked_vpa in this response which you can show to the end user
      }, withFailure: { responseError in
          print(responseError)
          // Error: no VPA associated with the given number
      })
      ```

      ```objectivec ViewController.m theme={null}
      [razorpay isValidVpa:@"9000090000" withSuccessCallback:^(NSDictionary * _Nonnull success) {
          // VPA Validation Successful
          // get and store response.vpa_token for initiating payment
          // you will get response.masked_vpa in this response which you can show to the end
      } withFailure:^(NSDictionary * _Nonnull error) {
          NSLog(@"%@", error.description);
          // Error: no VPA associated with the given number
      }];
      ```
    </CodeGroup>

    3. Pass the `vpa_token` parameter in the `upi` array as shown below:

    <CodeGroup>
      ```swift ViewController.swift theme={null}
      let options: [String: Any] = [
          "amount": 5000, 
          "currency": "INR",
          "email": "gaurav.kumar@example.com",
          "contact": "9000090000",
          "order_id": "order_DBJOWzybf0XXXX",
          "method": "upi",
          "_[flow]": "collect",
          "vpa_token": "f731951149df8903d374b117f921ab41"
      ]
      razorpay.authorize(options)
      ```

      ```objectivec ViewController.m theme={null}
      NSDictionary *options = @{
          @"amount": @"5000",
          @"currency": @"INR",
          @"email": @"gaurav.kumar@example.com",
          @"contact": @"9000090000",
          @"order_id": @"order_4xbQrmEoA5XXXX",
          @"method": @"upi",
          @"_[flow]": @"collect",
          @"vpa_token": @"f731951149df8903d374b117f921ab41"
      };
      [_razorpay authorize: options];
      ```
    </CodeGroup>
  </Accordion>
</AccordionGroup>

#### Intent Flow

Provide your customers with a better payment experience by enabling UPI Intent on your app's Checkout form. In the UPI Intent flow:

1. You have to fetch the list of UPI supported apps and show it in your app so that the customer can see only valid apps.
2. After the customer selects the app, you have to pass the app name in `options`, with the key `upi_app_package_name` value. Possible values for `upi_app_package_name` are:
   * `google_pay`
   * `phonepe`
   * `paytm`
   * `cred`
3. The customer enters their UPI PIN to complete the transaction.
4. The customer returns to your app manually without redirection.

#### Step 1: Update the info.plist File

Your iOS app must seek permission from the device to open the UPI PSP app that the customer selects on the Checkout. For this, you must make the following changes to your iOS app's info.plist file:

```xml info.plist theme={null}
<key>LSApplicationQueriesSchemes</key>
<array>
    <string>tez</string>
    <string>phonepe</string>
    <string>paytmmp</string>
    <string>credpay</string>
    <string>mobikwik</string>
    <string>in.fampay.app</string>
    <string>bhim</string>
    <string>amazonpay</string>
    <string>navi</string>
    <string>kiwi</string>
    <string>payzapp</string>
    <string>jupiter</string>
    <string>omnicard</string>
    <string>icici</string>
    <string>popclubapp</string>
    <string>sbiyono</string>
    <string>myjio</string>
    <string>slice-upi</string>
    <string>bobupi</string>
    <string>shriramone</string>
    <string>indusmobile</string>
    <string>whatsapp</string>
    <string>kotakbank</string>
</array>
```

#### Step 2: Get a List of UPI Supported Apps

This sample code fetches the list of apps on the customer's device that support UPI payments.

<CodeGroup>
  ```swift ViewController.swift theme={null}
  RazorpayCheckout.getAppsWhichSupportUpi { (upiApps) in
      print(upiApps)
  }
  ```

  ```objectivec ViewController.m theme={null}
  [RazorpayCheckout getAppsWhichSupportUpiWithHandler:^(NSArray<NSString *> * upiApps) {
      NSLog(@"%@", upiApps);
  }];
  ```
</CodeGroup>

The sample code below invokes the UPI intent where the user can select the desired application.

Ensure that the `upi_app_package_name` is passed from the `getAppsWhichSupportUpi()` method value. Otherwise, it will not pass the validation.

<CodeGroup>
  ```swift ViewController.swift theme={null}
  let options: [String: Any] = [
      "amount": 100, // amount in currency subunits. Defaults to INR. 100 = 100 paise = INR 1.
      "currency": "INR",
      "email": "gaurav.kumar@example.com",
      "contact": "9000090000",
      "order_id": "order_DBJOWzybf0sJbb",
      "method": "upi",
      "_[flow]": "intent",
      "upi_app_package_name": "google_pay"
  ]
  razorpay?.authorize(options)
  ```

  ```objectivec ViewController.m theme={null}
  NSDictionary *options = @{
      @"amount": @"100", // amount in currency subunits. Defaults to INR. 100 = 100 paise = INR 1.
      @"currency": @"INR",
      @"email": @"gaurav.kumar@example.com",
      @"contact": @"9000090000",
      @"order_id": @"order_4xbQrmEoA5WJ0G",
      @"method": @"upi",
      @"_[flow]": @"intent",
      @"upi_app_package_name": @"google_pay",
  };

  [_razorpay authorize: options];
  ```
</CodeGroup>

#### UPI Intent on Recurring Payments

Configure and initiate a recurring payment transaction on UPI Intent:

<CodeGroup>
  ```swift ViewController.swift theme={null}
  let options: [String:Any] = [
      "key": "YOUR_KEY_ID",   
      "order_id": "order_DBJOWzybfXXXX", 
      "customer_id": "cust_BtQNqzmBlXXXX",
      "contact": "9000000000",
      "amount": 10000, // Amount should match the order amount 
      "email": "gaurav.kumar@example.com",
      "currency": "INR",
      "recurring": 1, // This key value pair is mandatory for Intent Recurring Payment.
      "upi_app_package_name": "<psp-app>",
      "method": "upi",
      "_[flow]": "intent"
  ]
  ```

  ```objectivec ViewController.m theme={null}
  NSDictionary *options = @{
      @"key": @"YOUR_KEY_ID",
      @"order_id": @"order_DBJOWzybfXXXX",
      @"customer_id": @"cust_BtQNqzmBlXXXX",
      @"contact": @"9000090000",
      @"amount": @(10000), // Amount should match the order amount 
      @"email": @"gaurav.kumar@example.com",
      @"currency": @"INR",
      @"recurring": @(1), // This key value pair is mandatory for Intent Recurring Payment.
      @"upi_app_package_name": @"<psp-app>",
      @"method": @"upi",
      @"_[flow]": @"intent"
  };
  ```
</CodeGroup>

#### Turbo UPI

Make UPI payments a faster, 2-step experience for your customers with Razorpay's Turbo UPI SDK.

1. [Turbo UPI Headless Integration](/docs/payments/payment-gateway/ios-integration/custom/payment-methods/turbo-upi/integrate-ui)
2. [Turbo UPI UI Integration](/docs/payments/payment-gateway/ios-integration/custom/payment-methods/turbo-upi/integrate-noui)

Know more about the [Customer Onboarding](/docs/payments/payment-gateway/ios-integration/custom/payment-methods/turbo-upi#customer-onboarding-flow) and [Integration Steps](/docs/payments/payment-gateway/ios-integration/custom/payment-methods/turbo-upi#next-steps).

## CRED

<Warning>
  **UPI Collect Flow Deprecated**

  According to NPCI guidelines, the UPI Collect flow is being deprecated effective 28 February 2026. Customers can no longer make payments or register UPI mandates by manually entering VPA/UPI id/mobile numbers.

  **Exemptions:** UPI Collect will continue to be supported for:

  * MCC 6012 & 6211 (IPO and secondary market transactions).
  * iOS mobile app and mobile web transactions.
  * UPI Mandates (execute/modify/revoke operations only)
  * eRupi vouchers.
  * PACB businesses (cross-border/international payments).

  **Action Required:**

  * If you are a new Razorpay user, use [UPI Intent](/docs/payments/payment-gateway/web-integration/custom/payment-methods#intent-flow).
  * If you are an existing Razorpay user not covered by exemptions, you must migrate to UPI Intent or UPI QR code to continue accepting UPI payments. For detailed migration steps, refer to the [migration documentation](/docs/announcements/upi-collect-migration/custom-integration).
</Warning>

Customers can make payments on your iOS app using their CRED Coins as well as the credit cards saved on CRED. The SDK supports two flows:

1. [Collect](#collect-flow-1)
2. [Intent](#intent-flow-1)

<Warning>
  **Handy Tips**

  Ensure you have integrated with Razorpay iOS SDK version 1.3.5 or higher.
</Warning>

#### Prerequisites

For both collect and intent flow, you need to pass the `app_offer` parameter in the Orders API.

`POST /orders`

<CodeGroup>
  ```bash Curl theme={null}
  curl -u [YOUR_KEY_ID]:[YOUR_KEY_SECRET] \
  -X POST https://api.razorpay.com/v1/orders \
  -H "content-type: application/json" \
  -d '{
    "amount": 1000,
    "currency": "INR",
    "receipt": "receipt#1",
    "app_offer": true
  }'
  ```

  ```python Python theme={null}
  import razorpay
  client = razorpay.Client(auth=("YOUR_ID", "YOUR_SECRET"))

  client.order.create({
    "amount": 1000,
    "currency": "INR",
    "receipt": "receipt#1",
    "app_offer": true
   })
  ```

  ```php PHP theme={null}
  $api = new Api($key_id, $secret);

  $api->order->create(array('receipt' => 'receipt#1', 'amount' => 1000, 'currency' => 'INR', 'app_offer'=> true));
  ```

  ```csharp .NET theme={null}
  RazorpayClient client = new RazorpayClient("[YOUR_KEY_ID]", "[YOUR_KEY_SECRET]");

  Dictionary<string, object> options = new Dictionary<string,object>();
  options.Add("amount", 1000); // amount in the smallest currency unit
  options.Add("receipt", "receipt#1");
  options.Add("currency", "INR");
  options.Add("app_offer", true);
  Order order = client.Order.Create(options);
  ```

  ```javascript Node.js theme={null}
  var instance = new Razorpay({ key_id: 'YOUR_KEY_ID', key_secret: 'YOUR_SECRET' })

  instance.orders.create({
    amount: 1000,
    currency: "INR",
    receipt: "receipt#1",
    app_offer: true
  })
  ```

  ```go go theme={null}
  import ( razorpay "github.com/razorpay/razorpay-go" )
  client := razorpay.NewClient("YOUR_KEY_ID", "YOUR_SECRET")

  data := map[string]interface{}{
    "amount": 1000,
    "currency": "INR",
    "receipt": "receipt#1",
    "app_offer": true
  }
  body, err := client.Order.Create(data, nil)
  ```

  ```ruby Ruby theme={null}
  require "razorpay"
  Razorpay.setup('YOUR_KEY_ID', 'YOUR_SECRET')

  order = Razorpay::Order.create amount: 1000, currency: 'INR', receipt: 'receipt#1', app_offer: 1
  ```

  ```java Java theme={null}
  RazorpayClient razorpay = new RazorpayClient("[YOUR_KEY_ID]", "[YOUR_KEY_SECRET]");

  JSONObject orderRequest = new JSONObject();
  orderRequest.put("amount", 1000); // amount in the smallest currency unit
  orderRequest.put("currency", "INR");
  orderRequest.put("receipt", "receipt#1");
  orderRequest.put("app_offer", true);

  Order order = razorpay.orders.create(orderRequest);
  ```

  ```json Response theme={null}
  {
    "id": "order_FNPoKwCtPyhJOt",
    "entity": "order",
    "amount": 1000,
    "amount_paid": 0,
    "amount_due": 1000,
    "currency": "INR",
    "receipt": null,
    "status": "created",
    "attempts": 0,
    "notes": [],
    "created_at": 1596703420
  }
  ```
</CodeGroup>

#### Request Parameters

`amount` *mandatory*
: `integer` The transaction amount, expressed in the currency subunit, such as paise (in case of INR). For example, for an actual amount of ₹299.35, the value of this field should be `29935`.

`currency`  *mandatory*
: `string` The currency in which the transaction should be made. See the [list of supported currencies](/docs/payments/international-payments#supported-currencies). Default is `INR`.

`app_offer` *optional*
: `boolean` Allow/do not allow customers to use CRED coins to make payments. This is used to prevent double discounting scenarios where customers have already availed discounts using voucher/coupon, and you do not want them to redeem Coins as well. Possible values:

* `true`: Customer not allowed to use CRED coins to make payment.
* `false` (default): Customer can use CRED coins to make payment.

`receipt` *optional*
: `string` Your receipt id for this order should be passed here. Maximum length is 40 characters.<br />

`notes` *optional*
: `object` Key-value pair that can be used to store additional information about the entity. Maximum 15 key-value pairs, 256 characters (maximum) each. For example, `"note_key": "Beam me up Scotty”`.

#### Collect Flow

In the Collect Flow, the SDK sends a push notification to the `contact` number passed in the create request. To initiate collect flow, send `app_present` the parameter as `0` while creating the payment.

<CodeGroup>
  ```swift ViewController.swift theme={null}
  let options: [String: Any] = [
    "amount": 100,
    "currency": "INR",
    "contact": "9000090000",
    "order_id": "order_FNPoKwCtPyhJOt",
    "email": "gaurav.kumar@example.com",
    "method": "app",
    "provider": "cred",
    "app_present": 0
  ]
  razorpay?.authorize(options)
  ```

  ```objectivec ViewController.m theme={null}
  NSDictionary *options = @{
    "amount": @"100", // amount in currency subunits. Defaults to INR. 100 = 100 paise = INR 1.
    "currency": @"INR",
    "email": @"gaurav.kumar@example.com",
    "contact": @"9000090000",
    "order_id": @"order_4xbQrmEoA5WJ0G",
    "method": @"app",
    "provider": @"cred",
    "app_present": @NO,
  };
  [_razorpay payWithCred: options];
  ```
</CodeGroup>

#### Request Parameters

Along with the other payment creation request parameters, you must pass:

`method` *mandatory*
: `string` The method used to make the payment. Here, it must be `app`.

`provider` *mandatory if method=app*
: `string` Name of the PSP app. Here, it must be `cred`.

`app_present` *mandatory if app=cred*
: `integer` Sets the payment flow as collect. Possible values:

* `1`: Opens the CRED app on the customer's device.
* `0` (default): Sends a push notification to the customer's device.

#### Intent Flow

In Intent Flow, the SDK invokes an intent, which is handled by the Cred app installed on the iOS device. Follow these steps:

#### Step 1: Update the info.plist File

You must make the following changes to your iOS app's info.plist file:

```xml info.plist theme={null}
<key>LSApplicationQueriesSchemes</key>
<array>
    <string>credpay</string>
</array>
```

#### Step 2: Detect CRED App in Customer's Mobile

* Check if the CRED app is present on the customer's mobile using the `isCredAppAvailable()` method.

<CodeGroup>
  ```swift ViewController.swift theme={null}
  /// This checks if the app is available on the device or not.
  private func isCredAppAvailable() -> Int {
      let credURIScheme = "credpay://" // This will open the CRED URL.
      if let urlString = credURIScheme.addingPercentEncoding(withAllowedCharacters: NSCharacterSet.urlQueryAllowed) {
          if let credURL = URL(string: urlString) {
              if UIApplication.shared.canOpenURL(credURL) {
                  return 1
              }
          }
      }
      return 0
  }
  ```

  ```objectivec ViewController.m theme={null}
  - (int)isCredAppAvailable {
      NSString *credURIScheme = [NSString stringWithFormat:@"credpay://"];
      NSString *urlString = [credURIScheme stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLHostAllowedCharacterSet]];
      NSURL *url = [NSURL URLWithString:urlString];
      if ([[UIApplication sharedApplication] canOpenURL:url]) {
          return 1;
      } else {
          return 0;
      }
  }
  ```
</CodeGroup>

* CRED app listens to the URI Schema.

```xml theme={null}
credpay://
```

This can be passed in the `uriSchema` parameter in the above function. `isCredAppAvailable()` returns a boolean value informing whether the app is present on the device or not.

<CodeGroup>
  ```swift ViewController.swift theme={null}
  if (isCredAppAvailable()) {
      payWithCredBtn.setText("CRED Pay (Intent Flow)");
  } else {
      payWithCredBtn.setText("CRED Pay (Collect Flow)");
  }
  ```

  ```objectivec ViewController.m theme={null}
  if ([self isCredAppAvailable]) {
      [_payButton setTitle:@"Pay With Cred (Intent Flow)" forState:UIControlStateNormal];
  } else {
      [_payButton setTitle:@"Pay With Cred (Collect Flow)" forState:UIControlStateNormal];
  }
  ```
</CodeGroup>

* If the CRED app is installed, pass the `callback_url` parameter in the payload:

<CodeGroup>
  ```swift ViewController.swift theme={null}
  options["callback_url"] = "<MerchantApp URI-Scheme>://"
  ```

  ```objectivec ViewController.m theme={null}
  [dict setObject:@"<MerchantApp URI-Scheme>://" forKey:@"callback_url"];
  ```
</CodeGroup>

<Info>
  **Handy Tips**

  The redirect happens from the CRED app based on the URL scheme passed in the payload. If not passed, the app will not redirect.
</Info>

#### Listen to CRED Callback

Listen to CRED callback in the `AppDelegate` class by implementing the `open url`  method. Handle the success response.

<CodeGroup>
  ```swift ViewController.swift theme={null}
  func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool {
      DispatchQueue.main.asyncAfter(deadline: .now() + 4.0) {
          /** Post the notification to CustomWebVC **/
          NotificationCenter.default.post(name: NSNotification.Name(rawValue: "CREDPAYURIEVENT"), object: nil, userInfo: ["response":url.absoluteString])
      }
      return false
  }
  ```

  ```objectivec ViewController.m theme={null}
  - (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options {
      [[NSNotificationCenter defaultCenter] postNotificationName:@"CREDPAYURIEVENT" object:NULL userInfo:@{@"response": [url absoluteString]}];
      return NO;
  }
  ```
</CodeGroup>

#### Register for Notification

Register for notification in CustomWebVC using the code sample given below:

<CodeGroup>
  ```swift ViewController.swift theme={null}
  NotificationCenter.default.addObserver(self, selector: #selector(self.statusCredData(_:)), name:NSNotification.Name(rawValue: "CREDPAYURIEVENT"), object: nil);
  ```

  ```objectivec ViewController.m theme={null}
  [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(statusCredData:) name:@"CREDPAYURIEVENT" object:NULL];
  ```
</CodeGroup>

Use the code given below to handle payment data:

<CodeGroup>
  ```swift ViewController.swift theme={null}
  @objc func statusCredData(_ notification: NSNotification) {
      if let dict = notification.userInfo {
          if let uriScheme = dict["response"] as? String {
              DispatchQueue.main.async {
                  self.razorpay?.publishUri(with: uriScheme)
              }
          }
      }
  }
  ```

  ```objectivec ViewController.m theme={null}
  - (void)statusCredData:(NSNotification *) notification {
      NSDictionary *dict = [notification userInfo];
      NSString *uriScheme = dict[@"response"];
      dispatch_async(dispatch_get_main_queue(), ^{
          [razorpay publishUri:uriScheme];
      });
  }
  ```
</CodeGroup>

#### Initiate Intent Flow

To initiate intent flow, send the `app_present` parameter as `1` while creating the payment.

<CodeGroup>
  ```swift ViewController.swift theme={null}
  let options: [String:Any] = [
    "amount": 100,
    "currency": "INR",
    "contact": "9000090000",
    "order_id": "order_FNPoKwCtPyhJOt",
    "email": "gaurav.kumar@example.com",
    "method": "app",
    "provider": "cred",
    "app_present": 1,
    "callback_url": "<MerchantApp URI-Scheme>://"
  ]
  razorpay.payWithCred(options)
  ```

  ```objectivec ViewController.m theme={null}
  NSDictionary *options = @{
      @"amount": @"100", // amount in currency subunits. Defaults to INR. 100 = 100 paise = INR 1.
      @"currency": @"INR",
      @"email": @"gaurav.kumar@example.com",
      @"contact": @"9000090000",
      @"order_id": @"order_4xbQrmEoA5WJ0G",
      @"method": @"app",
      @"provider": @"cred",
      @"app_present": @YES,
      @"callback_url": @"<MerchantApp URI-Scheme>://"
  };

  [_razorpay payWithCred: options];
  ```
</CodeGroup>

#### Request Parameters

Along with the other payment creation request parameters, you must pass:

`method`  *mandatory*
: `string` The method used to make the payment. Here, it must be `app`.

`provider` *mandatory if method=app*
: `string` Name of the PSP app. Here, it must be `cred`.

`app_present` *mandatory if app=cred*
: `integer` Based upon response from the app present function, pass the value in this field. Possible values:

* `1`: Opens the CRED app on customer's device.
* `0` (default): Sends a push notification to the customer's device.

`callback_url` *mandatory*
: `string` The URI scheme, using which the CRED app will be opened on the customer's mobile device.
