I register participants and payments via the API. Step 1: create a contribution for the buyer Step 2: create participants Step 3 create participant_payments linking the above.

The weird thing is that civi adds a line to the fee_level of the first participant stating "Contribution Amount: 1". screenshot

Why? Am I doing something wrong?

Following the suggestion of Jon G I have been able to pin this down to something related to price sets. Participants of events that do not use price sets do not get this "contribution amount: 1"-line.

Kind regards,


The api calls:

1) create participant:

public function createParticipant($civiEventId, $contactId, $customFields = [], $amount, $currency, $fee_level) {
$entity = 'Participant';
// Create filter.
$params = [
  'event_id' => $civiEventId,
  'contact_id' => $contactId,
  'status_id' => "Registered",
  'participant_role_id' => "deelnemer",
  'participant_fee_level' => $fee_level,
  'participant_fee_amount' => $amount,
  'participant_fee_currency' => $currency
if (count($customFields) > 0 && is_array($customFields)) {
  foreach ($customFields as $customFieldKey => $customFieldValue) {
      $customId = "custom_".$customFieldKey;
    } else {
      $customId = $customFieldKey;
    $params[$customId] = $customFieldValue;
$action = "create";

return $this->query($entity, $params, $action);


2) create contribution

public function createContribution($financial_type, $total_amount, $civi_id, $mollie_id, $date) {
$entity = 'Contribution';
$action = 'create';
// Create filter.
$params = [
  'financial_type_id' => $financial_type,
  'total_amount' => $total_amount,
  'contact_id' => $civi_id,
  'custom_100' => $mollie_id,
  'receive_date' => $date,
  'currency' => "EUR",
  'source' => "Chiro.be via mollie",
return $this->query($entity, $params, $action);


3) create participantPayment

public function createParticipantPayment($participant_id, $contribution_id) {
$entity = 'ParticipantPayment';
$action = 'create';
// Create filter.
$params = [
  'participant_id' => $participant_id,
  'contribution_id' => $contribution_id,
return $this->query($entity, $params, $action);


using version 4.7.27.

  • More specifics: I pay for two particpants. I am not a particpant myself. Dec 14, 2017 at 15:36
  • I tested with myself as payer and participant but still the extra line gets added to the first participant (alphabetically?). i would have expected that the line got added to the paying-participant. Dec 14, 2017 at 15:47
  • I tried but could not replicate this. Could you please a) indicate what version of CiviCRM you're using? b) show your API calls? You may want to consider using the API Explorer (Support » Developer » API Explorer) on the sandbox (dmaster.demo.civicrm.org) to see if the problem exists in CiviCRM itself. Dec 14, 2017 at 16:31
  • Thanks for the suggestion. I have added it to the question. Dec 15, 2017 at 13:23
  • This is more a suggestion as I don't have quite an answer but I believe this behavior is due the way the Contribution is created via the API or rather how it creates the first Line item, which from what I understand takes the Price Field from the default_contribution_amount Price Set. There might be a param that I don't know of that you can pass to specify the Line Item? Meanwhile I suggest you have a look at the Order API, specifically this example.
    – Andrei
    Dec 18, 2017 at 11:46

1 Answer 1


This is not a right way of adding participant with contribution associated with it. When there is payment associated with Participants than we need to specify line items in create Participant and/or Contribution api. I would suggest to use Order api to achieve your needs as it is straight forward and handles in convenient way for adding payments in CiviCRM.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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