Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
integration:craftcms [2019/01/21 01:16] – [Webhooks] adamintegration:craftcms [2019/01/22 14:14] (current) – [Webhooks] adam
Line 231: Line 231:
 Navigate to the FoxyCart Craft plugin's settings page and copy the webhooks action URL from the lower section of the page, and set that within the 'advanced' settings section of your store's FoxyCart administration. Navigate to the FoxyCart Craft plugin's settings page and copy the webhooks action URL from the lower section of the page, and set that within the 'advanced' settings section of your store's FoxyCart administration.
  
-If you need to perform custom actions with that data (for example, you may need to subscribe a customer to a mailing list), you can make use of the ''foxyCart.onProcessWebhook'' event. The event contains two parameters, ''xml'' which contains the decrypted XML from the webhook payload and ''feedType'' which will either be ''transaction'' or ''subscription'' dependant on the type of webhook that has been triggered. If you don't have an existing custom plugin for your custom Craft code, we recommend utilising the [[https://github.com/lindseydiloreto/craft-businesslogic|Business Logic plugin]].+If you need to perform custom actions with that data (for example, you may need to subscribe a customer to a mailing list), you can make use of the ''foxyCart.onProcessWebhook'' event. The event contains two parameters, ''xml'' which contains the decrypted XML from the webhook payload and ''type'' which will either be ''transaction'' or ''subscription'' dependant on the type of webhook that has been triggered. If you don't have an existing custom plugin for your custom Craft code, we recommend utilising the [[https://github.com/lindseydiloreto/craft-businesslogic|Business Logic plugin]].
  
 <code php> <code php>
 craft()->on('foxyCart.onProcessWebhook', function(Event $event) { craft()->on('foxyCart.onProcessWebhook', function(Event $event) {
     $xml = $event->params['xml']; // The decrypted XML payload     $xml = $event->params['xml']; // The decrypted XML payload
-    $feedType = $event->params['feedType']; // "transaction" or "subscription"+    $feedType = $event->params['type']; // "transaction" or "subscription"
          
     // .. your code     // .. your code

Site Tools