Answers.Body: <p>From the backtrace, you can see that the error is caused by a line in the <code>org.civicrm.multidomaininvoicing</code> extension.  I assume this is your extension?</p>
  
  <p><code>getvalue</code> is only appropriate if you're sure that a value exists; in this case, you made an API call for a value that doesn't exist.  If this is a possibility in your scenario, instead use <code>get</code> and search the <code>values</code> array for your result (with error handling to deal with a missing value.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-02-24T04:06:51.890Z
Answers.LastActivityDate: 2019-02-24T04:06:51.890Z
Answers.UserDisplayName: Jon G - Megaphone Tech
Body: <p>Civicrm Version 5.4.0
  <br><br>
  On New Participant Registration, I get an error "Expected one ParticipantPayment but found 0" when I try to register for an event which is not a paid event.</p>
  
  <p>CiviCRM_API3_Exception: "Expected one ParticipantPayment but found 0"</p>
  
  <pre><code> #0 C:\sites\default\files\civicrm\ext\org.civicrm.multidomaininvoicing\multidomaininvoicing.php(316):
   civicrm_api3("ParticipantPayment", "getvalue", (Array:4))
   #1 C:\sites\all\modules\civicrm\CRM\Utils\Hook.php(274): multidomaininvoicing_civicrm_postProcess("CRM_Event_Form_Participant",
   Object(CRM_Event_Form_Participant))
   #2 C:\sites\all\modules\civicrm\CRM\Utils\Hook\DrupalBase.php(84): CRM_Utils_Hook-&gt;runHooks((Array:69), "civicrm_postProcess", 2,
   "CRM_Event_Form_Participant", Object(CRM_Event_Form_Participant),
   NULL, NULL, NULL, NULL)
   #3 C:\sites\all\modules\civicrm\Civi\Core\CiviEventDispatcher.php(90): CRM_Utils_Hook_DrupalBase-&gt;invokeViaUF(2,
   "CRM_Event_Form_Participant", Object(CRM_Event_Form_Participant),
   NULL, NULL, NULL, NULL, "civicrm_postProcess")
   #4 [internal function](): Civi\Core\CiviEventDispatcher::delegateToUF(Object(Civi\Core\Event\GenericHookEvent),
   "hook_civicrm_postProcess", Object(Civi\Core\CiviEventDispatcher))
   #5 C:\sites\all\modules\civicrm\vendor\symfony\event-dispatcher\Symfony\Component\EventDispatcher\EventDispatcher.php(164):
   call_user_func((Array:2), Object(Civi\Core\Event\GenericHookEvent),
   "hook_civicrm_postProcess", Object(Civi\Core\CiviEventDispatcher))
   #6 C:\sites\all\modules\civicrm\vendor\symfony\event-dispatcher\Symfony\Component\EventDispatcher\EventDispatcher.php(53): Symfony\Component\EventDispatcher\EventDispatcher-&gt;doDispatch((Array:1),
   "hook_civicrm_postProcess", Object(Civi\Core\Event\GenericHookEvent))
   #7 C:\sites\all\modules\civicrm\vendor\symfony\event-dispatcher\Symfony\Component\EventDispatcher\ContainerAwareEventDispatcher.php(167):
   Symfony\Component\EventDispatcher\EventDispatcher-&gt;dispatch("hook_civicrm_postProcess",
   Object(Civi\Core\Event\GenericHookEvent))
   #8 C:\sites\all\modules\civicrm\Civi\Core\CiviEventDispatcher.php(47): Symfony\Component\EventDispatcher\ContainerAwareEventDispatcher-&gt;dispatch("hook_civicrm_postProcess",
   Object(Civi\Core\Event\GenericHookEvent))
   #9 C:\sites\all\modules\civicrm\CRM\Utils\Hook.php(164): Civi\Core\CiviEventDispatcher-&gt;dispatch("hook_civicrm_postProcess",
   Object(Civi\Core\Event\GenericHookEvent))
   #10 C:\sites\all\modules\civicrm\CRM\Utils\Hook.php(444): CRM_Utils_Hook-&gt;invoke((Array:2), "CRM_Event_Form_Participant",
   Object(CRM_Event_Form_Participant), NULL, NULL, NULL, NULL,
   "civicrm_postProcess")
   #11 C:\sites\all\modules\civicrm\CRM\Core\Form.php(516): CRM_Utils_Hook::postProcess("CRM_Event_Form_Participant",
   Object(CRM_Event_Form_Participant))
   #12 C:\sites\all\modules\civicrm\CRM\Core\Form.php(490): CRM_Core_Form-&gt;postProcessHook()
   #13 C:\sites\all\modules\civicrm\CRM\Core\QuickForm\Action\Upload.php(169):
   CRM_Core_Form-&gt;mainProcess()
   #14 C:\sites\all\modules\civicrm\CRM\Core\QuickForm\Action\Upload.php(136):
  CRM_Core_QuickForm_Action_Upload-&gt;realPerform(Object(CRM_Event_Form_Participant),
   "upload")
   #15 C:\sites\all\modules\civicrm\packages\HTML\QuickForm\Controller.php(203):
   CRM_Core_QuickForm_Action_Upload-&gt;perform(Object(CRM_Event_Form_Participant),
   "upload")
   #16 C:\sites\all\modules\civicrm\packages\HTML\QuickForm\Page.php(103):
   HTML_QuickForm_Controller-&gt;handle(Object(CRM_Event_Form_Participant),
   "upload")
   #17 C:\sites\all\modules\civicrm\CRM\Core\Controller.php(351): HTML_QuickForm_Page-&gt;handle("upload")
   #18 C:\sites\all\modules\civicrm\CRM\Event\Page\Tab.php(118): CRM_Core_Controller-&gt;run()
   #19 C:\sites\all\modules\civicrm\CRM\Event\Page\Tab.php(175): CRM_Event_Page_Tab-&gt;edit()
   #20 C:\sites\all\modules\civicrm\CRM\Core\Invoke.php(309): CRM_Event_Page_Tab-&gt;run((Array:3), NULL)
   #21 C:\sites\all\modules\civicrm\CRM\Core\Invoke.php(84): CRM_Core_Invoke::runItem((Array:15))
   #22 C:\sites\all\modules\civicrm\CRM\Core\Invoke.php(52): CRM_Core_Invoke::_invoke((Array:3))
   #23 C:\sites\all\modules\civicrm\drupal\civicrm.module(445): CRM_Core_Invoke::invoke((Array:3))
   #24 C:\includes\menu.inc(527): civicrm_invoke("participant", "add")
   #25 C:\index.php(22): menu_execute_active_handler()
   #26 {main}
  </code></pre>
  
  <p><a href="https://i.sstatic.net/Jx2j0.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/Jx2j0.png" alt="enter image description here"></a></p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-02-24T03:27:40.860Z
Comments.Text: Could you please turn on debugging and backtrace in **Administer menu » System Settings » Debugging and Error Handling** and repeat this?  You'll get a much more detailed message, which will help us help you.  Also, please copy/paste the text instead of a screenshot?  Finally, please edit your question to include the CiviCRM version.
Comments.UserDisplayName: Jon G - Megaphone Tech
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-02-24T03:52:32.213Z
Comments.Text: okay @JonG-MegaphoneTech
Comments.UserDisplayName: harshal
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-02-24T03:59:21.993Z
Comments.Text: updated @JonG-MegaphoneTech question
Comments.UserDisplayName: harshal
Tags: <civievent><participants>
Title: Expected one ParticipantPayment but found 0
ThreadText: # Expected one ParticipantPayment but found 0
  
  (Asked by: username_0 on 2019-02-24)
  
  Civicrm Version 5.4.0
    
    
  On New Participant Registration, I get an error "Expected one ParticipantPayment but found 0" when I try to register for an event which is not a paid event.
  
  CiviCRM\_API3\_Exception: "Expected one ParticipantPayment but found 0"
  
  ```
   #0 C:\sites\default\files\civicrm\ext\org.civicrm.multidomaininvoicing\multidomaininvoicing.php(316):
   civicrm_api3("ParticipantPayment", "getvalue", (Array:4))
   #1 C:\sites\all\modules\civicrm\CRM\Utils\Hook.php(274): multidomaininvoicing_civicrm_postProcess("CRM_Event_Form_Participant",
   Object(CRM_Event_Form_Participant))
   #2 C:\sites\all\modules\civicrm\CRM\Utils\Hook\DrupalBase.php(84): CRM_Utils_Hook->runHooks((Array:69), "civicrm_postProcess", 2,
   "CRM_Event_Form_Participant", Object(CRM_Event_Form_Participant),
   NULL, NULL, NULL, NULL)
   #3 C:\sites\all\modules\civicrm\Civi\Core\CiviEventDispatcher.php(90): CRM_Utils_Hook_DrupalBase->invokeViaUF(2,
   "CRM_Event_Form_Participant", Object(CRM_Event_Form_Participant),
   NULL, NULL, NULL, NULL, "civicrm_postProcess")
   #4 [internal function](): Civi\Core\CiviEventDispatcher::delegateToUF(Object(Civi\Core\Event\GenericHookEvent),
   "hook_civicrm_postProcess", Object(Civi\Core\CiviEventDispatcher))
   #5 C:\sites\all\modules\civicrm\vendor\symfony\event-dispatcher\Symfony\Component\EventDispatcher\EventDispatcher.php(164):
   call_user_func((Array:2), Object(Civi\Core\Event\GenericHookEvent),
   "hook_civicrm_postProcess", Object(Civi\Core\CiviEventDispatcher))
   #6 C:\sites\all\modules\civicrm\vendor\symfony\event-dispatcher\Symfony\Component\EventDispatcher\EventDispatcher.php(53): Symfony\Component\EventDispatcher\EventDispatcher->doDispatch((Array:1),
   "hook_civicrm_postProcess", Object(Civi\Core\Event\GenericHookEvent))
   #7 C:\sites\all\modules\civicrm\vendor\symfony\event-dispatcher\Symfony\Component\EventDispatcher\ContainerAwareEventDispatcher.php(167):
   Symfony\Component\EventDispatcher\EventDispatcher->dispatch("hook_civicrm_postProcess",
   Object(Civi\Core\Event\GenericHookEvent))
   #8 C:\sites\all\modules\civicrm\Civi\Core\CiviEventDispatcher.php(47): Symfony\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch("hook_civicrm_postProcess",
   Object(Civi\Core\Event\GenericHookEvent))
   #9 C:\sites\all\modules\civicrm\CRM\Utils\Hook.php(164): Civi\Core\CiviEventDispatcher->dispatch("hook_civicrm_postProcess",
   Object(Civi\Core\Event\GenericHookEvent))
   #10 C:\sites\all\modules\civicrm\CRM\Utils\Hook.php(444): CRM_Utils_Hook->invoke((Array:2), "CRM_Event_Form_Participant",
   Object(CRM_Event_Form_Participant), NULL, NULL, NULL, NULL,
   "civicrm_postProcess")
   #11 C:\sites\all\modules\civicrm\CRM\Core\Form.php(516): CRM_Utils_Hook::postProcess("CRM_Event_Form_Participant",
   Object(CRM_Event_Form_Participant))
   #12 C:\sites\all\modules\civicrm\CRM\Core\Form.php(490): CRM_Core_Form->postProcessHook()
   #13 C:\sites\all\modules\civicrm\CRM\Core\QuickForm\Action\Upload.php(169):
   CRM_Core_Form->mainProcess()
   #14 C:\sites\all\modules\civicrm\CRM\Core\QuickForm\Action\Upload.php(136):
  CRM_Core_QuickForm_Action_Upload->realPerform(Object(CRM_Event_Form_Participant),
   "upload")
   #15 C:\sites\all\modules\civicrm\packages\HTML\QuickForm\Controller.php(203):
   CRM_Core_QuickForm_Action_Upload->perform(Object(CRM_Event_Form_Participant),
   "upload")
   #16 C:\sites\all\modules\civicrm\packages\HTML\QuickForm\Page.php(103):
   HTML_QuickForm_Controller->handle(Object(CRM_Event_Form_Participant),
   "upload")
   #17 C:\sites\all\modules\civicrm\CRM\Core\Controller.php(351): HTML_QuickForm_Page->handle("upload")
   #18 C:\sites\all\modules\civicrm\CRM\Event\Page\Tab.php(118): CRM_Core_Controller->run()
   #19 C:\sites\all\modules\civicrm\CRM\Event\Page\Tab.php(175): CRM_Event_Page_Tab->edit()
   #20 C:\sites\all\modules\civicrm\CRM\Core\Invoke.php(309): CRM_Event_Page_Tab->run((Array:3), NULL)
   #21 C:\sites\all\modules\civicrm\CRM\Core\Invoke.php(84): CRM_Core_Invoke::runItem((Array:15))
   #22 C:\sites\all\modules\civicrm\CRM\Core\Invoke.php(52): CRM_Core_Invoke::_invoke((Array:3))
   #23 C:\sites\all\modules\civicrm\drupal\civicrm.module(445): CRM_Core_Invoke::invoke((Array:3))
   #24 C:\includes\menu.inc(527): civicrm_invoke("participant", "add")
   #25 C:\index.php(22): menu_execute_active_handler()
   #26 {main}
  
  ```
  
  [![enter image description here](https://i.sstatic.net/Jx2j0.png)](https://i.sstatic.net/Jx2j0.png)
  
  **Tags:** civievent, participants
  
  > **Comments:**
  > **username_1**: Could you please turn on debugging and backtrace in **Administer menu » System Settings » Debugging and Error Handling** and repeat this?  You'll get a much more detailed message, which will help us help you.  Also, please copy/paste the text instead of a screenshot?  Finally, please edit your question to include the CiviCRM version.  
  > **username_0**: okay @username_1  
  > **username_0**: updated @username_1 question  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2019-02-24. Score: 3 | Accepted answer
  
  From the backtrace, you can see that the error is caused by a line in the `org.civicrm.multidomaininvoicing` extension. I assume this is your extension?
  
  `getvalue` is only appropriate if you're sure that a value exists; in this case, you made an API call for a value that doesn't exist. If this is a possibility in your scenario, instead use `get` and search the `values` array for your result (with error handling to deal with a missing value.
  
  
  ---
  
  