Both sides previous revisionPrevious revisionNext revision | Previous revision |
integration:craftcms [2015/04/18 11:52] – Made "heading" a required field as it's used for the entry Title codeknight | integration:craftcms [2019/01/22 14:14] (current) – [Webhooks] adam |
---|
===== Other Plugin Features ===== | ===== Other Plugin Features ===== |
| |
==== HMAC Encryption ==== | ==== Link/Form Validation ==== |
| |
If you'd like to make use of our [[static:redirect:price_validation|link and form encryption]] to prevent possible tampering, you simply need to wrap your links and forms, or the whole page, within ''{% hmac %}'' and ''{% endhmac %}'' tags. Note that you also need to enable this option on the 'advanced' settings page of your store's FoxyCart administration. Taking the ''_product.html'' template from before: | If you'd like to make use of our [[static:redirect:price_validation|link and form validation]] to prevent possible tampering, you simply need to wrap your links and forms, or the whole page, within ''{% hmac %}'' and ''{% endhmac %}'' tags. Note that you also need to enable this option on the 'advanced' settings page of your store's FoxyCart administration. Taking the ''_product.html'' template from before: |
| |
<code html>{% extends "_layout" %} | <code html>{% extends "_layout" %} |
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> |
| craft()->on('foxyCart.onProcessWebhook', function(Event $event) { |
| $xml = $event->params['xml']; // The decrypted XML payload |
| $feedType = $event->params['type']; // "transaction" or "subscription" |
| |
| // .. your code |
| }); |
| </code> |
| |
| For an example of the payload you'll receive, you can review those on their respective wiki pages - [[v:2.0:transaction_xml_datafeed|transaction datafeed]] and [[v:2.0:subscription_xml_datafeed|subscription datafeed]]. |
==== Single Sign-On ==== | ==== Single Sign-On ==== |
| |