[ic] Interchange->Paypal question

Chris Chaney interchange-users@icdevgroup.org
Sun Sep 15 23:13:01 2002


Shirlyn,

You have to include the input type hidden variables and make sure your
routes are set up correctly.  I could not get PayPal to work as
described there, but I did get it to work making some modifications and
it works, and the way I want it.

I've included my checkout, checkout2, & checkout3 page for when they are
redirected after completing paypal to my receipt page.  They are at the
bottom of this email.  I got rid of the billing portion as it is just to
much to enter and a waste of time, since they are going to enter it at
PayPal anyway, it uses the values from the Shipping fields instead.

It works like this
Checkout -> Bounce to paypal (checkout2) -> PayPal -> Completed PayPal
redirect to completion url -> Bounce to receipt page, finalize order
even though we didn't collect billing information here -> receipt page

You will also have to change some of your files in your etc directory to
say instead of Payment Method: Incomplete to say PayPal.  This is in
your emails to yourself as well as the stored order, as well as the
email to the customer.

Good luck.  I had to do PayPal myself and it hasn't been so good for my
orders.  I noticed people put things in their cart but very few got all
the way through checkout (most likely because they didn't have a PayPal
account).  When I can afford a merchant account I will do that.

Anyway, good luck,

Chris

 

-----Original Message-----
From: interchange-users-admin@icdevgroup.org
[mailto:interchange-users-admin@icdevgroup.org] On Behalf Of S. Wong
Sent: Sunday, September 15, 2002 12:14 PM
To: interchange-users@icdevgroup.org
Subject: [ic] Interchange->Paypal question

I've tried doing what was outlined in
http://www.interchange.rtfm.info/howto/paypal-how.txt and though
checkout2.html actually works out of context, (I actually put in the URL
../ord/checkout2.html and it does redirect to paypal), checkout.html
doesn't seem to pass on to checkout2.html.  Instead, it goes through and
go to receipt.html.

I decided to retain the original checkout.html and put for Place Order
the following :

        [button
                name="mv_click"
                src="__THEME__/placeorder.gif"
                text="Place Order"
                hidetext=1
                form=checkout
        ]
                mv_todo=submit
                mv_order_profile=checkout_initial
                mv_successpage=ord/checkout2
                mv_failpage=ord/checkout
        [/button]

I'm assuming this is pretty much the same as what was outlined by J.T.
checkout2.html is exactly as was shown (except new e-mail account for
business).  I've also tried just dropping everything in checkout.html
and cut-n-paste the sample as is and that, too, bypassed paypal.  

I've restarted interchange and set profiles.order as shown.  And just so
there was no confusion, I went on to delete everything else in
profiles.order.  The only entries are the checkout_initial,
checkout_profile and invalid.

Has anyone tried this and had more success than I?

Thanks. :-)

Ciao ?:-)
Shirlyn, the WebPrincess (tm)

"In times of change,
there is no incentive so great,
and no medicine so powerful
as the hope for a better tomorrow."

_______________________________________________
interchange-users mailing list
interchange-users@icdevgroup.org
http://www.icdevgroup.org/mailman/listinfo/interchange-users



[comment]
ui_template: yes
ui_template_name: ff_noleft
[/comment]

[tmp members_only][/tmp]
[tmp page_title]__COMPANY__ -- Check Out[/tmp]

[control reset=1]

  [control-set]
    [component]none[/component]
  [/control-set]


  [control-set]
    [component]none[/component]
  [/control-set]


  [control-set]
    [component]none[/component]
  [/control-set]

[control reset=1]

@_FF_NOLEFT_TOP_@

<!-- BEGIN CONTENT -->
<div align="center">
<table width="95%">
<tr>
  <td align="left" width="100%">

    [if !session logged_in]
    <br>
    <p>If you have an account with us, please login using the fields
below. It
    is not required, but you can also <a href="[area
new_account]">create an
    account</a> with us.</p>
				  
    [if session failure]
      <P>
      <b>[calc]delete $Session->{failure}[/calc]</b>
      <P>
    [/if]

    <FORM ACTION="[process secure=1]" METHOD=POST>
    <INPUT TYPE=hidden NAME=mv_click VALUE=Login>
    <INPUT TYPE=hidden NAME=mv_todo  VALUE=return>
    <INPUT TYPE=hidden NAME=mv_nextpage VALUE="ord/checkout">

    [set Log In]
      mv_nextpage=@@MV_PAGE@@
    [/set]

    <table align="center">
    <tr>
      <td class="contentbar2">
        <table>
        <tr>
          <td align="right" class="contentbar1">
            Username:
          </td>
          <td align="left" class="contentbar1">
	    <INPUT NAME=mv_username VALUE="[read-cookie MV_USERNAME]"
size="20">
          </td>
        </tr>
        <tr>
          <td align="right" class="contentbar1">
	    Password:
          </td>
          <td class="contentbar1" align="left">
	    <INPUT TYPE=password NAME=mv_password VALUE="" size="20">
	    <input type="hidden" NAME="mv_check" value="Log In">
          </td>
        </tr>
        <tr>
          <td>&nbsp;</td>
          <td>
	    <input type="submit" value="Log In">
          </td>
        </tr>
		[if config CookieLogin]
        <tr>
          <td align="right">
	    <INPUT TYPE=hidden NAME=mv_cookie_password VALUE=0><INPUT
TYPE=checkbox NAME=mv_cookie_password VALUE=1>
          </td>
          <td>Log me in automatically (sets cookie)</td>
        </tr>
		[/if]
        </table>
      </td>
    </tr>
    </table>
                       
    </form>

    <p>&nbsp;</p>
					  
[/if]

    <SCRIPT>    // JavaScript Form Validation Demo    // by Paul Colton
    function check_tax(form) {
        // Make sure the email field is not blank
        var foundState = false;
        var ch = form.state.value;
        ch = ch.toUpperCase();
		[loop list="__TAXAREA__"]
        if(ch == "[loop-code]") {
            alert("You will be charged [currency][fly-tax
[loop-code]][/currency] sales tax\nsince you are shipping to
[loop-code]. Click Recalculate to see the amount in your total.");
            foundState = true;
        }
		[/loop]
        return foundState;
    }
    </SCRIPT>

    <FORM ACTION="[process secure=1]" METHOD="POST" name=checkout>
    <INPUT TYPE=hidden NAME=mv_session_id VALUE="[data session id]">
    <INPUT TYPE=hidden NAME=mv_payment VALUE="PayPal">

    [if type=explicit compare="[error all=1 show_var=1 keep=1]"]
    <P>
	<B>There were errors in your last submission:<br>
	<blockquote>
	<FONT color="__CONTRAST__">
		[error all=1 keep=1 show_error=1 show_label=1
joiner="<br>"]
	</font>
	</blockquote>
	</p>
	<p>
    The areas you need to correct are shown in 
    <FONT color="__CONTRAST__">this color</FONT> below.</B>
    </p>
    [/if]

    <INPUT TYPE=hidden NAME=mv_doit VALUE=refresh>

    [comment] Order routes in catalog.cfg [/comment]

    <INPUT TYPE=hidden NAME=mv_order_route
VALUE="[either]__ORDER_ROUTES__[or]log quickbooks main
copy_user[/either]">
    <INPUT TYPE=HIDDEN NAME=mv_check    VALUE="Save_database">
    <INPUT TYPE=HIDDEN NAME=mv_successpage    VALUE="checkout2">
    <INPUT TYPE=HIDDEN NAME=mv_failpage    VALUE="ord/checkout">


    [if session logged_in]
      [set Save_database]
      [if cgi mv_todo ne submit]
	  [calc] Log("Saving userdb in mv_check.")[/calc]
	  [userdb save]
	  [/if]
      [/set]
    [/if]
	
    <table align="center">
    <tr>
      <td align="center">
	Please verify the information below and click the <b>"Place
    	Order"</b> button to process your order.
      </td>
    </tr>
    <tr>
      <td align="center" width="100%">
        <br>
        <table cellspacing="0" cellpadding="5" border="0" width="100%">
        <TR class="contentbar2">
          <td class="contentbar2">&nbsp;<b>Remove</b></td>
          <td class="contentbar2" align="center"><b>SKU</b></td>
          <td class="contentbar2"><b>Description</b></td>
          <td class="contentbar2"><b>Quantity</b></td>
          <td class="contentbar2" align="center"><b>Price</b></td>
          <td class="contentbar2"><b>Extension&nbsp;</b></td>
        </TR>
        <TBODY>

        [if items]
        [then]
        [item-list modular=1]

	<TR class="[item-alternate
2]maincontent[else]contentbar1[/else][/item-alternate]">
	  <TD align=center valign=top>
	    <INPUT TYPE=checkbox NAME="[quantity-name]"
onClick="this.form.action='[process-target]', this.form.submit()"
VALUE=0>
 	  </TD>
	  <TD><b>[item-sku]</b></TD>
	  <TD>[page [item-sku]]<b>[item-data products
description]</b></a>

	    [if scratch dealer]
	    [if-item-data pricing sku]
	      <BR>[page quantity [item-code]]
	      QUANTITY PRICING</A>
 	    [/if-item-data]
	    [/if]

        [if-item-data options o_enable]
            [if-item-data !options o_modular]
                [table-organize cols=4 table=' ' font="size=1" pretty=1]
                    [item-options td=1 label=1 bold=1 price=1]
                [/table-organize]
            [/if-item-data]
        [/if-item-data]

	    [if-item-field weight]
	    [seti weight][summary amount=`[item-quantity] * [item-field
weight]`][/seti]
	    [/if-item-field]
	  </TD>
	  <TD ALIGN=CENTER valign=top>
	    <INPUT TYPE=text NAME="[quantity-name]"
VALUE="[item-quantity]" SIZE=3>
 	  </TD>
	  <TD ALIGN=RIGHT>
	    [discount-price]
	    [if discount [item-code]]<BR>Item is discounted
[item-discount][/if]
	  </TD>
	  <TD ALIGN=RIGHT>[item-subtotal]</TD>
        </TR>

	[if session logged_in]
        <TR class="[item-alternate
2]maincontent[else]contentbar1[/else][/item-alternate]">
          <TD ALIGN=CENTER COLSPAN=2 VALIGN=TOP>
	    [if value separate_addresses]
	    [page href="@@MV_PAGE@@" form="
	    	separate_addresses=0
		mv_action=return
	    "]Same shipping address</A><br>
	    [page href="ord/basket" form="edit_addresses=1"]Edit
address</A><br>
	    [page href="ship_addresses"
form="ui_return_to=@@MV_PAGE@@"]Add address</A>
	    [else]
	    [page href="@@MV_PAGE@@" form="
		separate_addresses=1
		mv_action=return
	    "]Separate shipping</A>
	    [/else]
	    [/if]
          </td>
          <TD COLSPAN=4 VALIGN=TOP>
	    [if value separate_addresses]
	    <PRE>[item-modifier mv_ad]</pre>
	    [/if]&nbsp;
          </td>
        </TR>
        [/if]

        [/item-list]
        [/then]
        [else]
        <TR>
	  <TD ALIGN=CENTER COLSPAN=6 class="contentbar2">
            No items at the moment.
          </TD>
        </TR>

	[/else]
	[/if]
        </table>

        <br>

        <table border="0" cellspacing="0" cellpadding="0" width="50%">
        <TR>
          <td align="left">
			[if items]
            <INPUT TYPE=image VALUE="Refresh"
src="__THEME_IMG_DIR__recalculate_button.gif" border=0>
			[/if]
          </td>
          <td align="right">
            <table align="center" cellspacing="0" border="0">
            <tr>
              <TD ALIGN=left class="contentbar1">Subtotal: </TD>
              <TD ALIGN=RIGHT class="contentbar1">[subtotal]</TD>
            </TR>
            <TR>
              <TD ALIGN=left class="contentbar1">Sales Tax:</TD>
              <TD ALIGN=RIGHT class="contentbar1">[salestax]</TD>
            </TR>
            <TR>
              <TD ALIGN=left class="contentbar1">Shipping:</TD>
              <TD ALIGN=RIGHT class="contentbar1">[shipping]</TD>
            </TR>
			[if value mv_handling]
            <TR>
              <TD ALIGN=left class="contentbar1">Handling:</TD>
              <TD ALIGN=RIGHT class="contentbar1">[handling]</TD>
            </TR>
			[/if]
            <TR>
              <TD ALIGN=left class="contentbar2">TOTAL:</TD>
              <TD ALIGN=RIGHT class="contentbar2">[total-cost]</TD>
            </tr>
            </table>
          </td>
        </tr>
        </table>

      </td>
    </tr>

    <tr>
      <td>
	<br>
        <table cellspacing="0" cellpadding="0">
	<tr>
	  <td>
	    <table border="0" align="center" cellspacing="0">
	    <tr><td colspan="4">&nbsp;</td></tr>
	    <tr class="contentbar2">
	      <td class="contentbar2">
	        <b>&nbsp;Shipping Address<b>
	      </td>
	      <td class="contentbar2"><i>(primary)</i></td>
	      <td class="contentbar2">&nbsp;</td>
	      <td class="contentbar2">&nbsp;</td>
	    </tr>
	    <tr><td colspan="4" class="contentbar1">&nbsp;</td></tr>
	    <tr>
	      <td align=right class="contentbar1">
		[error name=fname std_label="First Name" required=1]
	      </td>
	      <td align=left class="contentbar1">
		<INPUT TYPE=text NAME=fname VALUE="[value fname]"
size="20" maxlength="20">
	      </td>
	      <td align="right" class="contentbar1">[error name=lname
std_label="Last Name" required=1]</td>
	      <td align="left" class="contentbar1"><INPUT TYPE=text
NAME=lname VALUE="[value lname]" size="20"></td>
	    </tr>
	    <tr>
	      [if scratch dealer]
	      <td align="right" class="contentbar1">[error name=company
std_label=Company required=1]
	      [else]
	      <td align="right" class="contentbar1">Company
	      [/else]
	      [/if]
	      </td>
	      <td align="left" class="contentbar1">
		<INPUT TYPE=text NAME=company VALUE="[value company]"
size="20" maxlength="40">
	      </td>
	      <td class="contentbar1">&nbsp;</td>
	      <td class="contentbar1">&nbsp;</td>
	    </tr>
	    <tr>
	      <td align="right" class="contentbar1">[error name=address1
std_label=Address required=1]
	    </td>
	    <td align="left" colspan=3 class="contentbar1">
	      <INPUT TYPE=text NAME=address1 VALUE="[value address1]"
size="40" maxlength="64">
   	    </td>
	  </tr>
	  <tr>
	    <td class="contentbar1">&nbsp;</td>
	    <td class="contentbar1" align="left" colspan=3>
	      <INPUT TYPE=text NAME=address2 VALUE="[value address2]"
size="40" maxlength="64">
	    </td>
	  </tr>
	  <tr class="contentbar1">
	    <td align="right" class="contentbar1">
	      [error name=city std_label="City" required=1]
	    </td>
	    <td class="contentbar1">
	      <INPUT TYPE=text NAME=city VALUE="[value city]" size="20"
maxlength="20">
	    </td>
	    <td class="contentbar1">&nbsp;</td>
	    <td class="contentbar1">&nbsp;</td>
	  </tr>
	  <tr>
	    <td class="contentbar1" align=right>[error name=state
std_label="State/Province" required=1]</td>
	    <td align="left" class="contentbar1">
	      [loop search="
		fi=state.txt
		sf=country
		se=[default country US]
		rf=state,name,country
		tf=sorder,name
		ml=100
	      "
	      option=state]
	      [on-match]<SELECT onChange="check_tax(this.form)"
NAME=state>
          
	      [/on-match]
	      [list]
	      [loop-change 1][condition][loop-param
country][/condition]<OPTGROUP LABEL="[data table=country col=name
key='[loop-param country]']">[/loop-change 1]
	      <OPTION VALUE="[loop-code]">[loop-pos 1]
	      [/list]
	      [on-match]</SELECT>[/on-match]
	      [no-match]<INPUT NAME=state VALUE="[value state]"
SIZE=20>[/no-match]
	      [/loop]
	    </td>
	    <td class="contentbar1">&nbsp;</td>
	    <td class="contentbar1">&nbsp;</td>
	  </tr>
	  <tr>
	    <td align="right" class="contentbar1">
	      [error name=zip std_label="Zip/Postal Code" required=1] 
	    </td>
	    <td class="contentbar1">
	      <INPUT TYPE=text NAME=zip VALUE="[value name=zip
filter=word]" size="10" maxlength="10">
	    </td>
	    <td class="contentbar1">&nbsp;</td>
	    <td class="contentbar1">&nbsp;</td>
	  </tr>
	  <tr>
	    <td align="right" class="contentbar1">
	      [error name=email std_label="Email Address" required=1]
	    </td>
	    <td class="contentbar1">
	      <INPUT TYPE=text NAME=email VALUE="[value email]"
size="30">
	    </td>
	    <td class="contentbar1">&nbsp;</td>
	    <td class="contentbar1">&nbsp;</td>
	  </tr>
	  <tr>
	    <td align="right" class="contentbar1">
	      Country
	    </td>
	    <td colspan="3" class="contentbar1">
	      [if value country =~ /(^$|US|CA)/]
	      <SELECT NAME=country onChange="this.form.submit()">
	      <OPTION VALUE="US"> United States
	      <OPTION [selected country CA] VALUE="CA"> Canada
	      <OPTION VALUE="JP"> Other
	      </SELECT>
	      [else]
	      <SELECT onChange="this.form.submit()" NAME=country>
	      
	      
	      
	      
	      
	      [loop option=country search="
		ra=yes
		fi=country
		st=db
		rf=code,name
		ml=1000
		tf=name
	      "]
	      <OPTION VALUE="[loop-code]"> [loop-data country name] 
	      [/loop]
	      </SELECT>
	      [/else]
	      [/if]
	      <small>(will update display)</small>
	    </td>
	  </tr>
	  <tr>
	    <td align="right" class="contentbar1">
	      [error name=day_phone std_label="Daytime Phone"
required=1]
	    </td>
	    <td class="contentbar1">
	      <input id="day_phone_a" maxLength="3" size="3"
name="day_phone_a" value="[value day_phone_a]">&nbsp;<input
id="day_phone_b" maxLength="3" size="3" name="day_phone_b" value="[value
day_phone_b]">&nbsp;<input id="day_phone_c" maxLength="4" size="4"
name="day_phone_c" value="[value day_phone_c]">
	    </td>
	    <td align="right" class="contentbar1">
	      [error name=night_phone std_label="Evening Phone"]
	    </td>
	    <td align="left" class="contentbar1">
	      <input id="night_phone_a" maxLength="3" size="3"
name="night_phone_a" value="[value night_phone_a]">&nbsp;<input
id="night_phone_b" maxLength="3" size="3" name="night_phone_b"
value="[value night_phone_b]">&nbsp;<input id="night_phone_c"
maxLength="4" size="4" name="night_phone_c" value="[value
night_phone_c]">
	    </td>
	  </tr>
	  [if session ship_message]

	  <tr>
	    <td class="contentbar1">&nbsp;</td>
	    <td colspan="3" class="contentbar1">
	      <B>Note:</B> [data session ship_message]
	    </td>
	  </tr>
	  [/if]							  
	  <tr>
	    <td align="right" class="contentbar1">
	      <b>Shipping method</b>
	    </td>
	    <td colspan="3" class="contentbar1">
	      <SELECT NAME=mv_shipmode>
	      
	      
	      
	      
	      
	      [shipping
	        label=1
        	mode=|[data table=country key='[default country US]'
col=shipmodes]|
              ]
	      </SELECT>
	    </td>
	  </tr>
	  <tr>
	    <td class="contentbar1">&nbsp;</td>
	    <td colspan="3" class="contentbar1">
	      <i>We need the <b>bold fields</b> to process your
order</i>
	    </td>
	  </tr>
	  <tr>
  	    <td class="contentbar1">&nbsp;</td>
	    <td class="contentbar1">&nbsp;</td>
	    <td class="contentbar1">&nbsp;</td>
	    <td class="contentbar1">&nbsp;</td>
	  </tr>
  	  <tr class="contentbar2">
	    <td class="contentbar2">Mailing Status</td>
	    <td colspan=3 class="contentbar2">&nbsp;</td>
  	  </tr>
  	  <tr>
	    <td align="center" valign="middle" class="contentbar1">
	      <SELECT NAME=email_copy>
	      <OPTION VALUE="1">Yes
	      <OPTION [selected name=email_copy value=0] VALUE="0">No
	      </SELECT>
	    </td>
	    <td class="contentbar1"><B>Send an email copy of my
receipt</B></td>
	    <td class="contentbar1">&nbsp;</td>
	    <td class="contentbar1">&nbsp;</td>
          </tr>
          <tr>
	    <td align="center" valign="middle" class="contentbar1">
	      &nbsp;
	      [perl tables="__UI_META_TABLE__ mv_metadata"]
	      return;
              [/perl]
	      [input-filter name=mail_list
op=null_to_space][/input-filter]
	      [display table=userdb type=multiple column=mail_list
key="[data session username]"]
	    </td>
	    <td class="contentbar1"><B>Mail lists (if any)</B></td>
	    <td class="contentbar1">&nbsp;</td>
	    <td class="contentbar1">&nbsp;</td>
	  </tr>
	  </table>
	</td>
      </tr>
      </table>

      </td>
    </tr>
    <tr><td>
      <br>
      <table align="center" cellpadding="10" cellspacing="10"><tr>
<INPUT TYPE="hidden" NAME="total_cost" VALUE="[total-cost]" size="40"
maxlength="64">
	[if items]
      <td> 
	[button 
		name="mv_click" 
		src="__THEME__/placeorder.gif" 
		text="Place Order"
		hidetext=1
		form=checkout
	]
		mv_todo=submit
	mv_order_profile=checkout_profile
	 mv_successpage=/ord/checkout2
	 mv_failpage=ord/checkout

	[/button]
      </td>
      <td>
	    [button
			name="mv_click"
			src="__THEME_IMG_DIR__recalculate_button.gif"
			text="Recalculate"
			hidetext=1
			form=checkout
		]
			mv_todo=refresh
		[/button]
      </td>
	[else]
		<td><b>No items in your shopping cart!</b></td>
	[/else]
	[/if]
      </tr></table>
        
      </form>
      [seti clear_errors][error all=1 hide=1 comment="Clear
errors"][/seti]

    </td></tr>
    </table>

    <p>			
			
    [include templates/components/specials]

  </td>
</tr>
</table>
</div>
<!-- END CONTENT -->

@_FF_NOLEFT_BOTTOM_@

************************************************************************
************************************************************************
*********************************checkout2******************************
*************

<HTML>
<HEAD>

[tmp dirty_cost][total-cost][/tmp]

[tmp clean_price][perl]
    my $FilterData = $Scratch->{dirty_cost};
    $FilterData =~ s/\$//g;
    return $FilterData;
[/perl][/tmp]

[tmp
raw_url]https://www.paypal.com/cgi-bin/webscr?cmd=_ext-enter&redirect_cm
d=_xclick&business=orders%40fashionfantasies.net&return=[area
ord/checkout3]&amount=[scratch
clean_price]&no_shipping=1&cancel_return=[area
paypal-failed]&no_note=1&item_name=Fashion+Fantasies+Order+[[cgi
lname],+[cgi fname]]&first_name=[cgi fname]&last_name=[cgi
lname]&address1=[cgi address1]&address2=[cgi address2]&city=[cgi
city]&state=[cgi state]&zip=[cgi zip]&night_phone_a=[cgi
night_phone_a]&night_phone_b=[cgi night_phone_b]&night_phone_c=[cgi
night_phone_c]&day_phone_a=[cgi day_phone_a]&day_phone_b=[cgi
day_phone_b]&day_phone_c=[cgi day_phone_c][/tmp]

[tmp wa_url][perl]
    my $FilterData = $Scratch->{raw_url};

    $FilterData =~ s/#*//g;
    return $FilterData; 
[/perl][/tmp]

<TITLE>Please wait....</TITLE>

</HEAD>
<BODY>

<H2> Please wait while you are transfered to the secure PayPal
area.</H2><BR>
If this page shows longer than 30 seconds, click <A href="[scratch
wa_url]">here</A>.
      
[bounce href="[scratch wa_url]"]

</BODY>
</HTML>



************checkout3 below*****************
<HTML>
<HEAD>

<TITLE>Please wait....</TITLE>

</HEAD>
<BODY>

<H2> Please wait while your order is processed...</H2><BR>
If this page shows longer than 30 seconds, click <A
href="[process]&mv_todo=submit&submit=Finalize!">here</A>.
      
[bounce href="[process]&mv_todo=submit&submit=Finalize!"]

</BODY>
</HTML>