问题
I am testing braintree ecrow payment in sandbox account . Below is the code I have written.
//Set the Configuration
Braintree_Configuration::environment($config['mode']);
Braintree_Configuration::merchantId($config['merchant_id']);
Braintree_Configuration::publicKey($config['public_key']);
Braintree_Configuration::privateKey($config['private_key']);
$result = Braintree_Transaction::sale(
[
'amount' => '100.00',
'merchantAccountId' => 'test',
'creditCard' => [
'number' => '5105105105105100',
'expirationDate' => '05/16'
],
'options' => [
'submitForSettlement' => true,
'holdInEscrow' => true,
],
'serviceFeeAmount' => "10.00"
]
);
if ($result->success) {
print_r("success!: " . $result->transaction->id);
print_r("success!: " . $result->transaction->escrowStatus);
print_r($result->transaction->serviceFeeAmount);
$escow = Braintree_Transaction::holdInEscrow($result->transaction->id);
} else if ($result->transaction) {
print_r("Error processing transaction:");
print_r("\n code: " . $result->transaction->processorResponseCode);
print_r("\n text: " . $result->transaction->processorResponseText);
} else {
print_r("Validation errors: \n");
print_r($result->errors->deepAll());
}
The following code throws validation errors as below.
Validation errors: Array ( [0] => Braintree_Error_Validation Object ( [_attribute:Braintree_Error_Validation:private] => serviceFeeAmount [_code:Braintree_Error_Validation:private] => 91557 [_message:Braintree_Error_Validation:private] => Service fee not supported on master merchant account. ) [1] => Braintree_Error_Validation Object ( [_attribute:Braintree_Error_Validation:private] => base [_code:Braintree_Error_Validation:private] => 91560 [_message:Braintree_Error_Validation:private] => Transaction could not be held in escrow. ) )
But the merchantAccountId I have used is sub merchant id which I have created manually. Anyone with any help much appreciated. Thanks in advance .
回答1:
Solved!!
Because Marketplace is only supported in the US, and you signed up for your sandbox outside of the US, your sandbox isn't a Marketplace account. If you are a developer working for a US based merchant on an integration, you will need to signup for a US sandbox account. You can do this on our website by selecting United States as your country using the drop down menu on the bottom left of the page. You should then be able to click the Try the Sandbox button and sign up for a new sandbox account with Marketplace features enabled. This should allow you to create sub-merchant accounts using a master merchant account, which will exist if a new sandbox is created following the directions I've supplied. Once you have a Marketplace sandbox, your default merchant account will also be your Master Merchant account.
来源:https://stackoverflow.com/questions/32520847/braintree-escrow-payment-not-working