Answers.Body: <p>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). </p>
  
  <p>The next version of the iATS extension (1.7) will use the CiviCRM standard payment token mechanism, so you can assign them that way. </p>
  
  <p>You did check the super-awesome api explorer, yes? It makes using the api so much more fun. </p>
  
  <p>Also, if you look at this file ...
  <a href="https://github.com/iATSPayments/com.iatspayments.civicrm/blob/master/CRM/Iats/Transaction.php" rel="nofollow noreferrer">https://github.com/iATSPayments/com.iatspayments.civicrm/blob/master/CRM/Iats/Transaction.php</a></p>
  
  <p>... you might find some useful code for your purposes.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-10-25T15:21:14.070Z
Answers.LastActivityDate: 2019-10-25T15:21:14.070Z
Answers.UserDisplayName: Alan Dixon
Answers.Body: <p>CiviCRM does support REST API - where you can get/create information in Database using REST API</p>
  
  <p><strong>To access civicrm API:</strong> 
  In the menu click support -> Developer -> Api Explorer v3</p>
  
  <p><a href="https://dmaster.demo.civicrm.org/civicrm/api#explorer" rel="nofollow noreferrer">https://dmaster.demo.civicrm.org/civicrm/api#explorer</a></p>
  
  <p>Example: </p>
  
  <pre><code>https://dmaster.demo.civicrm.org/sites/all/modules/civicrm/extern/rest.php?entity=Contact&amp;action=create&amp;api_key=userkey&amp;key=sitekey&amp;json={"contact_type":"Individual","first_name":"test","last_name":"test","display_name":"test"}
  </code></pre>
  
  <p>In order to use Rest Api you need to know the Sitekey, API_key and site URL - see the example.</p>
  
  <p><strong>Reference:</strong></p>
  
  <p><strong>API Documentation:</strong> <a href="https://docs.civicrm.org/dev/en/latest/api/interfaces/" rel="nofollow noreferrer">https://docs.civicrm.org/dev/en/latest/api/interfaces/</a></p>
  
  <p><strong>If I am not wrong</strong> 
  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</p>
  
  <p>I hope this helps !!!</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-10-17T15:37:39.450Z
Answers.Text: 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.
Answers.UserDisplayName: Stephen Van Dahm
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-10-18T17:08:29.063Z
Answers.Text: 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
Answers.UserDisplayName: Ramesh - ARTECH Consultancy
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-10-17T09:46:46.723Z
Answers.LastActivityDate: 2019-10-17T09:46:46.723Z
Answers.UserDisplayName: Ramesh - ARTECH Consultancy
Answers.Body: <p>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</p>
  
  <p>they are some thin wrappers around these api calls (for php, nodejs and I think python)</p>
  
  <p>It is completely possible to have a UI on a different server that interact to civi in the background through that API.</p>
  
  <p>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</p>
  
  <p>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.</p>
  
  <p>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.</p>
  
  <p>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</p>
  
  <p>X+</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-10-18T07:45:11.270Z
Answers.LastActivityDate: 2019-10-18T07:45:11.270Z
Answers.UserDisplayName: Xavier
Body: <p>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.</p>
  
  <p>My signup flow needs to perform the following steps:</p>
  
  <ol>
  <li>Create a contact in CiviCRM</li>
  <li>Collect payment information and retreive an iATS token</li>
  <li>Pass that token to CiviCRM, and associate it with the contact.</li>
  <li>Record, somehow, whether the prospective member wants a monthly, biannual, or annual membership. <strong>Important:</strong> At this point, CiviCRM must not activate a membership or charge money.</li>
  <li>Wait for a period of time, potentially days, for some offline stuff to happen.</li>
  <li>Finally, process payment and activate the membership.</li>
  </ol>
  
  <p>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.</p>
  
  <p>Is what I want to do possible without writing custom CiviCRM extensions?</p>
  
  <p>From looking at the <a href="https://github.com/iATSPayments/com.iatspayments.civicrm/tree/master/api/v3" rel="nofollow noreferrer">V3 endpoints for the iATS extension</a>, I see code that lets me get information out of CiviCRM, but no way to get payment information in. What am I missing?</p>
  
  <p><strong>Edit:</strong> 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.</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-10-22T20:35:27.977Z
Comments.Text: 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.
Comments.UserDisplayName: Alan Dixon
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-10-24T23:22:33.273Z
Comments.Text: @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.
Comments.UserDisplayName: Stephen Van Dahm
Tags: <civimember><api><iats><rest>
Title: REST API, iATS: How do I create a membership through the API without using CiviCRM's forms?
ThreadText: # REST API, iATS: How do I create a membership through the API without using CiviCRM's forms?
  
  (Asked by: username_0 on 2019-10-16)
  
  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](https://github.com/iATSPayments/com.iatspayments.civicrm/tree/master/api/v3), 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.
  
  **Tags:** civimember, api, iats, rest
  
  > **Comments:**
  > **username_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.  
  > **username_0**: @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.  
  
  ---
  
  ## 3 answers
  
  ### Answer by username_1 on 2019-10-25. Score: 1 | Accepted answer
  
  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.
  
  
  ---
  
  ### Answer by username_2 on 2019-10-17. Score: 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 !!!
  
  > **Comments:**
  > **username_0**: 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.  
  > **username_2**: 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  
  
  ---
  
  ### Answer by username_3 on 2019-10-18. Score: 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+
  
  
  ---
  
  