0

I'm using Simple Payments to handle PayPal processing in a module I'm building (See previous question).

The first part is fine -- it sends data to PayPal okay, but now that users can pay, I need to write the post-transaction handling code (which will ultimately store that the transaction succeeded in the database.). I'm supposed to use hook_simple_payment_process, but there's very little documentation. In its entirety:

/**
 * Passes a completed payment to the module that created it for processing.
 *
 * @param $payment
 *   A payment to be processed.
 *
 * @return
 *   TRUE if the payment was successfully processed.
 */
function hook_simple_payment_process($payment) {
}

What am I supposed to do with this...?

Thanks!

1

You need to process the payment. In your case you could mark that the invoice has been paid, maybe in storm or a custom table. $payment should hold all the info about the payment that you need. I guess some of the info depends on your module as well.

Anyways when you have processed the payment you should return TRUE which will make the simple payment module mark that payment as being processed. I imagine that there is an interface that will allow you to see if a payment hasn't been processed, which would happen if an error occurred while processing.

  • That's totally what I need to do -- thanks for pointing me in the right direction. Alas, it seems Simple Payments breaks at some point in the execution cycle and doesn't store the payment data in the DB, though I am able to receive a successful response from PayPal and currently have it printing to log. The dev isn't responding to his issues queue, which is somewhat worrisome... – aendrew May 9 '11 at 22:06
  • I take it back, was just able to figure out the issue and everything's working. The problem with that module is mainly that there isn't very good error handling; it simply returns out of the function without telling anything. Works great otherwise, though. – aendrew May 10 '11 at 0:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.