Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
Heyo :). I'm working on recurring payment functionality and it occurs to me that it would be really useful to allow users to define a default card to use. At the moment, my patch for the Authorize.net module (http://drupal.org/node/1418348#comment-5534734) just takes the first card on file for a user that it finds and uses that. This may sound like a piece of functionality relevant only to recurring payments but I think it's also handy for users who do a lot of checkouts and would like to define a default card so they don't pick the wrong one by accident.
Comment | File | Size | Author |
---|---|---|---|
#6 | commerce_cardonfile-default_card.patch | 7.94 KB | DevElCuy |
Comments
Comment #1
BenK CreditAttribution: BenK commentedThis is definitely needed... any progress on this?
Comment #2
R.J. Steinert CreditAttribution: R.J. Steinert commentedNope, but I'm definitely going to need to tackle this soon..
Comment #3
SolomonGifford CreditAttribution: SolomonGifford commentedWouldn't a better way to solve this be to create a commerce_card_on_file_reference field module that would allow a card_on_file to be attached to an order....
Then when modules do recurring orders, they grab the card on file associated with the order?
It seems to me that I may want my $10 recurring order on one card and my $20 recurring order on my other card.
Comment #4
DevElCuy CreditAttribution: DevElCuy commentedRecurring billing happens on cron run and is supposed to be automatic. So if I change my card or want to manage more than one, it would be a mess to change the card I wan to be billed to on every recurring order.
Comment #5
DevElCuy CreditAttribution: DevElCuy commentedIn the other hand, if nothing has changed, order should be billed to the card in the order, so a default card makes sense only when order's card fails. That should be an option: "Bill to user's default payment method if order's card fails".
Comment #6
DevElCuy CreditAttribution: DevElCuy commentedAttached patch adds field "is_default" to db table "commerce_card_data" via hook_schema and hook_update_N. There is another hook_update_N that sets the first card data as default card for each user.
The patch implements a new contextual link "set as default" in the user's profile "stored payment methods" tab.
Comment #7
recrit CreditAttribution: recrit commented@develCuy: thanks for your work. In parallel, we've been working on a fork that incorporates a default card setting and various other improvements, @see http://drupal.org/sandbox/recrit/1810130. We're working on merging this fork to a 2.x branch. The default card handling is fairly close to your implementation with the addition of ensuring only 1 default per payment method instance and default can be set during checkout.
Comment #8
DevElCuy CreditAttribution: DevElCuy commented@recrit, can't wait to see it merged :)
Comment #9
dwkitchen CreditAttribution: dwkitchen commentedThis has now been included in the 2.x branch