nette-paypal
nette-paypal copied to clipboard
Callbacks in onSuccessPayment[] never gets called
I have done everything exactly according to documentation, but unfortunately script is not working for me.
When i click on button, i get redirected to paypal, which is ok, after sandbox payment (have tested without sandbox mode as well) i get redirected back, callback onConfirmation()
is invoked and nothing happens afterwards - no balance is transfered as well.
Last thing that happens is calling component handler handleConfirmation()
nette action looks like Video:User:orderDetail paypalButton-confirmation!
As i checked code, there is function confirmExpressCheckout()
which is NEVER called and i think there is something wrong with it, as well it contains onSuccessPayment()
which should invoke callbacks.
Working workaround:
$control->onConfirmation[] = function($data) use ($control) {
$this->confirmOrder($control, $data);
};
public function confirmOrder($control, $data)
{
$control->confirmExpressCheckout();
}
Though i dont know it is supposed to work like this or there is nicer way. Using this solution as well balance is changed on both accounts affected.
@Lexinek That's the way it's supossed to work. You should have control over payment confirmation, you may want to run some checks (i.e. order status in DB) before accepting the payment.
Current docs are unclear about that. Would you mind creating a PR? :)
The question is whether we need separate onSuccessPayment event. Do we?