Feature Requests
Share ideas, discuss and vote on requests from other users in community
 
This object is in archive! 

Developer - Gateway "_capture" function should support "pending" response

Nathan shared this idea 7 years ago
Under Consideration

The _Capture function currently only supports a "success" or "denied" response which is fine when the payment gateway is real time but certain payment methods (eg. Direct Debit) do not immediately return a 'success'.

The function should either support a "pending" state or allow a null response so that the _capture occurs transparently so that neither false "success" or "failure" emails are not generated and in the case of a "success" renewals are not automatically processed when the payment may later fail.

A "pending" state would require extract logic within WHMCS to handle subsequent switches from "pending" to "success" (paid) but would probably be the most flexible. If this is not possible a "null" response that triggers nothing would allow a callback to later trigger the addition of the transaction and auto renew domains, etc.

Comments (3)

photo
1

I agree with this request although I would like to change it to allow a false response. No need to make it pending as false with email suppression would be fine.

Change payment gateway _capture method to allow false response so no success/failure email is sent.

This would be useful for the following reasons:

1. When the gateway process will not be determined until later and need to consider it pending then wait for a callback to another gateway php file to make it completed in a separate process. The developer would be able to save to the database whatever he wants to recording a pending transaction then return false. The callback file would then do whatever it needs to do to complete the transaction.

2. Gateway module developers could use this to not perform the capture based on whatever their needs are such as: not use card on file for non hosting/domain invoices, not use card on file for non recurring charges, not use card on file for certain products/services, not use card on file for any other reason the gateway dev decides is useful.

I think forcing the card on file to be used for ALL invoices set to that payment method is a real problem and we should be able to limit it to recurring billing products only while still allowing a manual charge card ability from the invoice actions. I don't know a single client for any web hosting and development business that would want a web development invoice of $5000 to be auto charged. Another issue is when they go to the invoice and start to pay with that payment method that has a card on file but don't end up paying and leave the page...then the card will be auto charged because the payment method is changed by the client on mistake even though the admin user did not set that payment method for the invoice. Also when the default payment method is set to that method admins may mistakenly leave that set when creating an invoice then the card is auto charged.

This would be easy to implement and generally speaking when building a module you should give as much control to the developer as possible and not force the developer into a corner.

Regarding this portion of Nathan's request

A "pending" state would require extract logic within WHMCS to handle subsequent switches from "pending" to "success" (paid) but would probably be the most flexible. If this is not possible a "null" response that triggers nothing would allow a callback to later trigger the addition of the transaction and auto renew domains, etc.

I think having a pending transaction state in the database would be useful but WHMCS should only support that transaction state and should not handle any of the logic to set/update that state because all of that can be done in the payment module if we had the abilty to return false to the _capture request.

photo
1

I believe pending would be useful as a status where, for example, a client will not get payment reminders until the payment has a definitive success or failure status, or has passed some expiration date.

Not returning a status at all would also work, but then the customer would (I assume) still get all the payment reminders and overdue messages they would get if they never attempted to pay, which may become annoying if it happens every month.

photo
photo
1

I agree. This was causing me trouble while i was developing stripe recurring payment because when user subscribe to any plan the response will be received in callback (webhook for Stripe). So in _capture method i have to pass ERROR instead of PROCESSING.

It's quite annoying. I hope you guys understand how difficult is for developer to explain his client that his payment is under process not failed.