2

I'm building a software system that uses CiviCRM as a membership database and a billing engine for recurring dues. Our members do not have direct access to CiviCRM or the server on which it runs, and the software I'm writing can only communicate with CiviCRM through CiviCRM's REST API.

My signup flow needs to perform the following steps:

  1. Create a contact in CiviCRM
  2. Collect payment information and retreive an iATS token
  3. Pass that token to CiviCRM, and associate it with the contact.
  4. Record, somehow, whether the prospective member wants a monthly, biannual, or annual membership. Important: At this point, CiviCRM must not activate a membership or charge money.
  5. Wait for a period of time, potentially days, for some offline stuff to happen.
  6. Finally, process payment and activate the membership.

Again, all of this has to happen through the REST API. The software that processes signups cannot use CiviCRM's forms and cannot read or write to CiviCRM's database directly.

Is what I want to do possible without writing custom CiviCRM extensions?

From looking at the V3 endpoints for the iATS extension, I see code that lets me get information out of CiviCRM, but no way to get payment information in. What am I missing?

Edit: In retrospect, this might not be clear: I don't want to write my own CRM -- I just want to use CiviCRM as our CRM and only interact with it through its REST API. If, for instance, my custom software is decommissioned or replaced, I want CiviCRM to keep on storing and processing memberships without having to migrate data from one custom webapp to the next. I can do most of what I need to do through the V3 API, but membership signup seems to be a more complicated problem.

  • The iATS extension does not expose any api functions for assigning iATS "payment tokens" to contacts (not to be confused with CiviCRM tokens, a completely different thing). The next version of the iATS extension (1.7) will use the CiviCRM standard payment token mechanism, so you can assign them that way. You did check the super-awesome api explorer, yes? It makes using the api so much more fun. Also, if you look at this file: github.com/iATSPayments/com.iatspayments.civicrm/blob/master/… you might find some useful code for your purposes. – Alan Dixon Oct 22 at 20:35
  • @AlanDixon Thank you! This is exactly what I want to know. If you post this as an answer to the question, I will accept it. – Stephen Van Dahm Oct 24 at 23:22
1

The iATS extension does not expose any api functions for assigning iATS "payment tokens" to contacts (not to be confused with CiviCRM tokens, a completely different thing).

The next version of the iATS extension (1.7) will use the CiviCRM standard payment token mechanism, so you can assign them that way.

You did check the super-awesome api explorer, yes? It makes using the api so much more fun.

Also, if you look at this file ... https://github.com/iATSPayments/com.iatspayments.civicrm/blob/master/CRM/Iats/Transaction.php

... you might find some useful code for your purposes.

0

CiviCRM does support REST API - where you can get/create information in Database using REST API

To access civicrm API: In the menu click support -> Developer -> Api Explorer v3

https://dmaster.demo.civicrm.org/civicrm/api#explorer

Example:

https://dmaster.demo.civicrm.org/sites/all/modules/civicrm/extern/rest.php?entity=Contact&action=create&api_key=userkey&key=sitekey&json={"contact_type":"Individual","first_name":"test","last_name":"test","display_name":"test"}

In order to use Rest Api you need to know the Sitekey, API_key and site URL - see the example.

Reference:

API Documentation: https://docs.civicrm.org/dev/en/latest/api/interfaces/

If I am not wrong Are you trying use civicrm payment processor in your third-party application then i guess you need to create a payment process supporting your third-party application separately- I don't think you can use CiviCRM Payment processor in your other application directly

I hope this helps !!!

  • I'm not trying to build my own CRM -- I want CiviCRM to be my CRM. I just want to use CiviCRM entirely through its REST API, and membership signup appears to be an obstacle. – Stephen Van Dahm Oct 17 at 15:37
  • Hi @StephenVanDahm I didn't say you are trying to build your own CRM - I said it is possible to use REST API to access CiviCRM - I had used this in many application like outlook, PHP website etc - If you need to know membership signup please let us know the issue you are facing with some example - sure me or someone will help – Ramesh - ARTECH Consultancy Oct 18 at 17:08
0

You can access pretty much all entities (both read and write) in civi via the api (rest api) as soon as you have set up the keys

they are some thin wrappers around these api calls (for php, nodejs and I think python)

It is completely possible to have a UI on a different server that interact to civi in the background through that API.

However, most of the API is CRUD, ie rather low level and for core entities only. Some extensions offer more apis for their own entities, some others will need you to contribute the missing code to make these apis happen. I'm not familiar enough with iATS to be sure, but it looks that some api aren't there to create tokens

As for writing custom extensions: I found that it is often more convenient to have custom APIs that are including some business logic and creating the membership and contact and whatever is needed within a single call rather than having to implement that logic on the client side and chain rest calls.

As you've seen from the link to the iATS, creating a new API is "simply" a matter of putting the right file at the right place and it will automatically be accessible via the REST interface.

I don't know enough about your use case, but I would suggest you to evaluate creating your own API, it's fairly easy and can be quite a time saver

X+

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.