calling custom code at payment completed
calling custom code at payment completed
Is it possible to call a custom code from ablecommerce when payment completes?
We would like to write a custom code which has access to order information but would be triggerred only upon payment completion.
We would like to write a custom code which has access to order information but would be triggerred only upon payment completion.
Re: calling custom code at payment completed
You can add your code to the event handler for CheckedOut event.
Please have a look at ConLib\OnePageCheckout.ascx.cs
Please have a look at ConLib\OnePageCheckout.ascx.cs
Re: calling custom code at payment completed
Looked at the code but in our understanding the checkedout event could happen when the funds have not been captured yet. We would like our custom code to run in the background only when the funds have been captured (in the store's terminology in the admin area: "Payment status: Completed"). Is there an event like that we can connect to?
Sorry for not being completely clear in the first post. It seems my question had not reached the "Phrased Clearly" status yet
Sorry for not being completely clear in the first post. It seems my question had not reached the "Phrased Clearly" status yet
Re: calling custom code at payment completed
It is possible that you can make multiple payments for an order. Do you want the code to run on each successful payment or do you want the code to run when full payment for an order is made?
Re: calling custom code at payment completed
Bigger orders where payment would come in two separate card transaction might go through our office anyway, so for the time being we can say we don't process multiple payments.
so on full payment
thanks for your help
so on full payment
thanks for your help
Re: calling custom code at payment completed
Event handler for CheckedOut event is a good place for this.
Here you can check the payment status of the order first. It the status is 'Completed' you can run your custom code otherwise not. Payments can also be made from merchant admin console. You will have to write similar code to Admin/Orders/Payments/AddPayment.aspx and CapturePayment.aspx
Here you can check the payment status of the order first. It the status is 'Completed' you can run your custom code otherwise not. Payments can also be made from merchant admin console. You will have to write similar code to Admin/Orders/Payments/AddPayment.aspx and CapturePayment.aspx
Re: calling custom code at payment completed
one problem we might have with this setup: as far as we know this ascx.cs file runs when it is calld by the corresponding ascx. So the page has to be run in order that we could check for payment status. Now what if he checks out, and funds get cleared shortly after that. One page/ascx will not run however payment status will be completed.
Re: calling custom code at payment completed
There are a great number of triggers defined in Ablecommerce which are triggering emails. Would it be possible to hook to these triggers? So that when an event occurs (e.g. Payment status complete), shop would not only send an email but could run our custom code.
If we could call a com component or dll from these emails with the help of nvelocity, that could help but that might not be enough. Do you know by chance whether that is possible?
Thanks
Tony
If we could call a com component or dll from these emails with the help of nvelocity, that could help but that might not be enough. Do you know by chance whether that is possible?
Thanks
Tony
Re: calling custom code at payment completed
The event triggers defined in Ablecommerce only support email triggers at this time. Support of hooking up more generic event handlers is not there yet.
I looked in to possibility of calling external code from NVelocity. It could be possible only if the 'context' provides certain objects to get something executed. So far the context only provides you objects like $token, $store, $order, $user, $customer etc etc ... but using these objects alone it does not seem to be possible to invoke some custom external code.
I looked in to possibility of calling external code from NVelocity. It could be possible only if the 'context' provides certain objects to get something executed. So far the context only provides you objects like $token, $store, $order, $user, $customer etc etc ... but using these objects alone it does not seem to be possible to invoke some custom external code.
Re: calling custom code at payment completed
thanks for your answer and research. we try to get around the problem by utilizing the payment complete triggered email. I will post if we succeed. Thanks again for your patient help