Gateway modules can allow a number of transaction types, including auth-only, auth-capture, and reference set, but uc_credit filters the list to only allow auth-only and auth-capture. This requires you to authorize > $0.00 at checkout (at least, for gateways that throw an error on a $0.00 charge).

This patch keeps uc_credit from removing reference set as an option (if the gateway module supports it). It would allow sites to just create a reference at checkout for later charges. Use case is for recurring fees with a free trial period (ex: product price $0.00, charge $x.xx every month beginning after 1 month).

Comments

tr’s picture

I think this is an important change that could help recurring charges a lot. A few questions:

Why add just UC_CREDIT_REFERENCE_SET? What about the other 6 options that are filtered out?

Does uc_credit support storing the reference number and re-using it when ready to capture, or would this have to be handled by each gateway separately as it's done now with recurring fees? I think if these options are added to uc_credit then uc_credit should contain the default functionality to handle these options. The same argument would apply to enabling UC_CREDIT_VOID - if it's allowed in uc_credit, uc_credit should have code to deal with voids.

rstaylor’s picture

Good questions.

I only added reference set because that's the specific use case I'm dealing with, and it makes sense at checkout time in some cases. I thought about the others, but five of them don't seem to make sense in the context of being triggered by the customer at checkout time: UC_CREDIT_PRIOR_AUTH_CAPTURE, UC_CREDIT_REFERENCE_REMOVE, UC_CREDIT_REFERENCE_CREDIT, UC_CREDIT_CREDIT, UC_CREDIT_VOID. The sixth, UC_CREDIT_REFERENCE_TXN, is an iffy case - ideally, if a customer has a card on file with you, you could let them choose to use it at checkout time. But I don't think that the current system works that way - it appears that references are order-specific rather than customer-specific. Rearchitecting that would be a bigger issue than a one-line patch.

To the other question, uc_credit has the uc_credit_log_reference() function to store the reference, and uc_credit.admin.inc has the admin interface to list, charge, delete existing references. The gateway module has to handle actually creating or processing them, but uc_credit is not unaware of references. I'm not sure that it should contain additional functionality, I just think that it shouldn't prevent people from using the gateway module's functionality when it makes sense (and that in this case, it makes sense to use it during checkout).

tr’s picture

Status: Needs review » Reviewed & tested by the community

To the other question, uc_credit has the uc_credit_log_reference() function to store the reference, and uc_credit.admin.inc has the admin interface to list, charge, delete existing references. The gateway module has to handle actually creating or processing them, but uc_credit is not unaware of references.

Sounds good to me. My concern was that IF the reference storage and use was left up to the individual gateways, there would be all sorts of replicated code and a proliferation of gateway-specific tables. But since it's already in uc_credit, that's not a problem, that's the right way to go.

+1 vote from me. Marked as RTBC.

brettev’s picture

So I have a follow up question. We have a free trial that we want to charge 2 weeks later. We're offering a zero price product, and then charging the 9.99 using the recurring feature. we also have some products that people buy that aren't recurring, and we would want those to be charged on their card right when they buy them. by putting this flag set to reference only, are we setting it so it never does the actual capturing? do we have to do that manually? does it batch them later or anything? a little clarification on how this works with the recurring fee and other normal products would be great. Thanks!

brettev’s picture

sorry, got a varnish error. didn't see the dupe post.

So I have a follow up question. We have a free trial that we want to charge 2 weeks later. We're offering a zero price product, and then charging the 9.99 using the recurring feature. we also have some products that people buy that aren't recurring, and we would want those to be charged on their card right when they buy them. by putting this flag set to reference only, are we setting it so it never does the actual capturing? do we have to do that manually? does it batch them later or anything? a little clarification on how this works with the recurring fee and other normal products would be great. Thanks!

rstaylor’s picture

This only affects the options available for the default setting. I believe that default setting is always used (if not overridden by custom coding). So if you select 'Set a reference only', that's what it will always do unless you add custom code. I think you would need to create some custom code to, for instance, determine what type of transaction to do based upon the products in the cart (ex: if the cart only has products of type A, set a reference, if it's only this type, then authorize only, otherwise auth and capture).

And yes, a reference transaction means "don't charge the card, just give me a reference number that I can use to try to charge it any amount at any time later, without having to store the card number". The reference numbers are specific to your gateway account, so that if your data gets compromised, someone else can't use the reference number the way they could a card number. So it doesn't do any actual capturing, nor does it batch them or anything. You'll need some other code (or manual process) to do that.

In my case, we had custom code that was called by the recurring module to charge varying amounts depending on discounts, upgrades, etc. at the recurring interval. This patch doesn't do any of that, it just allows an admin setting so that we could avoid having to further override (or rather hack) the core functionality to avoid that first charge but still keep info (the reference) about the CC for the custom code to use later. There is a module for $0.00 orders that ignores the CC entirely, but that wouldn't work for us because then we wouldn't have the reference for future charges.

Island Usurper’s picture

Status: Reviewed & tested by the community » Fixed

**Sees the date this issue was set RTBC and winces.**

Thanks. Committed.

longwave’s picture

Status: Fixed » Patch (to be ported)

Needs porting to 7.x.

Island Usurper’s picture

Version: 6.x-2.1 » 7.x-3.x-dev
Status: Patch (to be ported) » Fixed
StatusFileSize
new501 bytes

Ported and committed, since it's such a simple patch.

longwave’s picture

Status: Fixed » Reviewed & tested by the community

That patch does not appear to be in CVS.

Island Usurper’s picture

Status: Reviewed & tested by the community » Fixed

Oops. Committed to CVS now.

Status: Fixed » Closed (fixed)

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