Web Services
  Home arrow Web Services arrow Page 2 - Automated Billing and Faxing for the Web
Dev Articles Forums 
ADO.NET  
Apache  
ASP  
ASP.NET  
C#  
C++  
ColdFusion  
COM/COM+  
Delphi-Kylix  
Design Usability  
Development Cycles  
DHTML  
Embedded Tools  
Flash  
Graphic Design  
HTML  
IIS  
Interviews  
Java  
JavaScript  
MySQL  
Oracle  
Photoshop  
PHP  
Reviews  
Ruby-on-Rails  
SQL  
SQL Server  
Style Sheets  
VB.Net  
Visual Basic  
Web Authoring  
Web Services  
Web Standards  
XML  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
WEB SERVICES

Automated Billing and Faxing for the Web
By: O'Reilly Media
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 1
    2007-08-23

    Table of Contents:
  • Automated Billing and Faxing for the Web
  • Starting the Transaction
  • Getting a Transaction Notification
  • Getting a Transaction Notification continued
  • Responding to the Transaction

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    Automated Billing and Faxing for the Web - Starting the Transaction


    (Page 2 of 5 )

    To kick our example off, lets start with a simple HTML page that will initiate our transaction, as shown in Figure 6-3.


    Figure 6-3.  Initial payment screen

    It's not the world's most sophisticated marketing page, but it does the job and is easy to understand. The HTML for this simple page is shown in Example 6-1.

    Example 6-1. Payment initialization form

    <%@ page contentType="text/html; charset=iso-8859-1"
    language="java" import="com.cascadetg.ch06.*" %>
    <HTML>
    <HEAD><title>ch06 : Simple Money Sender</title>
    <link href="../../ch04/www/default.css"
    rel="stylesheet" type="text/css">
    </HEAD>
    <BODY>
        
    <form action="https://www.paypal.com/cgi-bin/webscr" method="post">
           <p><strong>ch06: Simple Money Sender</strong></p>
           <p>
          <input type="hidden" name="cmd" value="_xclick">
          <input type="hidden" name="business"
          value="test_account@cascadetg.com">
          <input type="hidden" name="item_name" value="IPN Test">
          <input type="hidden" name="amount" value="0.01">
          <input type="hidden" name="return"
         value="http://67.123.6.118:8080/
    ch06/www/pay_form.jsp">
          <input type="hidden" name="notify_url"
         value="http://67.123.6.118:8080/ ch06/www/notification.jsp"> 
        
    <!-- Note: The notify_url field is not required if the IPN
          URL was set in your account profile)-->
          <input type="submit" name="submit" value="Send $0.01!"> 
           </p>
         </form>
    </BODY>
    </HTML>

    Notice that the form is posted to the PayPal server, butreturnandnotify_urlform elements are used to point back to this server. The IP address shown,67.123.6.118:8080, is the WAN IP address and port for my server; you’ll need to establish an Internet accessible address and port for your own system. Clicking the button takes the user to the PayPal server, as shown in Figure 6-4.


    Figure 6-4.  Initiating the PayPal transaction

    Once at the PayPal server, users can walk through the rest of the transaction using the PayPal service, including entering credit card information and shipping address. When the order is complete, they are returned to the original pay_form.jsp page, ready to send another $0.01.

    The example uses a transaction of $0.01 for this; it isn’t a transaction you’d ever use PayPal for because PayPal and credit card company fees will absorb the penny. You can use PayPal’s management services to refund the quantities sent, which is especially important if you need to test sending larger monetary sums.

    As an additional feature, the example in this chapter generates faxes when a refund is sent. If an order is cancelled, you’ll probably want to let your (fictional) business partner know as soon as possible.

    More Web Services Articles
    More By O'Reilly Media


       · This article is an excerpt from the book "Real World Web Services," published by...
     

    Buy this book now. This article is excerpted from chapter six of the book Real World Web Services, written by Will Iverson (O'Reilly; ISBN: 059600642X). Check it out today at your favorite bookstore. Buy this book now.

    WEB SERVICES ARTICLES

    - Safety, Idempotence, and the Resource-Orient...
    - The Resource-Oriented Architecture in Action
    - Features of the Resource-Oriented Architectu...
    - The Resource-Oriented Architecture
    - Getting Started with Flex
    - Automated Billing and Faxing for the Web
    - An Introduction to Web Services
    - The Foundations of Web Services: From Novice...
    - Web Services Reengineering: Finishing Touches
    - Fault Handling with Web Services
    - Flow and Web Services
    - Process Lifecycles and Web Services
    - Business Processes and Web Services
    - Orchestrating Web Services
    - Notifications and Resources in the WS-Resour...







    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 3 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek