wrap `$paymentDetails` this way `$paymentDetails = ArrayObject:ensureArrayObject($paymentDetails)`;

this way it would not fail if $paymentDetails['order_id'] does not exist.