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.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

angms-bh created an issue. See original summary.

torgosPizza’s picture

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

angms-bh’s picture

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

angms-bh’s picture

Here 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

torgosPizza’s picture

Status: Active » Needs review
MarieKirya’s picture

I was not able to apply this patch. Using Sourcetree, reported invalid diff file.

MarieKirya’s picture

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

MarieKirya’s picture

MarieKirya’s picture

Ok, double checked that I applied from module root.

MarieKirya’s picture

Made another silly and left a change in there i didn't mean to leave. (A blank line to blank line)

aviindub’s picture

Priority: Normal » Major

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

angms-bh’s picture

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

vincentdemers’s picture

This patch should apply cleanly to 7.x-1.1

Thanks to everyone who helped with this feature.

aviindub’s picture

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

darksnow’s picture

I'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 :)

torgosPizza’s picture

Version: 7.x-1.x-dev » 7.x-3.x-dev
Assigned: Unassigned » torgosPizza
Status: Needs review » Needs work

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

Ollie222’s picture

I think this is a useful feature and would like to see it added to Stripe v3.

dylf’s picture

Status: Needs work » Needs review
FileSize
20.18 KB

Cleaned up the patch a bit and re-rolled against latest module version.

thejacer87’s picture

Status: Needs review » Needs work
FileSize
3.67 KB

functionally 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

dylf’s picture

Status: Needs work » Needs review
FileSize
20.53 KB
409 bytes

Removed refund for auth_only transactions as suggested above.

eeprete’s picture

Rookie question, but how can I enable this with my Stripe module?

torgosPizza’s picture

@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!

eeprete’s picture

@torgosPizza. Thanks. I'll attempt something this weekend, first full backup and then restore to a separate instance.

ron_s’s picture

Current patch does not apply cleanly against 7.x-3.x-dev. New version re-rolled for review.

ron_s’s picture

I'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.

torgosPizza’s picture

@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!

torgosPizza’s picture

torgosPizza’s picture

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

  • torgosPizza committed c665b6e on 7.x-3.x
    Issue #2600690 by MarieKirya, dylanf, torgosPizza, angms-bh, ron_s,...
torgosPizza’s picture

Status: Needs review » Fixed

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

Status: Fixed » Closed (fixed)

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