首页 > 解决方案 > 如何在没有商户账户的情况下使用 Braintree 进行买卖双方的付款?

问题描述

我正在为物业租赁管理开发一个 Android 应用程序,租户可以直接向 Landlord 支付租金。我想使用 Braintree,因为它支持信用卡/借记卡、PayPal 和 Google Pay。

到目前为止我所尝试的,

  1. 我已经尝试过创建 Braintree 的沙盒帐户并执行简单的付款转账给单个商家。
  2. 探索了 Stripe Connect,但看起来很耗时的文档。
  3. 还探索了 Braintree Direct,但它显示的文档与单一商家支付转账相同。我已经按照提到的步骤进行操作,它引导我实施单一商家支付转移。

我的问题:

  1. 用户如何通过 Android SDK 或服务器上的 PHP sdk 使用 Braintree 直接向另一个用户发送付款?
  2. 我是否需要 Braintree 的企业帐户才能实施上述服务?
  3. 无论使用任何编程语言,但使用 Braintree / Paypal,您能否推荐任何有关买方到卖方付款集成的示例?
  4. 这是根据文档处理付款的服务器代码:

    $result=Braintree_Transaction::sale([
        'amount'=>$amount,
        'paymentMethodNonce'=>$nonce,
        'options'=> [
            'submitForSettlement'=>True
            ]
        ]);
    
  5. 如果通过示例或参考文档满足我的需要,我愿意接受任何其他解决方案。

那么,是否有任何参数可以提供,我们可以通过它直接将付款转移到接收方?

我知道上面有很多问题,但我真的很困惑,因为没有关于 android 应用程序的适当文档,也没有找到合适的集成示例。

任何指导都会有所帮助。

标签: androidpaypalpayment-gatewaybraintreepaypal-adaptive-payments

解决方案


这是实现 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 等。

希望能帮助到你。


推荐阅读