CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion »
  • APIs and Hooks (Moderator: Donald Lobo) »
  • Possible to make payments (donations, event registration payment) via API calls?
Pages: [1]

Author Topic: Possible to make payments (donations, event registration payment) via API calls?  (Read 1625 times)

inteja

  • I’m new here
  • *
  • Posts: 1
  • Karma: 0
  • CiviCRM version: 4.2
  • CMS version: Drupal 7
  • MySQL version: 5
  • PHP version: 5
Possible to make payments (donations, event registration payment) via API calls?
March 26, 2013, 09:43:03 pm
Is it possible to make payments (donations, event registration payment) via CiviCRM API calls?

I need my form to "talk" to an external CiviCRM installation via the API and I'm not sure if it's possible to trigger payment processing externally like this.

Are there any other pitfalls  / limitations in using the CiviCRM API that I should be aware of?

Eileen

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4195
  • Karma: 218
    • Fuzion
Re: Possible to make payments (donations, event registration payment) via API calls?
March 26, 2013, 11:28:45 pm
Yes, it's definitely possible - read up here

http://book.civicrm.org/developer/current/techniques/api/

In general the api is probably the most heavily tested part of CiviCRM - but I would certainly encourage you to check out the test suite & add contribute to it to ensure that the way you use it is comprehensively covered.
Make today the day you step up to support CiviCRM and all the amazing organisations that are using it to improve our world - http://civicrm.org/contribute

adixon

  • I post frequently
  • ***
  • Posts: 314
  • Karma: 19
    • Blackfly Solutions
Re: Possible to make payments (donations, event registration payment) via API calls?
August 07, 2013, 08:56:03 am
I wonder if this answer isn't a bit too much wishful thinking? As far as I can see, there isn't much in the api as far as payment processing goes [a reflection of the overall payment processing code base].

I seem to recall a few years ago that lobo did a bit of refactoring to enable mozilla or wikimedia to create their own payment forms, but I don't think that got beyond the one-off example.

But this does seem like it should be the correct answer.

xavier

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4453
  • Karma: 161
    • Tech To The People
  • CiviCRM version: yes probably
  • CMS version: drupal
Re: Possible to make payments (donations, event registration payment) via API calls?
August 07, 2013, 09:24:27 am
Can you clarify what you mean by payment processing? if it's about recording a payment (contribution/participant...) it's there and available from the api.

If it's about integrating with external payment providers to debit the card for real, it's very much specific to each payment provider and indeed not available from our API, but I'm not sure how it would be possible anyway as each of them is likely to have different apis and way of working (some don't even provide apis)

I'd suggest to check with the payment provider you use see what api they offer, and use our api to record the contribution/donor/whatever else you want

X+
-Hackathon and data journalism about the European parliament 24-26 jan. Watch out the result

Eileen

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4195
  • Karma: 218
    • Fuzion
Re: Possible to make payments (donations, event registration payment) via API calls?
August 07, 2013, 02:25:02 pm
There is an api contribute.transact that takes credit card details & processes them. No idea if it works but Coleman is currently working on that for webform.
Make today the day you step up to support CiviCRM and all the amazing organisations that are using it to improve our world - http://civicrm.org/contribute

charles_campbell

  • I’m new here
  • *
  • Posts: 3
  • Karma: 0
  • CiviCRM version: 4.3.5
  • CMS version: Joomla 3.1
  • MySQL version: 5.0.77
  • PHP version: 5.3
Re: Possible to make payments (donations, event registration payment) via API calls?
September 04, 2013, 04:34:40 pm
I had a similar need to submit a contribution along with sending to payment processor and stumbled upon this thread.  I can confirm the API for 'contribution.transact' works perfectly for handling both tasks of submitting a contribution and passing on to the payment processor using an API call:

Code: [Select]
               $financialTypeId = 3;
                $paymentInstrumentId = 1;
                $contributionStatusId = 1;

                // Send payment to payment processor
                $transaction = array();
                $trxn_id = '';
                $invoice_id = '';
                $source = '';

                $params = array(
                                'contact_id' => $params['contact_id'],
                                'receive_date' => date('ymd'), //'20120511',
                                'amount' => $params['amount'],
                                'financial_type_id'      => $financialTypeId,
                                'payment_instrument_id' => $paymentInstrumentId,
                                //'non_deductible_amount' => 10.00,
                                //'fee_amount' => 50.00,
                                //'trxn_id' => $trxn_id,
                                //'invoice_id' => $invoice_id,
                                'payment_processor_id' => 1,
                                'source' => $source,
                                'contribution_status_id' => $contributionStatusId,
                                'version' => 3
                               );

                $contribution = civicrm_api('contribution', 'transact', $params);

Although I noticed this API call doesn't show up in the API Explorer: http://civicrm.org/API_version_3

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion »
  • APIs and Hooks (Moderator: Donald Lobo) »
  • Possible to make payments (donations, event registration payment) via API calls?

This forum was archived on 2017-11-26.