Discussions

Setting a transaction ID

Hello everyone,
I am writing an offsite payment method module. Part of what is sent to the payment service is the payment transaction ID which I can get after calling commerce_payment_transaction_new ( METHOD_ID, ORDER_ID ).

The payment service requires that transaction ID sent to must between 6 and 50 characters long. However, transaction IDs by Commerce are serial and so start by being less than 6 characters for a long time.

So I was wondering: is there a way to set the transaction ID as the transaction is created?

I'll be glad for any help.

Feyisayo

Posted: Aug 7, 2013

Comments

Feyisayo on August 8, 2013

What I did was to left-pad the transaction ID to 6 characters before passing it to the payment service. So a transaction ID of '12' will be sent as '000012'.

I hope someone finds this useful