Connect to web service after successful checkout

For general questions and discussions specific to the AbleCommerce 7.0 Asp.Net product.
Post Reply
mezojeff
Lieutenant, Jr. Grade (LT JG)
Lieutenant, Jr. Grade (LT JG)
Posts: 27
Joined: Fri Jan 08, 2010 7:23 am

Connect to web service after successful checkout

Post by mezojeff » Fri Jan 15, 2010 9:19 am

Hello,

I'm trying to figure out the best way to provision a user account through an API on a remote site once the user's purchase has been successful for a certain SKU (it's a subscription to a backup service). In a perfect world it would look something like this?

//purchase is successful
//loop through order, if the order contains the sku for our backup subscription
if (product.sku=="mybackupplan")
{
//code to provision user account on remote system using the users email address
}

Where in able commerce would be the best place to do this? Would it be the receipt page (page that appears after successful purchase?)

Thanks,
Jeff
Last edited by mezojeff on Fri Jan 15, 2010 9:46 am, edited 1 time in total.

User avatar
mazhar
Master Yoda
Master Yoda
Posts: 5084
Joined: Wed Jul 09, 2008 8:21 am
Contact:

Re: Connect to web service after successful checkout

Post by mazhar » Fri Jan 15, 2010 9:37 am

You can trigger this code form CheckedOut method of OnePageCheckout. This is basically an event handler which is called upon completion of checkout(order placement) on store side. You in CheckedOut method you can get newly placed order like

Code: Select all

Order order = OrderDataSource.Load(e.OrderId,false);
foreach(OrderItem item in order.Items)
{
if(item.OrderItemType == OrderItemType.Product && item.Product.Sku="your sku")
{
//Connect to webservice and trigger your code
}

}

mezojeff
Lieutenant, Jr. Grade (LT JG)
Lieutenant, Jr. Grade (LT JG)
Posts: 27
Joined: Fri Jan 08, 2010 7:23 am

Re: Connect to web service after successful checkout

Post by mezojeff » Fri Jan 15, 2010 9:47 am

awesome, thanks for the prompt reply! I will try this out and see if it works now.

Post Reply