Hi there. I've spent some time trying to create subscription using commerce_recurring + commerce_cardonfile + commerce_braintree modules and I've found that commerce_braintree does not provide "charge callback" required for the "charge an order with a card on file" action of the commerce_cardonfile module.
I think that such kind of subscription is more flexible than Braintree Plans, which can't be controlled programmatically. I've created a patch (just for demonstration of my idea) for the "charge callback", but I'm not too familiar with braintree or cardonfile so I may miss something.

What do You think?

Comments

artem_sylchuk’s picture

Fixed missing newline.

varshith’s picture

Will there be any development reg. this issue?
I am using commerce_license_billing with commerce_braintree
It took me a while to find out that "charge callback" is required for the recurring payment.

Thanks @james_kerrigan for providing a base to start with

andyg5000’s picture

This is an old one. Not sure how I missed this all along. Things have changed a bit, so here's a rewrite.

andyg5000’s picture

Status: Needs review » Fixed

  • andyg5000 committed ac26563 on 7.x-2.x
    Issue #2162917 by james_kerrigan, andyg5000: Provide charge callback
    

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

ibuildit’s picture

I'm reopening this because I think my error is related to this.

The combination Recurring - Braintree - Card on file worked great until a couple of days ago for me. I used to run stable, but Braintree stopped recieveing transactions... now I run latest dev.

I'm now getting this error below - but ONLY when I tick the checkbox in Braintree Hosted Fields configuration (checkout rule) to use Card on File / vault functionality. The charge happen just fine, but Drupal crashes and does not create the user account. I have no idea what to do about this unfortunately.

PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '' for key 'name': INSERT INTO {users} (uid, name, pass, mail, theme, signature, signature_format, created, access, login, status, timezone, language, picture, init, data, uuid) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4, :db_insert_placeholder_5, :db_insert_placeholder_6, :db_insert_placeholder_7, :db_insert_placeholder_8, :db_insert_placeholder_9, :db_insert_placeholder_10, :db_insert_placeholder_11, :db_insert_placeholder_12, :db_insert_placeholder_13, :db_insert_placeholder_14, :db_insert_placeholder_15, :db_insert_placeholder_16); Array ( [:db_insert_placeholder_0] => 376 [:db_insert_placeholder_1] => [:db_insert_placeholder_2] => [:db_insert_placeholder_3] => [:db_insert_placeholder_4] => [:db_insert_placeholder_5] => [:db_insert_placeholder_6] => [:db_insert_placeholder_7] => 0 [:db_insert_placeholder_8] => 0 [:db_insert_placeholder_9] => 0 [:db_insert_placeholder_10] => 0 [:db_insert_placeholder_11] => [:db_insert_placeholder_12] => [:db_insert_placeholder_13] => 0 [:db_insert_placeholder_14] => [:db_insert_placeholder_15] => a:1:{s:15:"braintree_vault";a:8:{s:2:"id";s:9:"506664114";s:9:"firstName";N;s:8:"lastName";N;s:7:"company";N;s:5:"email";s:22:"sdfdfhdfgh@ibuildit.se";s:7:"website";N;s:5:"phone";N;s:3:"fax";N;}} [:db_insert_placeholder_16] => e67d0e05-e216-4e34-be90-c1180a436e21 ) in drupal_write_record() (line 7404 of /srv/bindings/df4c642081724bf2b488ea8bfb98bbe3/code/includes/common.inc).