4/21/2
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import 'package:SEFER/constant/box_name.dart';
|
||||
import 'package:dio/dio.dart' as dio;
|
||||
import 'package:dio/dio.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
|
||||
@@ -62,16 +63,18 @@ class PaymobManager extends GetxController {
|
||||
final dio = Dio();
|
||||
try {
|
||||
final response = await dio.post(
|
||||
'https://accept.paymob.com/api/acceptance/payments/pay',
|
||||
'https://accept.paymobsolutions.com/api/acceptance/payments/pay',
|
||||
data: data,
|
||||
);
|
||||
|
||||
// 4. Handle Payment Response
|
||||
if (response.statusCode == 200) {
|
||||
// Payment successful: Process response data (e.g., transaction ID)
|
||||
final paymentData = response.data; // Assuming JSON response
|
||||
print("Payment successful: $paymentData");
|
||||
|
||||
print("redirection_url: ${paymentData['iframe_redirection_url']}");
|
||||
|
||||
// Navigate to success screen or display success message
|
||||
launchUrl(Uri.parse(paymentData['iframe_redirection_url']));
|
||||
} else {
|
||||
// Payment failed: Handle errors (e.g., display error message)
|
||||
print("Payment failed: ${response.statusCode} - ${response.data}");
|
||||
@@ -82,24 +85,6 @@ class PaymobManager extends GetxController {
|
||||
}
|
||||
}
|
||||
|
||||
// Future<void> payWithPayMob(int amount, String currency) async {
|
||||
// String key = await PaymobManager().getPaymentKey(amount, currency);
|
||||
// await launchUrl(Uri.parse(
|
||||
// // 'https://accept.paymob.com/api/acceptance/iframes/837992?payment_token=$key'),
|
||||
// 'https://accept.paymob.com/api/acceptance/payments/pay'));
|
||||
// print(key);
|
||||
// final dio.Response response = await Dio()
|
||||
// .post('https://accept.paymob.com/api/acceptance/payments/pay', data: {
|
||||
// "source": {
|
||||
// "identifier": "01010101010",
|
||||
// "subtype": "WALLET",
|
||||
// },
|
||||
// "payment_token": key, // token obtained in step 3
|
||||
// });
|
||||
//
|
||||
// // String paymentStatus = await _getStatusAfterPaid();
|
||||
// }
|
||||
|
||||
Future<String> _getStatusAfterPaid() async {
|
||||
print(authanticationToken1);
|
||||
print(orderId1);
|
||||
@@ -154,7 +139,8 @@ class PaymobManager extends GetxController {
|
||||
"expiration": 200,
|
||||
"auth_token": authanticationToken.toString(),
|
||||
"order_id": orderId.toString(),
|
||||
"integration_id": int.parse(AK.integrationIdPayMob),
|
||||
"integration_id":
|
||||
4556056, ////todo wallet or online card int.parse(AK.integrationIdPayMob),
|
||||
"lock_order_when_paid": "false",
|
||||
"amount_cents": amount,
|
||||
"currency": currency,
|
||||
|
||||
Reference in New Issue
Block a user