1. EricWebsite
  2. RO Payments
  3. Thursday, 25 February 2021
  4.  Subscribe via email
Hi,

After a successful payment initiated by a link (index.php?option=com_jdidealgateway&view=pay) the customer is redirected to a Payment Success message.
I put PHP code in there, will it always be executed, regardless whether the user has already closed the vrowser or not?

I currenly do that to handle some final details, but have the feeling that my code is not always executed.

Or is there a better way to do that, i.e. somewhere in the Profile?

Thanks for your answer!

Best
Eric
Accepted Answer Pending Moderation
Hello Eric,

The code on successful page is not executed if there is no browser. This is a front-end view, so if there is no browser showing the page, the code is not executed. You probably want to use a Joomla plugin that acts on the trigger onPaymentComplete, this way you can do any processing you want regardless of the browser.

Let me know if that helps.
Kind regards,

RolandD

=========================
If you use our extensions, please post a rating and a review at the Joomla! Extension Directory
  1. more than a month ago
  2. RO Payments
  3. # 1
Accepted Answer Pending Moderation
Hi Roland,

Where can I get that plugin? It seems exactly what I need!

If it does not exist (cannot find it) could you please give me some basics? I will probably be able to complete the PHP in it

Thanks and best,

Eric
  1. more than a month ago
  2. RO Payments
  3. # 2
Accepted Answer Pending Moderation
Hello Eric,

That plugin does not exist but users can build their own and as such hook into the payment process. We do not have any example plugins with this function name but you can take a look at the Joomla Boilerplate code. Just rename the plugin to what you like and add your

public function onPaymentComplete($data){}
function. The other empty functions can be removed.
Kind regards,

RolandD

=========================
If you use our extensions, please post a rating and a review at the Joomla! Extension Directory
  1. more than a month ago
  2. RO Payments
  3. # 3
Accepted Answer Pending Moderation
Hi Roland,

Do I understand correctly that thus I create a system plugin and the function above goes into foo.php or what ever I name it.
Then what is next?
Will this function automatically be called when the PSP (Mollie in my case) does a call-back after the payment has finished?
And which data will I get in the varible $data?

Sorry to ask so many questions!

Tkanks in advance,
Eric
  1. more than a month ago
  2. RO Payments
  3. # 4
Accepted Answer Pending Moderation
Hi,

I did all that, made a system plugin (juust with the foo name), installed it etc.All well.
I can see the system evaluates the plugin; when I make a PHP error in it then I get a blank page.

But I have the impression that the function onPaymentComplete is not being executed atfer a payment initiated by a link (index.php?option=com_jdidealgateway&view=pay).
I tried with some code or a simple exit(). Nothing happens.
Am I doing something wrong?
Attached is my foo.php

All the best,
Eric
Attachments (1)
  1. more than a month ago
  2. RO Payments
  3. # 5
Accepted Answer Pending Moderation
Hello Eric,

The plugin name can be foo, that is no problem :)

So this trigger is not executed if you call the link yourself. The trigger is called by the callback from your payment provider. So the process is that the customer goes to the PSP and completes the payment. After that the PSP calls your site to inform you of the payment status. At this point the plugin is triggered with the payment details and the result data.

So to test your plugin you will need to complete a payment and then log the data to a file or email or somewhere else. As a visitor you will never see this data as it is processed in the background.

Let me know if that clears things up.
Kind regards,

RolandD

=========================
If you use our extensions, please post a rating and a review at the Joomla! Extension Directory
  1. more than a month ago
  2. RO Payments
  3. # 6
Accepted Answer Pending Moderation
  1. more than a month ago
  2. RO Payments
  3. # 7
Accepted Answer Pending Moderation
Hi,
I used the Mollie test key and got the Mollie screen, selected "Paid" and got the ROPayment message Success screen back afterwards.
I suppose this should trigger the plugin?
It did not as far as I can see.

Could for some reason the test key prevent the execution?

Best,
Eric
  1. more than a month ago
  2. RO Payments
  3. # 8
Accepted Answer Pending Moderation
Hello Eric,

The test key is not the reason, the reason is me being stupid. I told you that it is a system plugin and that was wrong. The only way I found out was by building my own plugin and also finding out it isn't working as I explained. Apologies for that. The plugin should not be in the system group but in the jdideal group.

So in your XML file you put this:

<extension version="3.5" type="plugin" group="jdideal" method="upgrade">
This will let Joomla install it in the jdideal group. After the plugin is published, you should be able to see what the trigger does.

Let me know how it goes.
Kind regards,

RolandD

=========================
If you use our extensions, please post a rating and a review at the Joomla! Extension Directory
  1. more than a month ago
  2. RO Payments
  3. # 9
Accepted Answer Pending Moderation
Hi again,

Sorry, but ths does not seem to work either!

My plugin is attached. It installs without problems in /plugins/jdideal/foo (note there was no plugins/jdideal/ so it's the only plugin there).
I put a simple write to the temp directory in the onPaymentComplete function.

Nothing happens when I execute a payment!

Could you please check? And send me a plugin that works for you?

Thanks in advance!

Eric
Attachments (1)
  1. more than a month ago
  2. RO Payments
  3. # 10
Accepted Answer Pending Moderation
Hello Eric,

Find attached my plugin. You can install this as any Joomla plugin. The only thing you need to change is in the file ropayments.php is the emailaddress, so it emails to yourself.

Let me know if that works for you.
Attachments (1)
Kind regards,

RolandD

=========================
If you use our extensions, please post a rating and a review at the Joomla! Extension Directory
  1. more than a month ago
  2. RO Payments
  3. # 11
Accepted Answer Pending Moderation
Hi Roland,

YES this works!
Thank you, now I can move on.

Best,
Eric
  1. more than a month ago
  2. RO Payments
  3. # 12
Accepted Answer Pending Moderation
Here I am again,

How to retrieve field from the $data array?

I found it's structured with the keys:
isValid
message
id
profile_id
quantity
currency
amount
trans
cancel_url
return_url
notify_url
origin
order_id
order_number
result
card
processed
paymentReference
paymentId
date_added
language
pid
alias
But for some reason I cannot get a value with
$result = $data['0']['result'];
or similar.
What am I missing?

Best
Eric
  1. more than a month ago
  2. RO Payments
  3. # 13
Accepted Answer Pending Moderation
Found it: no line numbers!
$result = $data['result'];
Works!
  1. more than a month ago
  2. RO Payments
  3. # 14
Accepted Answer Pending Moderation
Hello Eric,

Correct, that is the way to get data out of an array.
Kind regards,

RolandD

=========================
If you use our extensions, please post a rating and a review at the Joomla! Extension Directory
  1. more than a month ago
  2. RO Payments
  3. # 15
Accepted Answer Pending Moderation
Hi Roland,

Everything wanted to do works, thanks again!
That is to say: when I put the code that I want to excecute directely in the plugin.

If I put the code in a (working) public function ProcessUser and call it from the plugin like this:

public function onPaymentComplete(array $data): void {

require('absolute_path/process_user.php');

$ordernummer = $data['order_number'];
$resultaat = $data['result'];
$profiel_alias = $data['alias'];

ProcessUser($ordernummer, $resultaat, $profiel_alias);

}

It does NOT work!
Any idea?

Thanks,
Eric
  1. more than a month ago
  2. RO Payments
  3. # 16
Accepted Answer Pending Moderation
Hello Eric,

If I put the code in a (working) public function ProcessUser and call it from the plugin like this:
If you have a public function it must be a class, therefore you must instantiate the class and call it like this where you replace $class with the name you use to instantiate your class.

$class->ProcessUser($ordernummer, $resultaat, $profiel_alias);
Why not put the code in the plugin?
Kind regards,

RolandD

=========================
If you use our extensions, please post a rating and a review at the Joomla! Extension Directory
  1. more than a month ago
  2. RO Payments
  3. # 17
Accepted Answer Pending Moderation
Hi Roland,

Thanks again! I'm going to try that.

The reason that I took the code out of the plugin and made it a separate function, is that visitors who have a coupon code, can register for free.
I still have to process their registration and call that function directly with $resultaat = "SUCCESS".

Thus I avoid taking them trough the payment link to Mollie.
Now I think of it, what would happen if I do that with a zero amount to pay?
  1. more than a month ago
  2. RO Payments
  3. # 18
Accepted Answer Pending Moderation
Hello Eric,

In the form you can set to allow a free checkout in the RO Payments settings. However this will not trigger the onPaymentComplete because there is no payment made whatsoever. You will need to hook into the RSForms call of rsfp_f_onAfterStoreSubmissions() with a plugin that is in the system group. That is a plugin that hooks into RSForms. The other thing you can do is have a script that checks for 0 total payments and handle them that way. There are a lot of ways to handle them.
Kind regards,

RolandD

=========================
If you use our extensions, please post a rating and a review at the Joomla! Extension Directory
  1. more than a month ago
  2. RO Payments
  3. # 19
Accepted Answer Pending Moderation
Hi Roland,

It's not RSForms but my Fabrik subscription form.
I update the user subscripton with the aid of your onAfterPaymentComplete plugin, and separately for free subscriptions now.
I managed to get everyting done as I wanted so I can go live. Thanks again!

Maybe an idea to provide the empty onAfterPaymentComplete plugin via your website?
I'm sure it will be helpfull for more people trying to do what I did!

Best,
Eric
  1. more than a month ago
  2. RO Payments
  3. # 20
  • Page :
  • 1
  • 2


There are no replies made for this post yet.
Be one of the first to reply to this post!