Marking payment as complete with a hook

Hi all

I’m bouncing around the docs and honestly having trouble understanding the way some of it is written :confused:

I’m working on an add-on that processes direct debit (non-US equivalent of ACH) payments. Intended flow is this:

  • Payment submitted, defaults to add_pending_payment
  • Add-on schedules an action to check with the bank nightly on the status of the debit
  • When transaction is no longer pending, status is changed to either complete_payment or fail_payment

I’m struggling with what hooks to get my scheduled action to call, to change the status of the payment after the fact ???

Could someone please point me to the right hook to use?

Thanks :slight_smile:

Take a look at GFAPI::update_entry_property:

You would call that function whenever you want to update the payment status.

1 Like

Perfect, thanks! The only other thing along this line I’m struggling with is in my authorize() function, rendering the payment as pending rather than complete.
Currently, for a pending payment I’m returning this array:

$result = array(
			'is_authorized'		=> true,
			'error_message'		=> $responseMessage,
			'transaction_id'	=> $transactionID,
            'captured_payment'  => array(
				'is_success'		=> true,
				'error_message'		=> $responseMessage,
				'transaction_id'	=> $transactionID,
				'amount'			=> $transactionAmount
			);
		);

But it seems that if is_authorized or is_success are false, the payment is marked as failed, and there’s no in between…?
Whereas if i mark them as true then change the payment status, I’m going to trigger both the payment complete and payment pending notification actions… I think?
I hope I’m making sense

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.