Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Stripe allows for payment requests to be processed later if the capture flag is set to FALSE in the request to Stripe. This allows for authorization only transactions. An interface is needed to capture the amount later in the Payment tag as well as a setting in the Payment Methods to allow for authorize only transactions.
Comments
Comment #2
torgosPizzaI'd like this feature as well. I have discussed this already before, see my comments in #1720122-42: When Stripe is in the checkout pane, customer is charged before the order is complete. We'd probably need to move the transaction saving into a hook, otherwise auth and capture could have weird side effects in a multi-page Checkout feature where the payment method is on the first page. Unless of course we use an auth-capture "mode" to alter the transaction, we could then perhaps set the transaction status to PENDING, and then once #1875234: Allow payments to be made through order payment tab lands we could add a capture fulfillment / settlement action for the terminal. (At least, I imagine that's how it would work, since there is currently no way to "edit" a transaction's status through the UI.)
Comment #3
angms-bh CreditAttribution: angms-bh as a volunteer commentedI have already implemented a version of this feature and will be submitting a patch for review probably next week. I went the same route that commerce_authnet went. There is an authorization only mode. So when the customer checks out, it only authorizes the transaction. Then later, the administrator of the orders goes in and captures the transaction which actually completes the charge.
Comment #4
angms-bh CreditAttribution: angms-bh as a volunteer commentedHere is a patch with an implementation of the authorization only functionality. Please note, there is a limitation in Stripe that transactions MUST be captured within 7 days. This is important to know if you are going to use this functionality.
I added a setting in the Stripe payment gateway configuration for the user to choose whether they want their transactions to be authorization only or authorization and capture.
I then allow for the transaction that has been authorized only to be captured by adding an option on the transaction to do so.
Also note, I added a void option for when the user wants to no longer have a charge pending on the customer's account (which is what authorization only transactions do). This is separate from refund because with Stripe, you cannot do a partial refund on an uncaptured transaction.
This patch is to be applied against the September 15th commit of the 7.x-1.x branch
Comment #5
torgosPizzaComment #6
MarieKirya CreditAttribution: MarieKirya commentedI was not able to apply this patch. Using Sourcetree, reported invalid diff file.
Comment #7
MarieKirya CreditAttribution: MarieKirya commentedI needed this functionality ASAP and couldn't use dev branch because of instability. I rerolled your patch to work against v1.0. I also fixed some formatting and made sure the diff was functioning.
Edit: this one has a improper root. Reuploading.
Comment #8
MarieKirya CreditAttribution: MarieKirya commentedComment #9
MarieKirya CreditAttribution: MarieKirya commentedOk, double checked that I applied from module root.
Comment #10
MarieKirya CreditAttribution: MarieKirya commentedMade another silly and left a change in there i didn't mean to leave. (A blank line to blank line)
Comment #11
aviindub CreditAttribution: aviindub commentedthis is awesome but its a bit more involved than i can spend the time to test right now. I would really appreciate if someone could give this a proper review and test.
Comment #12
angms-bh CreditAttribution: angms-bh as a volunteer commented@PavelAK, can you give me an idea of what you did to get the diff functioning? I am using Eclipse and followed the process, I thought, to make sure that the formatting and the patch would work. It looks fine in Eclipse, but the tabbing seems messed up when I create a patch. I am new to giving back to the community, so I need some guidance on what I am doing wrong.
Also, the 1.0 version does not contain the refund functionality that is in the dev version. You will probably want that functionality also since I only did void.
Comment #13
vincentdemers CreditAttribution: vincentdemers commentedThis patch should apply cleanly to 7.x-1.1
Thanks to everyone who helped with this feature.
Comment #14
aviindub CreditAttribution: aviindub commentedas with https://www.drupal.org/node/1875234...
theres a substantial amount of code here affecting the most security-sensitive part of this module. i'm sure this patch is awesome, but i just dont have the time to give it the review it needs before rolling out to the community.
sorry, i know that's a crappy answer.
Comment #15
darksnow CreditAttribution: darksnow as a volunteer commentedI'm in the process of reviewing a spec for a new site and I'm being asked about this functionality.
I'm not in a position to give this a proper test right now unfortunately, but I will if and when the site I'm building gets the go ahead.
I understand why aviindub said what he said but is there any chance that will be committed to the module at some point, and if possible, could I have a time scale?
Thanks for the great work on this module and this patch, as usual, the Drupal community come through :)
Comment #16
torgosPizzaPatch needs a re-roll for 3.x version of the API Library, and also some Drupal coding standards.
I'd like this feature (I'm looking at #1820356: Rule to capture from a previous authorization empty to help offload some of this to Commerce) and will try to find some time to hack on this.
Comment #17
Ollie222 CreditAttribution: Ollie222 commentedI think this is a useful feature and would like to see it added to Stripe v3.
Comment #18
dylf CreditAttribution: dylf at Acro Commerce commentedCleaned up the patch a bit and re-rolled against latest module version.
Comment #19
thejacer87 CreditAttribution: thejacer87 at Acro Commerce commentedfunctionally looks good, one thing i noticed was that in the payment tab, the auth has a refund button (see pic)
you get an error if you try to refund it (obviously), maybe get rid of that button altogether if it cant be used
Comment #20
dylf CreditAttribution: dylf at Acro Commerce commentedRemoved refund for auth_only transactions as suggested above.
Comment #21
eeprete CreditAttribution: eeprete commentedRookie question, but how can I enable this with my Stripe module?
Comment #22
torgosPizza@eeprete: You would need to apply this patch to your working copy (whether it's local or on a server) first . Hence why the status is "Needs review" - review will include making sure the patch applies cleanly, and then if it does what you expect and there are no problems or unexpected behavior.
You can read up on applying patches here for your testing. Please give the patch some testing and report back with your results!
Comment #23
eeprete CreditAttribution: eeprete as a volunteer commented@torgosPizza. Thanks. I'll attempt something this weekend, first full backup and then restore to a separate instance.
Comment #24
ron_s CreditAttribution: ron_s commentedCurrent patch does not apply cleanly against 7.x-3.x-dev. New version re-rolled for review.
Comment #25
ron_s CreditAttribution: ron_s commentedI'm sorry... I just realized I was applying patch #20 against an incorrect version of Commerce Stripe. #20 does apply cleanly against -dev.
#24 does have a few formatting changes that needed to be fixed in #20 (missing spaces, extra empty lines, etc.), but otherwise is the same.
Comment #26
torgosPizza@ron_s Sorry for the delay on this. I took a look, and it looks really good. I will commit this soon. Thanks so much!
Comment #27
torgosPizzaComment #28
torgosPizzaI had to re-roll against the latest dev, and made some fixes around whitespace/coding standards. Also the last hunk failed to apply for me, so I applied it manually.
Tested it and it works great.
Patch is attached. I will get this committed shortly.
Comment #30
torgosPizzaTested capture-only with a cart payment, a terminal payment, and a terminal refund, and it all works as expected. Switched back to auth+capture and it worked as well.
Committed to dev. Thanks everyone! Glad to see this finally make its way in.