Credit Card Integration (Flutter SDK)

This section explains how to integrate Credit Card payments using the Novalnet Flutter SDK. The SDK handles the complete payment flow, including UI, validation, and transaction processing.

Prerequisites

Before integrating Credit Card payments, ensure the following:

  • Flutter SDK 3.0 or later
  • Dart SDK 3.0 or later
  • Novalnet SDK is added to your project
  • Required backend configuration (API keys, signature, etc.) is already set up

Step 1: Import SDK

After adding the SDK dependency, import the Novalnet SDK in your integration file:

import 'package:novalnetsdk/novalnetsdk.dart';

Step 2: Initiate Credit Card Payment

Call the SDK method to start the Credit Card payment flow:

CreditCard Payment
var result = await NovalnetSDK.openCreditCard(
  context,
  paymentType: "CREDITCARD",
);

For Credit Card payments, ensure the following parameters are configured in your request:(configured in config.yaml file)

  • return_url → URL to redirect after successful payment
  • error_return_url → URL to redirect after failed payment

These URLs are essential for handling post-payment navigation and response processing in your application.

How It Works

  • The SDK opens a secure payment screen
  • The user enters card details
  • The SDK validates and processes the payment
  • The transaction is handled by Novalnet
  • A response is returned after completion

Response Handling

The method returns a response object:

Response Handling
if (result != null) {
  if (result["status"] == "SUCCESS") {
    // Payment successful
  } else {
    // Payment failed
  }
}

Important Notes

  • Ensure proper merchant configuration before using Credit Card payments
  • Always handle both success and failure responses
  • Use a valid BuildContext when calling the SDK method
  • Test with sandbox credentials before moving to production

The Novalnet SDK provides a ready-to-use Credit Card payment flow that handles UI, validation, and transaction processing, returning the final result to your application.

Sample Reference
ElevatedButton(
  onPressed: () async {
    var result = await NovalnetSDK.openCreditCard(
      context,
      paymentType: "CREDITCARD",
    );

    if (result != null) {
      if (result["status"] == "SUCCESS") {
        // Handle success (e.g., navigate to success page)
      } else {
        // Handle failure (e.g., show error message)
      }
    }
  },
  child: Text("Pay with Credit Card"),
);