nttdatapay_flutter 1.0.3 copy "nttdatapay_flutter: ^1.0.3" to clipboard
nttdatapay_flutter: ^1.0.3 copied to clipboard

Flutter SDK for NTT DATA Payment Services India with WebView support

NTTDATAPAY Flutter #

Flutter plugin for integrating NTT DATA Payment Services India in Android and iOS applications.


Platform Support #

✅ Android
✅ iOS


Features #

  • Secure token generation
  • WebView-based checkout
  • UPI intent support (GPay, PhonePe, Paytm, Cred, etc.)
  • Android & iOS support
  • UAT & Production environments

Installation #

To integrate nttdatapay_flutter in your Flutter project, add the following dependency to your pubspec.yaml file:

dependencies:
  nttdatapay_flutter: ^1.0.3

Alternatively, run the following command:

flutter pub add nttdatapay_flutter

After adding the dependency, fetch the package by running:

flutter pub get

iOS Setup #

iOS Configuration (Required for UPI Apps) #

Why this is required

iOS blocks app-to-app URL scheme checks by default.
These entries allow the plugin to detect and launch installed UPI apps such as:

  • Google Pay
  • PhonePe
  • Paytm
  • Cred
  • Other UPI-compatible apps

Without this configuration:

  • canLaunchUrl() will return false
  • UPI intent flow may fail silently

Add the following entries to your ios/Runner/Info.plist:

<key>LSApplicationQueriesSchemes</key>
<array>
  <string>upi</string>
  <string>phonepe</string>
  <string>paytmmp</string>
  <string>gpay</string>
  <string>tez</string>
</array>

Usage #

To integrate the NTTDATAPAY payment functionality, follow the steps below.

Import the package #

import 'package:nttdatapay_flutter/nttdatapay_flutter.dart';

Initialize merchant configuration #

⚠️ Important
For merchant configuration details, please contact the NTT DATA Payment Services integration team.
You can sign up or request integration access here:
👉 https://in.nttdatapay.com/sign-up

Do not hardcode production secrets in your application.

final nttdatapayConfig = const NttdatapayConfig(
  merchId: "XXXXXXX",
  txnPassword: "XXXX@XXX",
  reqEncKey: "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
  reqSalt: "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
  resDecKey: "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
  resSalt: "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
  reqHashKey: "XXXXXXXXXXXXXX",
  resHashKey: "XXXXXXXXXXXXXXXXXXX",
  environment: NttdatapayEnvironment.uat,
);

To enable the production environment for live mode, change:

environment: NttdatapayEnvironment.production,

Generate token using NTTDATAPAY AUTH service #

const String email = "test.userabc@xyz.in";
const String mobile = "8888888800";
const String amount = "1.00";

final ndpsTokenId = await NdpsAuthService.generateToken(
  config: nttdatapayConfig,
  txnId: txnId, // Unique transaction ID
  amount: amount,
  email: email,
  mobile: mobile,
  prodId: "XXX", // Product ID
  custAccNo: "213232323",
  clientCode: "testValueForClientCode",
  txnCurrency: "INR",
);

Add optional UDF parameters #

final ndpsTokenId = await NdpsAuthService.generateToken(
  config: nttdatapayConfig,
  txnId: txnId,
  amount: amount,
  email: email,
  mobile: mobile,
  prodId: "XXX",
  custAccNo: "213232323",
  clientCode: "testValueForClientCode",
  txnCurrency: "INR",
  udf1: "udf1value",
  udf2: "udf2value",
  udf3: "udf3value",
  udf4: "udf4value",
  udf5: "udf5value",
);

Add multi-product (split payment) support #

final ndpsTokenId = await NdpsAuthService.generateToken(
  config: nttdatapayConfig,
  txnId: txnId,
  amount: amount,
  email: email,
  mobile: mobile,
  prodId: "multi", // Fixed value for multi-product
  prodDetails: const [
    ProdDetail(prodName: "XXX", prodAmount: "1.00"),
    ProdDetail(prodName: "XXXX", prodAmount: "1.00"),
  ],
  custAccNo: "213232323",
  clientCode: "testValueForClientCode",
  txnCurrency: "INR",
);

Open checkout WebView and wait for the final payment result #

final NdpsPaymentResult? result =
    await Navigator.push<NdpsPaymentResult>(
  ctx,
  MaterialPageRoute(
    builder: (_) => NdpsPaymentWebView(
      ndpsTokenId: ndpsTokenId,
      merchId: nttdatapayConfig.merchId,
      returnUrl: nttdatapayConfig.returnUrl,
      config: nttdatapayConfig,
      email: email,
      mobile: mobile,
      showAppBar: true,
      appBarTitle: "Complete Payment",
    ),
  ),
);

if (!ctx.mounted) return;

// Transaction status
final String status = result.status;
debugPrint("Transaction status => $status"); // OTS0000 = success

// Transaction description
final String description = result.description.toString();
debugPrint("Transaction description => $description");

// Full transaction response (raw JSON map)
final Map<String, dynamic> transactionResponse = result.rawResponse;
debugPrint("Transaction response => $transactionResponse");

switch (status) {
  // Success
  case "OTS0000":
    debugPrint("Payment Successful");
    break;

  // Pending payment and NEFT/RTGS initial status
  case "OTS0551":
  case "PENDING":
    debugPrint(
      result.description.isNotEmpty
          ? result.description
          : "Payment Pending",
    );
    break;

  // Failed
  case "OTS0600":
    debugPrint("Payment Failed");
    break;

  case "CANCELLED":
    debugPrint("Payment cancelled by user");
    break;

  case "TIMEOUT":
    debugPrint("Session timed out. Please try again.");
    break;

  default:
    debugPrint("Payment Failed (Status: $status)");
}

Example #

A complete working example is available here:

👉 https://pub.dev/packages/nttdatapay_flutter/example

1
likes
0
points
124
downloads

Publisher

unverified uploader

Weekly Downloads

Flutter SDK for NTT DATA Payment Services India with WebView support

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

cryptography, flutter, flutter_inappwebview, http, url_launcher

More

Packages that depend on nttdatapay_flutter