Paypal支付网关添加flutter应用程序与magento 2 web详细信息用户名,密码,签名magento 2?



我有Magento 2详细信息用户名,密码,签名(Paypal支付网关)。如何在flutter应用中添加Paypal支付网关与此(Magento 2 Paypal)的详细信息。

已经在flutter应用程序中成功实现了clientId和secretKey,但我只收到Magento 2的详细信息。

我怎么用Magento Details做这件事?

import 'package:flutter/material.dart';
import 'package:flutter_paypal/flutter_paypal.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Paypal',
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: const MyHomePage(title: 'Flutter Paypal Example'),
);
}
}
class MyHomePage extends StatefulWidget {
const MyHomePage({Key? key, required this.title}) : super(key: key);
final String title;
@override
State<MyHomePage> createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(widget.title),
),
body: Center(
child: TextButton(
onPressed: () => {
Navigator.of(context).push(
MaterialPageRoute(
builder: (BuildContext context) => UsePaypal(
sandboxMode: true,
clientId:
"AW1TdvpSGbIM5iP4HJNI5TyTmwpY9Gv9dYw8_8yW5lYIbCqf326vrkrp0ce9TAqjEGMHiV3OqJM_aRT0",
secretKey:
"EHHtTDjnmTZATYBPiGzZC_AZUfMpMAzj2VZUeqlFUrRJA_C0pQNCxDccB5qoRQSEdcOnnKQhycuOWdP9",
returnURL: "https://samplesite.com/return",
cancelURL: "https://samplesite.com/cancel",
transactions: const [
{
"amount": {
"total": '100',
"currency": "USD",
"details": {
"tax":30,
"shipping": '50',
"shipping_discount": 10,
"discount":'10',
"subtotal": '40',
}
},
"description":
"The payment transaction description.",
// "payment_options": {
//   "allowed_payment_method":
//       "INSTANT_FUNDING_SOURCE"
// },
"item_list": {
"items": [
{
"name": "A Gift Card",
"quantity": 2,
"price": '10',
"currency": "USD"
},
{
"name": "Push it bag",
"quantity": 1,
"price": '20',
"currency": "USD"
}
],
// shipping address is not required though
"shipping_address": {
"recipient_name": "Jane Foster",
"line1": "Travis County",
"line2": "",
"city": "Austin",
"country_code": "US",
"postal_code": "73301",
"phone": "+00000000",
"state": "Texas"
},
}
}
],
note: "Contact us for any questions on your order.",
onSuccess: (Map params) async {
print("onSuccess: $params");
},
onError: (error) {
print("onError: $error");
},
onCancel: (params) {
print('cancelled: $params');
}),
),
)
},
child: const Text("Make Payment")),
));
}
}

API的用户名、密码和秘密用于验证PayPal的经典API,这些API大约有20年的历史了。

当前api使用REST APP客户端ID和secret进行身份验证。所以你应该用这个

忘掉经典API凭据吧,不要在任何新的集成中使用它们或经典API。

最新更新