Welcome to the "trac"-ing site of soap4r!
[soap4r] [httpclient] [openpgp4u] [pkcs1] [logger] [csv] [vtr]
From: wuyasea
To: soap4r -> googlegroups.com
Date: Sun, 12 Nov 2006 02:26:33 -0000
Subject: Re: paypal DoExpressCheckoutPayment


if i remember right.
1. customer redirect to paypal, they either approve or cancel.
2. after customer approve on paypal site, they are redirected back to
your site,
3. you can call getExpOrderDetail() to pull info about order, like
shipping address stuff.
4. then you call doExpressCheckoutPayment(), then they're charged.

paypal has detailed docs about the process.
https://www.paypal.com/IntegrationCenter/ic_expresscheckout.html


below are my methods, all parameters are string i think.
------------------------------------------------------------------------------------------------
    @api_aa = PayPalAPIAAInterface.new

    def getExpressCheckoutDetails(token)
      request = GetExpressCheckoutDetailsRequestType.new
      request.version = @version
      request.token = token

      req = GetExpressCheckoutDetailsReq.new(request)
      response = @api_aa.getExpressCheckoutDetails(req)
    end

    def doExpressCheckoutPayment(token, payerID, orderTotal)
      pmtDetail = PaymentDetailsType.new
      usd = BasicAmountType.new(orderTotal.to_s)
      usd.xmlattr_currencyID = 'USD'
      pmtDetail.orderTotal = usd

      detail = DoExpressCheckoutPaymentRequestDetailsType.new
      detail.token = token
      detail.paymentAction = PaymentActionCodeType::Sale
      detail.payerID = payerID
      detail.paymentDetails = pmtDetail

      request = DoExpressCheckoutPaymentRequestType.new
      request.doExpressCheckoutPaymentRequestDetails = detail
      request.version = @version

      req = DoExpressCheckoutPaymentReq.new(request)
      response = @api_aa.doExpressCheckoutPayment(req)
  end