cashover_pay_flutter 0.1.0
cashover_pay_flutter: ^0.1.0 copied to clipboard
Official Flutter SDK for integrating CashOver Pay into your mobile apps. Accept secure digital payments online and manage payment workflows with ease. Built to be fast, reliable, and developer-friendly.
import 'package:flutter/material.dart';
import 'package:cashover_pay_flutter/cashover_pay_flutter.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'CashOver SDK Example',
debugShowCheckedModeBanner: false,
theme: ThemeData(
primarySwatch: Colors.blue,
scaffoldBackgroundColor: Colors.white,
),
home: const HomePage(),
);
}
}
class HomePage extends StatelessWidget {
const HomePage({super.key});
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('CashOver Store'),
centerTitle: true,
elevation: 0,
),
body: ListView(
padding: EdgeInsets.all(16),
children: [
// Product Card
Card(
color: Colors.white,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(16),
side: BorderSide(color: Colors.black),
),
elevation: 4,
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
// Product Image
ClipRRect(
borderRadius: const BorderRadius.vertical(
top: Radius.circular(16),
),
child: Image.network(
'https://www.skullcandy.eu/cdn/shop/files/Riff2_buy_box_black_2_02366bb5-9936-4c04-bb59-e2298619e062.png?v=1752271685&width=1445',
height: 200,
fit: BoxFit.contain,
),
),
Padding(
padding: const EdgeInsets.all(16.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const Text(
'Wireless Headphones',
style: TextStyle(
fontSize: 20,
fontWeight: FontWeight.bold,
),
),
const SizedBox(height: 8),
const Text(
'High-quality over-ear wireless headphones with noise cancellation.',
style: TextStyle(fontSize: 14, color: Colors.black87),
),
const SizedBox(height: 12),
const Text(
'\$49.99',
style: TextStyle(
fontSize: 18,
fontWeight: FontWeight.bold,
color: Colors.green,
),
),
const SizedBox(height: 16),
CashOverPayButton(
merchantUsername: 'drop.market',
storeUsername: 'al.beik',
amount: 49.99,
currency: 'USD',
webhookIds: ['id1', 'id2'],
metadata: {
"orderId": "A1001",
"email": "testEmail@mail.com",
"country": "LB",
"postalCode": "1300",
},
language: 'en',
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.center,
),
],
),
),
],
),
),
Card(
color: Colors.white,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(16),
side: const BorderSide(color: Colors.black),
),
elevation: 4,
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
ClipRRect(
borderRadius: const BorderRadius.vertical(
top: Radius.circular(16),
),
child: Image.network(
'https://store.storeimages.cdn-apple.com/4982/as-images.apple.com/is/MXQT2_AV1?wid=1144&hei=1144&fmt=jpeg&qlt=90&.v=1567304927921',
height: 200,
fit: BoxFit.contain,
),
),
Padding(
padding: const EdgeInsets.all(16.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const Text(
'iPad',
style: TextStyle(
fontSize: 20,
fontWeight: FontWeight.bold,
),
),
const SizedBox(height: 8),
const Text(
'Touch, draw, and type on one magical device.',
style: TextStyle(fontSize: 14, color: Colors.black87),
),
const SizedBox(height: 12),
const Text(
'1,000,000 LBP',
style: TextStyle(
fontSize: 18,
fontWeight: FontWeight.bold,
color: Colors.green,
),
),
const SizedBox(height: 16),
CashOverPayButton(
merchantUsername: 'drop.market',
storeUsername: 'al.beik',
amount: 1000000,
currency: 'LBP',
webhookIds: ['id1', 'id2'],
metadata: {
"orderId": "A1001",
"email": "testEmail@mail.com",
"country": "LB",
"postalCode": "1300",
},
language: 'en',
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.center,
theme: ThemeMode.dark,
),
],
),
),
],
),
),
],
),
);
}
}