Help with Paypal IPN Listener

<%- if @topic_view.topic.tags.present? %>
<%= t 'js.tagging.tags' %>: <%- @topic_view.topic.tags.each do |t| %> <%= t %> <%- end %>
<% end %>

Silverstripe Version: 4.4

Question:

I am struggling to get a PayPal IPN Listener script working. My issues seem to be when I try and get an existing object to edit it. I can successfully save all the IPN information into a transaction table, no problems there.

However there are a few tasks I need to perform that involve querying existing records and that is where the problems happen.

Examples:

  1. I need to get an existing Member object and add that Member to a Group
$Member = Member::get()->byID($member_id);
$Group = Group::get()->byId(3);
$Group->Members()->add($Member);

This just doesn’t happen, no errors etc, just doesn’t happen.

  1. I need to check whether an existing record exists for the current transaction
if ($ExistingTransaction = DataObject::get_one('Transaction', "TxnID = '" . $transaction_id . "'"))

Again this just doesn’t happen.

Is this something to do with the fact this script is never called in browser and happens behind the scenes? Is it something else?? Any ideas welcome, been struggling with this for few days!!

Thanks :slight_smile: