Best Practices for Integrating Payments Pro Session Title: Driving Business with PayPal Session Abstract: Many SMB customers are looking for a higher level of integration out of their ecommerce system to drive stronger end customer relationships. Some of the more common additional pieces of functionality above standard checkout processing includes marketing campaigns connected into their product purchasing (special promos, discount coupons, etc.), tie-ins of transactional information into their online administration, and the acceptance of online invoice payments tied into their financial system. In this session we will look at taking PayPal integration to the next level through technologies such as Payments Pro, Instant Payment Notification, and Recurring Payment. In the process not only will we look at lessons learned and recommendations based on the experience of developing several of these end solutions for small and medium businesses. We will use live site case studies but also walk through the design and code of the following examples: Implementing promo/discount codes in the checkout process through Payments Pro Keeping transaction records in back end systems using Instant Payment Notification (IPN) Leveraging recurring billing for long term customer relationships and overall customer retention These examples will be shown in a hypothetical invoice payment system that we will walk through during the talk. We will look at the customer flow, business benefits, and implementation best practices of each of the above pieces functionalities into a site. This session should provide multiple ideas for incorporating advanced features into your own site or customer web projects, along with some best practices to guide you to a successful integration. Note: Most examples, for ease of demonstration in the session will be provided in PHP and mySql, however the functionality and design could be leveraged across a variety programming languages and the underlying PayPal technologies remain the same.
Promotion, discount, coupon codes Security of server side, prevent the user from manipulating a cookie or client side JS or the order in paypal Watch out for client side code validation as it exposes the codes available to users Store codes in database for easy maintenance and tracking Also need to be aware if more than one coupon code can be used per order
Recalculation of order needs to happen if items updated or code changed
SSL is not required for IPN because no banking or credit card information is transmitted in the posting of information from paypal to your IPN catch page Remember to put the IPN temporarily on hold if processing IPN catch page under maintenance Typically use either “custom” or “invoice” fields for matching up database records, only real difference is length 255 versus 127 and custom is not presented to the customer
The address for opening the connection and doing the post back varies on two conditionals: ssl encryption and production or sandbox selection. Here are the possible values. Sandbox and http $fp = fsockopen ('www.sandbox.paypal.com', 80, $errno, $errstr, 30); Sandbox and ssl $fp = fsockopen (’ssl://www.sandbox.paypal.com', 443, $errno, $errstr, 30); Production and http $fp = fsockopen ('www.paypal.com', 80, $errno, $errstr, 30); Production and ssl $fp = fsockopen ('ssl://www.paypal.com', 443, $errno, $errstr, 30); For cURL examples see the following link in the PayPal developer forums: http://developer.paypal-portal.com/pdn/board/message?board.id=ipn&thread.id=12752&view=by_date_ascending&page=1
See the Instant Payment Notification Guide pdf (Document Number: 10087.en_US-200903) for the complete set of information.
Based on the transaction type different processing rules can be created to handle the information passed via IPN based on the business processes.
Website Payments Standard button notify_url HTML form variable NVP API operation NOTIFYURL field of the DoDirectPayment, DoExpressCheckoutPayment, or DoReferenceTransaction request SOAP API operation NotifyURL field of the DoDirectPayment, DoExpressCheckoutPayment, or DoReferenceTransaction request
We use this to troubleshoot both production issues and validate the set of variables returned by a specific transaction type.
This method is used as a back up for the IPN notifications when the business must have all transactions integrated for accounting, packing and shipping processes and the like. Set the STARTDATE and ENDDATE values for the window of time for the TransactionSearch call. If a transaction is found that an IPN has not been received for then call GetTransactionDetails for retrieving the same type of information as what would have been found in the IPN. Make sure to use a flag of last successful poll time as the new start time so that do not miss a window based on communication issues. PayPal source code examples can be found at https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=developer/library_code.
DoDirectPayment call and authorize $1, then void it if successful
Showing direct method here. Just as easily this can be put into an Express Checkout flow using a token based validation.
The $recurring_payments_request variable holds the parameters for the new profile. See the SOAP example for a breakdown of building the parameters into the profile.
Profile ID can then be used to query the profile and perform other API calls on the recurring payments so store this with the client information. Error messages follow standard style including error code number and messages. Here is another sample: TIMESTAMP: 2009-05-11T15:15:23Z CORRELATIONID: 66130dd934ffb ACK: Failure VERSION: 51.0 BUILD: 904483 L_ERRORCODE0: 10527 L_SHORTMESSAGE0: Invalid Data L_LONGMESSAGE0: This transaction cannot be processed. Please enter a valid credit card number and type. L_SEVERITYCODE0: Error
Recurring payments instant payment notifications and email Event IPN Buyer Email Profile successfully created Yes Yes Profile creation failed Yes Yes Profile canceled from paypal.com interface Yes Yes Profile status changed using API No Yes Profile update using API No Yes Initial payment either succeeded or failed Yes Yes Payment either succeeded or failed (during either trial period or regular payment period) Yes Yes Outstanding payment either succeeded or failed Yes Yes Maximum number of failed payments reached Yes No NOTE: API transactions such as ManangeRecurringPaymentsProfileStatus do not trigger IPN notification because the success or failure of the call is immediately provided by the API response.
Even with performing recurring payments in the sandbox you will still not be able to create all the actions that trigger IPNs. Some will only be available in production.
It is also beneficial to add a catch all in your IPN processing page so that if an unhandled IPN txn_type is caught that you can then be notified either by logging of the variables or email of the variables.
From the 2009 PayPal Developer's Conference (http:/ more
From the 2009 PayPal Developer's Conference (http://ebay.com/devcon/).
Driving Business with PayPal
Many SMB customers are looking for a higher level of integration out of their ecommerce system to drive stronger end customer relationships. Some of the more common additional pieces of functionality above standard checkout processing includes marketing campaigns connected into their product purchasing (special promos, discount coupons, etc.), tie-ins of transactional information into their online administration, and the acceptance of online invoice payments tied into their financial system. In this session we will look at taking PayPal integration to the next level through technologies such as Payments Pro, Instant Payment Notification, and Recurring Payment. In the process not only will we look at lessons learned and recommendations based on the experience of developing several of these end solutions for small and medium businesses. We will use live site case studies but also walk through the design and code of examples. less
0 comments
Post a comment