0

I am working on an extension which requires me to use Civi Contribute.Yet i have not tried anything yet as i don't now the approach, so i wish to obtain the details of a particular contribution transaction such as total_amount, email ... so that i can use it in the extension, I have thought of using an API method but i am not clear of the details and if at all that is what i have to use. Something like the content of $params?

  • Not too sure what you're asking. If you're writing an extension, have you tried writing business logic developed using skeletons in $your_domain/civicrm/api ? – DMCoding Jul 18 '16 at 8:26
  • It also seems like you might wanna read up on the API and its invocation first... – DMCoding Jul 18 '16 at 8:27
  • It might be helpful if you provide more details about what you're trying to do -- for example, are you trying to alter details of a contribution before it's created? after a form is submitted? after it's created? during a particular workflow? In an extension, the API would be used to interact with the existing contribution, but it sounds like you're first issue is trying to determine what hook to work with. – lcdservices Jul 18 '16 at 11:46
1

I think you are looking for the API getfields action? In the API explorer you can do a getfields and it will show you the possible fields for the API.

1

Using the API is the recommended way to access CiviCRM information from an extension, so you are on the right tracks. You can study https://github.com/cividesk/com.cividesk.cardreader/blob/master/CRM/Cardreader/Page/Callback.php#L50 for an example on how to call the CiviCRM API. You need to read https://wiki.civicrm.org/confluence/display/CRMDOC/API+Reference and use the API explorer to get familiar with the API. You can access the API explorer by using the slug civicrm/api/explorer on your CiviCRM instance.

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.