Magento payment : additional_information or payment attribute?

I’m wondering which is the better way to add some information to a payment in magento (1.4.1.1).

Let’s say I want to add an information called “payment_duedate” which would be the date the customer has to pay his invoice.

Actually, there is a field in the sales_flat_order_payment called “additional_information” which contain serialized data set by the method setAdditionalInformation($arg1,$arg2); available in the ‘sales/payment’ model.
So I could save my date by :

$payment->setAdditionalInformation('payment_duedate',$myDate);
$payment->save();

But one could also choose to add a payment attribute, which would have as effect to create a new column called ‘payment_duedate’ in the ‘sales_flat_order_payment’ and then save my date by doing :

$payment->setPaymentDuedate($myDate);
$payment->save();

The main differences are :

  • with the “additional_information method”, datas are serialized, and so, not queryable easily.
  • with the “setPaymentDuedate() method”, datas are queryable and a new field is created in the table

So, in your opinion, which of the two ways is the best ?

Thanks, Hugues.

2 thoughts on “Magento payment : additional_information or payment attribute?”

  1. The setAdditionalInformation() is most useful for read-only attributes, such as a message to the user, like “Transaction Bank: MyBank”.

    The custom setPaymentDuedate() is useful for processing afters, like checking a payment status where Duedate > MMDDYY.

Leave a Reply

Your email address will not be published. Required fields are marked *