In the Card on File project documentation, it states that 'To use with Commerce Recurring Framework 2.x add the Charge Card action inside the loop in the create orders from recurring entities reaction rule.'
I do not see a rule "create orders from recurring entities reaction rule' and I do not see a 'Charge Card' action in the available lists. Can you provide the specific rule and action to be updated?

My initial purchase is working but when cron runs the recurring order is Payment failed (hard-decline). I am thinking the problem is that I dont have the above rule configured correctly.

Thanks in advance for your support.

Comments

renee_nistler created an issue. See original summary.

renee_nistler’s picture

I am using:
Commerce License 7.x-1.3
Commerce License Billing 7.x-1.0-beta4
Card on File 7.x-2.0-beta5
Commerce Stripe 7.x-1.0
in Drupal 7.39

ahillio’s picture

Are you sure the card token is getting stored, that the card is actually being kept "on file"?

Kiendeleo’s picture

I am having this same issue with commerce_braintree

ahillio’s picture

Recurring orders will fail with "Hard Decline" when there is no card on file for the order's owner. Are you sure the card tokens are being saved successfully?

Kiendeleo’s picture

I can confirm that the cards are saving correctly in the Braintree Vault, I can charge them from the Braintree control panel.

ahillio’s picture

That is different. The payment gateway (Braintree, Stripe, etc) can save the person's card, but that is different than commerce_cardonfile saving the card.

In Stripe, for example, the commerce_stripe payment method needs to be configured by admin to allow for commerce_cardonfile integration. Then, by default configuration, the customer has to check the box in order for commerce_cardonfile to save it.

You can see if the card is kept on file by going to the customer's user profile and clicking on the 'Stored cards' tab.

Kiendeleo’s picture

Well in my case, the braintree module is configured for card on file support, supposedly, and the card last 4 is being stored and visible from the saved card area. However when the recurring charges try to charge I get a fail hard decline.

ahillio’s picture

Shucks. Well that part's working. Wish I knew what to look at next. I'm nearly certain this doesn't have anything to do with the rules config mentioned in the original post.

ahillio’s picture

Priority: Critical » Normal
Kiendeleo’s picture

I think this issue has to do with this issue: https://www.drupal.org/node/2322681

Kiendeleo’s picture

Something that also should be taken into consideration is that when the Authorize.net module is set to log API responses there are no log messages for Authorize.net when the re-bill takes place. This mean that the payment module isn't even requesting the transaction. This means that the Hard decline is actually happening in the card on file module.

Lord Pachelbel’s picture

renee_nistler, the documentation you're referring to in your original post pertains to Commerce Recurring Framework, but you're using Commerce License and Commerce License Billing, so that documentation does not apply to your situation. Commerce Recurring Framework and Commerce License Billing are two different modules that ultimately do the same thing — recurring billing — but the latter one is the one that's meant to be used with Commerce License.

Anyway, I am also experiencing your problem, except I'm using Commerce Authorize.Net as the payment gateway module. I too am seeing that the users' cards are stored correctly in Drupal and in Authorize.net when the first purchase is made, so any hard declines after that are happening for some other reason, and I suspect they're either the fault of Commerce License Billing or Commerce Card on File. I also noticed what Kiendeleo pointed out, that Commerce Authorize.Net saved no log entries for my site's recurring transactions, and that could mean that Commerce Authorize.Net was never even invoked.

Lord Pachelbel’s picture

tl,dr; — To fix this, patch Commerce Card on File with #16 from #2000420: Checkout "Set as your default card" does not set default for NEW cards, and also patch the patch as per my comment in #21 (https://www.drupal.org/node/2000420#comment-11593817).

Explanation:
The problem is if a card is added to an account during checkout (the usual workflow), Commerce Card on File does not mark it as the default card no matter what the checkbox option says. That means that every time Commerce License Billing tries to do a recurring charge, Commerce Card on File has no default card data to pass along, and this causes a hard decline.

Commerce Card on File will only mark a card as the default card during checkout if the card is already on file. So without the patch, two possible workarounds are the following:

  • Change the store's workflow to require new customers to add a card to their account before entering the checkout process.
  • Cancel the customer's original order and ask them go through the checkout process again using their original card (which should still be on file)

Neither of these workarounds are ideal, obviously, so please test the patch and report your results in that other issue. It worked for me but it's good to have additional confirmation.

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... and I got the hard declined error.

Now I run latest dev, charges work fine again, no more hard decline... but:

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

ibuildit’s picture

My error I got above was related to this patch in commerce_braintree, the patch is no longer working.

https://www.drupal.org/project/commerce_braintree/issues/2718923