Included Modules

Class Index [+]

Quicksearch

ActiveMerchant::Billing::PayflowExpressGateway

General Parameters

The following parameters are supported for #, #, # and # transactions. I’ve read in the docs that they recommend you pass the exact same parameters to both setup and authorize/purchase.

This information was gleaned from a mix of:

The following parameters are currently supported.

:ip

(opt) Customer IP Address

:order_id

(opt) An order or invoice number. This will be passed through to the Payflow backend at manager.paypal.com, and show up as “Supplier Reference #“

:description

(opt) Order description, shown to buyer (after redirected to PayPal). If Order Line Items are used (see below), then the description is suppressed. This will not be passed through to the Payflow backend.

:billing_address

(opt) See ActiveMerchant::Billing::Gateway for details

:shipping_address

(opt) See ActiveMerchant::Billing::Gateway for details

:currency

(req) Currency of transaction, will be set to USD by default for PayFlow Express if not specified

:email

(opt) Email of buyer; used to pre-fill PayPal login screen

:payer_id

(opt) Unique PayPal buyer account identification number, as returned by details_for request

:token

(req for # & #) Token returned by setup transaction

:no_shipping

(opt) Boolean for whether or not to display shipping address to buyer

:address_override

(opt) Boolean. If true, display shipping address passed by parameters, rather than shipping address on file with PayPal

:allow_note

(opt) Boolean for permitting buyer to add note during checkout. Note contents can be retrieved with details_for transaction

:return_url

(req) URL to which the buyer’s browser is returned after choosing to pay.

:cancel_return_url

(req) URL to which the buyer is returned if the buyer cancels the order.

:notify_url

(opt) Your URL for receiving Instant Payment Notification (IPN) about this transaction.

:comment

(opt) Comment field which will be reported to Payflow backend (at manager.paypal.com) as Comment1

:comment2

(opt) Comment field which will be reported to Payflow backend (at manager.paypal.com) as Comment2

Line Items

Support for order line items is available, but has to be enabled on the PayFlow backend. This is what I was told by Todd Sieber at Technical Support:

You will need to call Payflow Support at 1-888-883-9770, choose option #2. Request that they update your account in “Pandora” under Product Settings >> PayPal Mark and update the Features Bitmap to 1111111111111112. This is 15 ones and a two.

See here for the forum discussion (requires login to x.com

    
:items

(opt) Array of Order Line Items hashes. These are shown to the buyer after redirect to PayPal.

The following keys are supported for line items:

:name

Name of line item

:description

Description of line item

:amount

Line Item Amount in Cents (as Integer)

:quantity

Line Item Quantity (default to 1 if left blank)

Customization of Payment Page

:page_style

(opt) Your URL for receiving Instant Payment Notification (IPN) about this transaction.

:header_image

(opt) Your URL for receiving Instant Payment Notification (IPN) about this transaction.

:background_color

(opt) Your URL for receiving Instant Payment Notification (IPN) about this transaction.

Additional options for old Checkout Experience, being phased out in 2010 and 2011

:header_background_color

(opt) Your URL for receiving Instant Payment Notification (IPN) about this transaction.

:header_border_color

(opt) Your URL for receiving Instant Payment Notification (IPN) about this transaction.

Public Instance Methods

authorize(money, options = {}) click to toggle source
    # File lib/active_merchant/billing/gateways/payflow_express.rb, line 71
71:       def authorize(money, options = {})
72:         requires!(options, :token, :payer_id)
73:         request = build_sale_or_authorization_request('Authorization', money, options)
74:         commit(request, options)
75:       end
credit(money, identification, options = {}) click to toggle source
    # File lib/active_merchant/billing/gateways/payflow_express.rb, line 88
88:       def credit(money, identification, options = {})
89:         deprecated CREDIT_DEPRECATION_MESSAGE
90:         refund(money, identification, options)
91:       end
details_for(token) click to toggle source
     # File lib/active_merchant/billing/gateways/payflow_express.rb, line 107
107:       def details_for(token)
108:         request = build_get_express_details_request(token)
109:         commit(request, options)
110:       end
purchase(money, options = {}) click to toggle source
    # File lib/active_merchant/billing/gateways/payflow_express.rb, line 77
77:       def purchase(money, options = {})        
78:         requires!(options, :token, :payer_id)
79:         request = build_sale_or_authorization_request('Sale', money, options)
80:         commit(request, options)
81:       end
refund(money, identification, options = {}) click to toggle source
    # File lib/active_merchant/billing/gateways/payflow_express.rb, line 83
83:       def refund(money, identification, options = {})
84:         request = build_reference_request(:credit, money, identification, options)
85:         commit(request, options)
86:       end
setup_authorization(money, options = {}) click to toggle source
    # File lib/active_merchant/billing/gateways/payflow_express.rb, line 93
93:       def setup_authorization(money, options = {})
94:         requires!(options, :return_url, :cancel_return_url)
95:         
96:         request = build_setup_express_sale_or_authorization_request('Authorization', money, options)
97:         commit(request, options)
98:       end
setup_purchase(money, options = {}) click to toggle source
     # File lib/active_merchant/billing/gateways/payflow_express.rb, line 100
100:       def setup_purchase(money, options = {})
101:         requires!(options, :return_url, :cancel_return_url)
102:         
103:         request = build_setup_express_sale_or_authorization_request('Sale', money, options)
104:         commit(request, options)
105:       end

Private Instance Methods

add_pay_data(xml, money, options) click to toggle source
     # File lib/active_merchant/billing/gateways/payflow_express.rb, line 149
149:       def add_pay_data(xml, money, options)
150:         xml.tag! 'PayData' do
151:           xml.tag! 'Invoice' do
152:             xml.tag! 'CustIP', options[:ip] unless options[:ip].blank?
153:             xml.tag! 'InvNum', options[:order_id] unless options[:order_id].blank?
154:             # Description field will be shown to buyer, unless line items are also being supplied (then only line items are shown).
155:             xml.tag! 'Description', options[:description] unless options[:description].blank?
156:             # Comment, Comment2 should make it to the backend at manager.paypal.com, as with Payflow credit card transactions
157:             # but that doesn't seem to work (yet?). See: https://www.x.com/thread/51908?tstart=0
158:             xml.tag! 'Comment', options[:comment] unless options[:comment].nil?
159:             xml.tag!('ExtData', 'Name'=> 'COMMENT2', 'Value'=> options[:comment2]) unless options[:comment2].nil?
160: 
161:             billing_address = options[:billing_address] || options[:address]
162:             add_address(xml, 'BillTo', billing_address, options) if billing_address
163:             add_address(xml, 'ShipTo', options[:shipping_address], options) if options[:shipping_address]
164: 
165:             # Note: To get order line-items to show up with Payflow Express, this feature has to be enabled on the backend.
166:             # Call Support at 888 883 9770, press 2. Then request that they update your account in "Pandora" under Product Settings >> PayPal
167:             # Mark and update the Features Bitmap to 1111111111111112.  This is 15 ones and a two.
168:             # See here for the forum discussion: https://www.x.com/message/206214#206214
169:             items = options[:items] || []
170:             items.each_with_index do |item, index|
171:               xml.tag! 'ExtData', 'Name' => "L_DESC#{index}", 'Value' => item[:description]
172:               xml.tag! 'ExtData', 'Name' => "L_COST#{index}", 'Value' => amount(item[:amount])
173:               xml.tag! 'ExtData', 'Name' => "L_QTY#{index}", 'Value' => item[:quantity] || '1'
174:               xml.tag! 'ExtData', 'Name' => "L_NAME#{index}", 'Value' => item[:name]
175:               # Note: An ItemURL is supported in Paypal Express (different API), but not PayFlow Express, as far as I can tell.
176:               # L_URLn nor L_ITEMURLn seem to work
177:             end
178:             if items.any?
179:               xml.tag! 'ExtData', 'Name' => 'CURRENCY', 'Value' => options[:currency] || currency(money)
180:               xml.tag! 'ExtData', 'Name' => "ITEMAMT", 'Value' => amount(money)
181:             end
182: 
183:             xml.tag! 'TotalAmt', amount(money), 'Currency' => options[:currency] || currency(money)
184:           end
185: 
186:           xml.tag! 'Tender' do
187:             add_paypal_details(xml, options)
188:           end
189:         end
190:       end
add_paypal_details(xml, options) click to toggle source
     # File lib/active_merchant/billing/gateways/payflow_express.rb, line 192
192:       def add_paypal_details(xml, options)
193:          xml.tag! 'PayPal' do
194:           xml.tag! 'EMail', options[:email] unless options[:email].blank?
195:           xml.tag! 'ReturnURL', options[:return_url] unless options[:return_url].blank?
196:           xml.tag! 'CancelURL', options[:cancel_return_url] unless options[:cancel_return_url].blank?
197:           xml.tag! 'NotifyURL', options[:notify_url] unless options[:notify_url].blank?
198:           xml.tag! 'PayerID', options[:payer_id] unless options[:payer_id].blank?
199:           xml.tag! 'Token', options[:token] unless options[:token].blank?
200:           xml.tag! 'NoShipping', options[:no_shipping] ? '1' : '0'
201:           xml.tag! 'AddressOverride', options[:address_override] ? '1' : '0'
202:           xml.tag! 'ButtonSource', application_id.to_s.slice(0,32) unless application_id.blank? 
203:           
204:           # Customization of the payment page
205:           xml.tag! 'PageStyle', options[:page_style] unless options[:page_style].blank?
206:           xml.tag! 'HeaderImage', options[:header_image] unless options[:header_image].blank?
207:           xml.tag! 'PayflowColor', options[:background_color] unless options[:background_color].blank?
208:           # Note: HeaderImage and PayflowColor apply to both the new (as of 2010) and the old checkout experience
209:           # HeaderBackColor and HeaderBorderColor apply only to the old checkout experience which is being phased out.
210:           xml.tag! 'HeaderBackColor', options[:header_background_color] unless options[:header_background_color].blank?
211:           xml.tag! 'HeaderBorderColor', options[:header_border_color] unless options[:header_border_color].blank?
212:           xml.tag! 'ExtData', 'Name' => 'ALLOWNOTE', 'Value' => options[:allow_note]
213:         end
214:       end
build_get_express_details_request(token) click to toggle source
     # File lib/active_merchant/billing/gateways/payflow_express.rb, line 113
113:       def build_get_express_details_request(token)
114:         xml = Builder::XmlMarkup.new :indent => 2  
115:         xml.tag! 'GetExpressCheckout' do
116:           xml.tag! 'Authorization' do
117:             xml.tag! 'PayData' do  
118:               xml.tag! 'Tender' do
119:                 xml.tag! 'PayPal' do
120:                   xml.tag! 'Token', token
121:                 end
122:               end
123:             end
124:           end
125:         end
126:         xml.target!
127:       end
build_response(success, message, response, options = {}) click to toggle source
     # File lib/active_merchant/billing/gateways/payflow_express.rb, line 216
216:       def build_response(success, message, response, options = {})
217:         PayflowExpressResponse.new(success, message, response, options)
218:       end
build_sale_or_authorization_request(action, money, options) click to toggle source
     # File lib/active_merchant/billing/gateways/payflow_express.rb, line 139
139:       def build_sale_or_authorization_request(action, money, options) 
140:         xml = Builder::XmlMarkup.new :indent => 2
141:         xml.tag! 'DoExpressCheckout' do
142:           xml.tag! action do
143:             add_pay_data xml, money, options
144:           end
145:         end
146:         xml.target!
147:       end
build_setup_express_sale_or_authorization_request(action, money, options = {}) click to toggle source
     # File lib/active_merchant/billing/gateways/payflow_express.rb, line 129
129:       def build_setup_express_sale_or_authorization_request(action, money, options = {})
130:         xml = Builder::XmlMarkup.new :indent => 2
131:         xml.tag! 'SetExpressCheckout' do
132:           xml.tag! action do
133:             add_pay_data xml, money, options
134:           end
135:         end
136:         xml.target!
137:       end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.