cancel
Showing results for 
Search instead for 
Did you mean: 

braintree: adding parameters to the transaction

braintree: adding parameters to the transaction

Hi,

 

I am trying to add the cardholder info to the transaction.

basically I want to add the 

['creditCard']['cardholderName']

parameter.

During my tests I have found where the transaction is done (vendor/magento/module-braintree/Model/Adapter/BraintreeAdapter.php:145), and adding this line just before the 

Transaction::sale

call, works:

 

$attributes['creditCard']['cardholderName'] = "name here";

The problem is that the PaymentDataBuilder only manages merchant_id, amount, payment_method_nonce and order_id.

 

I cannot use a plugin, I think, because the $subjectReader object is private.

 

I have had a look at the official documentation about Payments Integrations, but here I need to extend something, I don't want to rewrite the builder.

 

Do you have any hints about it?

 

Thanks!

 

Lorenzo

1 REPLY 1

Re: braintree: adding parameters to the transaction

Hi,

To add creditcard cardholdername info to the transaction:

 

1)Add the cardholdername handler to the template file(cc-form.html).

2)define the handler in custom js file under method-renderer

getData: function () {

var data = {

'method': this.getCode(),

'additional_data': {

'cc_cardholdername': this.carduserName(),

}

};

 

carduserName:function{

var cardholdername = $(this).val();

return cardholdername;

}