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("
code: " . $result->transaction->processorResponseCode);
print_r("
text: " . $result->transaction->processorResponseText);
} else {
print_r("Validation errors:
");
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 .
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…