I've never used Google Checkout before, only PayPal.
What you might be looking for is the PayPal Payments Pro SDK.
This lets your server become the face of the paying transaction (and not the PayPal site like the normal Checkout express).
You need to implement a 2-phase commit mechanism.
I can recommend two different approaches:
a) You could start the purchase process on your server and leave it in a middle "uncommited" status in the database.
You call PayPal from your server so PP can process your call, and when you have the response from PP, and if the response means that the payment was accepted, you commit your purchase. The problem with this approach is that your application need to take a decition of completing or rejecting the transaction at that point, and that is not how a real world purchase transaction might behave. PayPal might sometimes response something different than just plain OK/Error, the payment can be pending, or it can be OK with warning.
b) Even more reliable is letting PayPal notify you about the payment status.
You make the same flow as described before with a change. Once PayPal processes the payment and give you a positive answer, you store the transaction ID in your database but don't commit anything. Only tell the user that the transaction was completed.
As part of the call to the PayPal server, there is a parameter that you can use, that parameter is called the IPN Listener URL.
IPN means Instant payment notification, is a call back to your server, originated by PayPal, in which your application will get instant information about your payment status.
This is really important as a pending transactions might become accepted or rejected. Even an accepted transaction might be rollback-ed by you or by a claim suited by your purchaser to PayPal.
Let me know if you need more information on how to implement the PP IPN Listener.