Why recurring order becomes completed immediatelly after payment (no fulfillment status)? I'm using Commerce datatrans module which originally supports only offsite payments. However I added extra functionality for recurring payment and it works well.
Only issue I have is that when method createPayment() I added is called by cron job and payment is made that order gets status &quot;Completed&quot;.
For default types of orders (non-recurring ones) they have status &quot;Fulfillment&quot; so when all items are shipped order status can manually be changed to &quot;Completed&quot;. I expected same thing with recurring orders.
In createPayment() function I added code I found on official documentation for that method:
$next_state = $capture ? 'completed' : 'authorization';
$payment-&gt;setState($next_state);
$payment-&gt;setRemoteId($transaction[&quot;uppTransactionId&quot;]);
$payment-&gt;setExpiresTime(strtotime('+5 days'));
$payment-&gt;save();

Not sure should I change order status from that method. But again some other code is changing it form &quot;Draft&quot; to &quot;Completed&quot;.
So my question is why it's not changed to &quot;Fulfillment&quot; but to &quot;Completed&quot; as soon as payment is done?
So my question is why it's not changed to &quot;Fulfillment&quot; but to
&quot;Completed&quot; as soon as payment is done?

Because you're setting it to completed, the code you found is just an example.
For your case, it needs to be:
$next_state = $capture ? 'fulfillment' : 'authorization';