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) »
  • Managing Pledges Completely from the API
Pages: [1]

Author Topic: Managing Pledges Completely from the API  (Read 728 times)

fen

  • I post frequently
  • ***
  • Posts: 216
  • Karma: 13
    • CivicActions
  • CiviCRM version: 3.3-4.3
  • CMS version: Drupal 6/7
  • MySQL version: 5.1/5.5
  • PHP version: 5.3/5.4
Managing Pledges Completely from the API
August 10, 2011, 09:21:44 am
Client collects donations via a specialized "Web Store" server and is importing the transactions into CiviCRM using custom code. (Yes, would be much easier if they used CiviCRM maybe with ubercart integration for their Web Store but so it goes...) Some of the donations are monthly pledges, usually for 2-year time periods.  By reading in daily Authorize.net reports (more custom code) they want to import the status of current pledges (or time-limited recurring payments?) including how many payments made, how many more to go, credit cards nearing expiration and when the transactions fail (e.g., from credit card expiration or other causes).  Client wants a monthly report of the failed attempts and/or cards near expiration and email those people.

It seems to me that creating a Pledge with the first Contribution, followed by additional PledgePayments would work well for this.  I don't think a "Recurring Contribution" is needed, as that would expect to actually be attached to e.g. Authorized.net.  And some custom reports for the staff may be needed.

The API Explorer exposes CiviContribute, Pledge and PledgePayment APIs, so I think this may not be that difficult (thanks, API team!).  One issue will be differentiating automatic Pledge payments from other one-off donations, but I think the Authorize.net ARB report contains that information.

Does this seem reasonable?  Do I need recurring contributions?  What "gotchas" should I watch out for?  Has anyone else done this that you could point me to so that I might get some hints?

Eileen

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4195
  • Karma: 218
    • Fuzion
Re: Managing Pledges Completely from the API
August 10, 2011, 10:43:08 am
Hi,

I have done quite a few pledge imports - basically when you do a pledge create the pledges the pledge payments get created & you just need to update them with the contribution id later. I have been using migrate module as a wrapper & these are the bits relevant to pledge import (code ain't pretty but I haven't had to look at it for a while so I guess it's working).


https://svn.fuzion.co.nz/repos/fuzion-code/trunk/drupal/modules/custom/civimigrate/civimigrate.pledge.inc

https://svn.fuzion.co.nz/repos/fuzion-code/trunk/drupal/modules/custom/civimigrate/civimigrate.contribution.inc

Pledge API is still pretty hairy - mostly because the BAO randomly prefers unique names or db names for fields & not all the places have been spotted yet.
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

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion »
  • APIs and Hooks (Moderator: Donald Lobo) »
  • Managing Pledges Completely from the API

This forum was archived on 2017-11-26.