我必须在Flutter中集成PayPal付款,并且唯一具有这种功能的插件是flutter_braintree。但是那里的文档没有那么详细,所以我很困惑如何使用此插件进行实际付款。我的任务是拥有这样一种流程:单击应用程序中的PayPal按钮,然后继续PayPal支付给预定义的IBAN。我试图检查PayPal和Braintree文档,但是由于Flutter没有提及任何内容,因此我有些困惑。 请帮助我,满足我的要求的正确方向是什么。我有以下问题:
提前谢谢您,我真的很在意这个主题,找不到解决方法。
答案 0 :(得分:2)
在php中生成clientToken | nodejs请参阅:https://developers.braintreepayments.com/reference/request/client-token/generate/php
$clientToken = $gateway->clientToken()->generate([
"customerId" => '21534539348326'//create customer in panel
]);`
在应用程序中产生付款Nonce:
BraintreePayment braintreePayment = new BraintreePayment();
var data = await braintreePayment.showDropIn(
nonce: clientNonce,
amount: "2.0",
inSandbox: true,
);
print("Response of the payment $data");
// exe:在php中生成事务| nodejs请参阅:https://github.com/braintree/braintree_php
$result = $gateway->transaction()->sale([
'amount' => '1000.00',
'paymentMethodNonce' => 'nonceFromTheClient',
'options' => [ 'submitForSettlement' => true ]
]);