We have a whole bunch of contribution records to import into CiviCRM from our legacy database. The membership records already exist in CiviCRM. I can't find a way to link the new contribution records (to be imported) to the existing membership records. Is there a membership record no. that I could extract and use it to link the contribution record (to be imported) to the membership record.

If that is not an option, can I just import the contribution records without linking them to the membership records? The only downside I can see is I wouldn't be able to see the related contributions while I am on the membership screen. But they will all be visible in the Contributions screen.

I'd appreciate the community's thoughts on this. Thanks,

Raja Mukherjee

2 Answers 2


For the second part, yes - you can import the contributions Contributions > Import Contributions without linking to memberships which will then show under the Contributions tab.

Contributions are linked to memberships with MembershipPayment so when you have the membership id and contribution id you can link them with:

$result = civicrm_api3('MembershipPayment', 'create', array(
  'membership_id' => X,
  'contribution_id' => Y,

The challenge here is to get the right membership and contribution id's to pair up. You could tackle this in various ways including:

1) if you don't mind a bit of coding, write your own import script to create the Contribution, find the relevant Membership then create the MembershipPayment.

2) if you prefer GUI, import your contributions via the UI, export the contributions and memberships (to get the id's), do some spreadsheet manipulation to produce a csv of contribution and membership ids, then use the API CSV Importer extension to import these as MembershipPayments


If you do want to add the Contribution to a Membership then it would be worth looking at Fuzion's API CSV Import GUI extension

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.