本文介绍了Braintree付款托管资金的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用php中的braintree来实现代管资金.我已经从此处下载了库.我的代码如下:-

I am trying to implement escrow funding using braintree in php. I have downloaded library from here. My code is below:-

require_once "../braintree/lib/Braintree.php";

Braintree_Configuration::environment("sandbox");
Braintree_Configuration::merchantId("was4zgn5x6vt99h");
Braintree_Configuration::publicKey("ydjrasdwyw9npkvnw4");
Braintree_Configuration::privateKey("f197ac5a66a1fsad37d3950890b2cbda9");

$result = Braintree_Transaction::sale(
  array(
'amount' => "100.00",

'creditCard' => array(
  'number' => "4111111111111111",
  'expirationDate' => "12/2014",
),
'options' => array(
  'submitForSettlement' => true,
  'holdInEscrow' => true,
)

  )
    );
echo "<pre>";
 print_r("\n  message: " . $result->message);

它可以直接付款.但这不适用于代管.请检查我的代码.

It is working for direct payment. But It is not working for escrow. Please check my code.

错误是:-

"message: Transaction could not be held in escrow."

我从此处

推荐答案

最后,我从Braintree得到了实际答案.我必须再添加两个参数.一个 merchantAccountId ,另一个是 serviceFeeAmount .这里的 merchantAccountId id实际上是子商家 merchantAccountId .您将从Braintree获得 merchantAccountId .登录后,进入设置->处理.在页面底部,您将获得查看所有商家帐户.在这里,您将获得merchantAccountId.不要使用默认的mercerAccountId,它将无法正常工作.

At last i got the actual answer from Braintree. I had to add two more parameters. One merchantAccountId and other is serviceFeeAmount. Here merchantAccountId id is actually sub merchant merchantAccountId. You will get merchantAccountId from Braintree. After logging in, go to settings->Processing. At the bottom of the page you will get View All Merchant Account. Here you will get merchantAccountId. Don't use default merchantAccountId it will not work.

require_once "../braintree/lib/Braintree.php";
Braintree_Configuration::environment("sandbox");
Braintree_Configuration::merchantId("was4zgn5x6vt99h");
Braintree_Configuration::publicKey("ydjrasdwyw9npkvnw4");
Braintree_Configuration::privateKey("f197ac5a66a1fsad37d3950890b2cbda9");

$result = Braintree_Transaction::sale(
  array(
'amount' => "100.00",
'merchantAccountId' => 'test_user_instant_5vcgn574',
'creditCard' => array(
  'number' => "4111111111111111",
  'expirationDate' => "12/2014",
),
'options' => array(
  'submitForSettlement' => true,
  'holdInEscrow' => true,
),
'serviceFeeAmount' =>'1'

  )
);
echo "<pre>";
print_r("\n  message: " . $result->message);

这篇关于Braintree付款托管资金的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-25 08:43