Order API - Participant Status
Currently Order API does not allow setting participant or membership status. It is hardcoded to
Pending from incomplete transaction for participant and
Pending for Membership.
This is a problem for event cart which will use Order API per https://github.com/civicrm/civicrm-core/pull/17886 and needs to set
Pending from cart as status.
All other parameters for participant/membership can be passed through and will be set to whatever you set them to (or defaults if not set).
My view is that we don't need to put any restrictions in place on what the status can be set to. We are not talking about contribution status here - the two are independent. Any flow that "completes" a contribution will also complete any linked participants/memberships if they are not already "completed" but we hope to separate this logic more in the future as it doesn't work for everyone.
Over the last couple of years we've been progressively removing more and more restrictions within core about what can/can't be done (with memberships mostly) but also participants because any restriction in core restricts what can be done via extension/third-party integrations.
My proposal here is to remove the restriction on participant status when created/updated using Order API per: https://github.com/civicrm/civicrm-core/pull/18096 Note that you can pass a participant/membership ID in here but it will still get overwritten with the hardcoded status (so eg. a "completed" membership would get set to Pending and a "On waitlist" participant would get set to "pending from incomplete transaction").
I don't think we are going to run into the same issues that we do with contributions when changing statuses because the participant/membership entities don't have a whole set of financial accounting behind them.
Also note that, according to the docs here https://docs.civicrm.org/dev/en/latest/financial/orderAPI/#sample-ordercreate-for-single-event-registration until 5.20 the Order API created participants as
Registered by default.