2

I am using a script that creates a MembershipPayment to connect an existing Membership to an existing Contribution (bugfix for CiviSepa). This script produces the following error:

Deprecated: Not having valid line items for membership payments is invalid. Caller: CRM_Contribute_BAO_Contribution::updateMembershipBasedOnCompletionOfContribution

In order to fix this, I thought I should switch to create the MembershipPayment via Order API instead of using

civicrm_api3('MembershipPayment', 'create', [...]);

In the CiviCRM documentation, it is clearly recommended to use the Order API for managing Contributions, Memberships etc. At the same time, it is also recommended to use APIv4 instead of APIv3 for all future projects: "APIv3 is now minimally maintained with no new features and regression bug-fixes only. Your code can use a combination of v3 and v4 API calls, but v4 is recommended for all new projects."

The problem is that the Order API doesn't even exist in API v4. I cannot choose the entity Order from the drop down menue in APIv4 Explorer.

Where does this contradiction come from? Which advice should I follow?

1

1 Answer 1

2

The advice to use Order API is still sound and should be followed. As of this post it has not yet been ported to APIv4 so you'll have to use v3 until that work is complete. Progress on the port can be tracked at GitLab: Apiv4 Order api.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.