Getting Moltin\Entities\Order object from order ID


#1

I’m currently converting from cart -> order in browser javascript of my checkout page, and I’m then passing order ID to PHP to process credit card payment.

I’d like to use manual gateway to mark order as paid, but it seems there is no way to get Moltin\Entities\Order object from order ID. I need Moltin\Entities\Order to be able to call order->pay() function.

The only way to get Moltin\Entities\Order object seems to be: get the cart and then call checkout(), which means I’ll have to move cart -> order conversion from client javascript to server PHP.

Is there any other way to get Moltin\Entities\Order from order ID using Moltin PHP SDK?


#2

Meanwhile, I have managed to figure out a way to do the above - maybe it’ll be useful for others:

    $order_entity = new Moltin\Entities\Order($moltin);
    $order_entity->setData($order);
    $order_entity->setID($order->id);
    $response2 = $order_entity->pay("manual", "authorize", array());