api_payment

Easy payment API for online systems. Works on all platforms (Android, iOS, Web, Windows).

Features

  • Manage the payment process for users
  • Simple integration
  • Two display modes:
    • Box (inline integration)
    • Modal (popup dialog)

Screenshots

Box Display Modal Display

Getting Started

Installation

Add to your pubspec.yaml:

dependencies:
  api_payment: ^0.0.1

Usage

Import the package:

import 'package:api_payment/yt_ypay.dart';

Minimal Example

1. Create a YtYpay instance

Parameters:

  • clientId (required): The ID provided by the Ytech Ypay platform
  • title (required): Your app title
  • amount (required): The payment amount
YtYpay ypay = YtYpay(
  clientId: "clientId", 
  title: "App Title", 
  amount: 500.0, 
);

2. Use the instance inside your widget

Call the method payment from the ypay instance to initialize the payment view.

Arguments:

  • displayType (optional): (DisplayTypes) displayType, default = DisplayTypes.BOX
  • context (optional): (BuildContext) context, default = null

ypay provides two display types:

Option 1: DisplayTypes.BOX
// Since `displayType` is set to `BOX` by default, you don't need to provide it.
// The `context` is not needed in `DisplayTypes.BOX` mode.
// Call this as a widget

ypay.payment(); // returns a Widget?
Option 2: DisplayTypes.MODAL
Padding(
  padding: const EdgeInsets.all(0.0),
  child: Builder(builder: (context) { 
    return ElevatedButton(
      onPressed: () {
        ypay.payment(displayType: DisplayTypes.MODAL, context: context) ?? Container();
      },
      child: const Text("Open in modal"),
    );
  }),
),

Display


Display

Contributors ✨

  • YTECH Developers Team