Folks,

I took the excellent stuff that Tim did for the PayPal stuff and refined it
even more... and made it a tad more "Lift-ish".

PayPal has two mechanisms for talking to it.  PDT and ITN.

PDT transactions happen when a customer finishes an PayPal transaction and
returns to your site.  The browser has 2 parameters (tx and at).  You can
ask PayPal if the transaction was really authorized by making a "PDT" call.

You would do this in the following way:
PaypalDataTransfer(at, tx, PaypalSandbox, PaypalSSL)

This will return a PaypalResponse.  The PaypalResponse can be queried for a
PayPalInfo object via: PaypalResponse.payPalInfo: Can[PayPalInfo]  If the
transaction was successful, you'll get the information about the transaction
from the PayPalInfo (name, address, transaction amount, etc.)

ITN transactions are initiated by PayPal and are POST requests made on your
site.  As PayPal processes various transactions, it will make POSTs on your
server.  You must verify these transactions (or else someone could spoof
PayPal transactions on your site) by asking PayPal if it made the POST.
Once PayPal verifies the transaction, you take some action (e.g., updating
an account value).

To do this:

object MyPayPalHandler extends PayPal {
  import PaypalTransactionStatus._
  def actions = {
     case (ClearedPayment, info, _) => // write the payment to the database
     case (RefundedPayment, info, _) => // process refund
  }
}

and in Boot:

LiftRules.statelessDispatchTable = MyPayPalHandler orElse
LiftRules.statelessDispatchTable

Each time PayPal does an ITN on your server, the action will be performed
(after the ITN it validated).

Questions?

Thanks,

David

-- 
Lift, the simply functional web framework http://liftweb.net
Collaborative Task Management http://much4.us
Follow me: http://twitter.com/dpp
Git some: http://github.com/dpp

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to