1

I've created a custom payment method that uses a custom template file to provide several form fields on the checkout page. The purpose is to make a call to an API, sending the data captured with this form.

Some of the form data needs to be validated against certain rules. In my payment method model (which extends Mage_Payment_Model_Method_Abstract), how do I access the values posted via the custom form? Specifically within the validate and capture methods.

I'm not sure what code would be relevant to post here, but I am happy to provide whatever is necessary upon request. Thanks.

1

The OnepageController->savepaymentAction sends its data to the onepage->savePayment(). There the data is processed in the $quote->getPayment()->importData() function for you custom payment.

There are events triggered and you can throw Exception from there, whereby the step is never set to complete.

References:

  • Mage_Checkout_OnepageController->savePaymentAction
  • Mage_Checkout_Model_Type_Onepage->savePayment
  • Mage_Sales_Model_Quote_Payment->importData

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.