Follow-up to #2674858: Card on file - can't manage or add cards with Stripe.js integration method
Problem/Motivation
The "card on file" functionality does not allow for managing cards when using the checkout integration type.
This is due to it being necessary to provide an update callback in order for the View handler that loads the contextual links to realize the user actually has access to the delete operation: see #2323561: No Operations appear on .
Stripe's API itself looks like it will allow us simply to save the customer's card using the charge token. See https://stripe.com/docs/charges#saving-credit-card-details-for-later
Proposed resolution
I'm going to try to implement this, at least for adding and deleting. Not sure what we can do in terms of updating — perhaps allow them to replace the card, or just have a dummy callback so that everything else will still show up.
To the extent possible, I'm just going to look at what the module does in the payment pane and just try to copy that.
Remaining tasks
- Review and test patch.
User interface changes
- Card-on-file management will be possible for the Stripe Checkout integration method, but the UI will basically be the same as with Stripe.js.
API changes
None.
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | commerce_stripe_2703577_checkout_cardonfile.patch | 13.53 KB | wizonesolutions |
Comments
Comment #2
wizonesolutionsPushed to get this done today. Here is the patch!
I basically just copy-paste-changed the code from
commerce_stripe_submit_form(). Wasn't comfortable actually refactoringcommerce_stripe_submit_form()since it's kind of an important function. But I left notes with some recommendations on where reuse could occur.Same with
commerce_stripe.js, where I repurposed and fixed up the code to open Commerce Stripe.Works great! Saves the card, no errors or warnings.
And stripe.js still works if set.
Comment #3
wizonesolutionsComment #5
torgospizzaTested and working for me. Committed to 7.x-1.x.