I have never used Google Checkout before, only PayPal.
What you might be looking for is the PayPal Payments Pro SDK.
This allows your server to become the face of a payment transaction (and not a PayPal site, like a regular express train).
You need to implement a two-phase fixation mechanism.
I can recommend two different approaches:
a) You can start the purchase process on your server and leave it in the average “undeveloped” state in the database. You call PayPal from your server so that PP can handle your call, and when you have a response from PP, and if the answer means that the payment has been accepted, you make a purchase. The problem with this approach is that your application must decide whether to complete or refuse the transaction at that moment, and that’s not how the transaction in the real world can behave. PayPal may sometimes respond to something other than just OK / Error, payment may be delayed or may be in order with a warning.
b) PayPal provides payment status notifications even more reliable.
You are doing the same thread as before, with the change. As soon as PayPal processes the payment and gives you a positive answer, you save the transaction identifier in your database, but do nothing. Only inform the user that the transaction has completed.
As part of the PayPal server call, there is a parameter that you can use, this parameter is called the IPN listener URL.
IPN stands for “Immediate Payment Notification”, it is a return to your server created by PayPal, in which your application will receive instant information about your payment status.
This is really important, as pending transactions can be accepted or rejected. Even a accepted transaction can be rejected by you or at the request of your buyer at PayPal.
Let me know if you need more information on how to implement a PP IPN receiver.