我正在开发一个用于物业租赁管理的Android应用程序,租户将可以直接向Landlord支付租金。
我想使用Braintree,因为它支持信用卡/借记卡,PayPal和
Google Pay。
到目前为止我尝试过的
我已经尝试过创建Braintree的沙箱帐户,并执行了向单个商家的简单付款转账。
探索了Stripe Connect,但看起来很耗时。
还探讨了Braintree Direct,但它显示的文档与单个商家的付款转移相同。我已按照上述步骤操作,并引导我实施了单一商家付款转帐。
我的问题:
用户如何使用Braintree通过服务器上的Android SDK或PHP sdk直接向其他用户发送付款?
我需要Braintree的企业帐户来实施上述服务吗?
您是否可以推荐任何有关买卖双方付款集成的示例,而不论使用何种编程语言,而是使用Braintree / Paypal进行编程?
这是根据文档处理付款的服务器代码:
$result=Braintree_Transaction::sale([
'amount'=>$amount,
'paymentMethodNonce'=>$nonce,
'options'=> [
'submitForSettlement'=>True
]
]);
如果需要我提供示例或参考文档的其他解决方案,我愿意接受。
因此,是否提供任何参数,我们可以通过该参数将付款直接转给收款人?
我知道上面有很多问题,但是我真的很困惑,因为android应用程序上没有适当的文档,也没有找到合适的示例进行集成。
任何指导都会有所帮助。
最佳答案
这是用于实施braintree的适当文档。看一下这个 -
https://developers.braintreepayments.com/guides/drop-in/setup-and-integration/android/v2
在您的gradle中添加此-
dependencies {
implementation 'com.braintreepayments.api:drop-in:3.7.1'
}
在您的付款按钮中调用此按钮-
public void onBraintreeSubmit(View v) {
DropInRequest dropInRequest = new DropInRequest().clientToken(clientToken);
startActivityForResult(dropInRequest.getIntent(this), REQUEST_CODE);
}
您将在Activity的onActivtyResult中获得一个随机数-
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == REQUEST_CODE) {
if (resultCode == RESULT_OK) {
// use the result to update your UI and send the payment method nonce to your server
DropInResult result = data.getParcelableExtra(DropInResult.EXTRA_DROP_IN_RESULT);
} else if (resultCode == RESULT_CANCELED) {
// the user canceled
} else {
// handle errors here, an exception may be available in
Exception error = (Exception) data.getSerializableExtra(DropInActivity.EXTRA_ERROR);
}
}
}
然后,如果您不使用卡,则可以致电配置其他付款方式,例如Google Pay等。
希望能帮助到你。