Braintree payments Escrow Funding

大兔子大兔子 提交于 2020-01-15 06:31:59

问题


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.

Error is:-

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

I have got the code from here


回答1:


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);



回答2:


I think that you need two things:

  1. Pass a merchant_account_id - see example on https://www.braintreepayments.com/docs/php/transactions/escrow

  2. You can only do escrow if your merchant account is using Marketplace. https://www.braintreepayments.com/docs/php/guide/marketplace




回答3:


I think you made a mistake in your code:

'options' => array(
  'submitForSettlement' => true,
  'holdInEscrow' => true,
)

Should be:

'holdInEscrow' => true

There should be no comma after 'holdInEscrow' => true



来源:https://stackoverflow.com/questions/25643520/braintree-payments-escrow-funding

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!