[ic] Need help with JT Justman's PayPal integration Instructions

Julia Jacobs interchange-users@interchange.redhat.com
Thu Feb 14 19:53:01 2002


I've been messing with JT Justman's .txt PayPal integration Instructions
that he graciously posted Jan, 22
http://www.signless.com/paypal/paypal-how.txt

and I got stuck on something.  Mainly how to set up the content section of
the ord/checkout.html page.  I don't know what he means by "Neuter" and
where exactly to put his form code within the content area.  I've cut and
pasted his instructions (they are indented) in this e-mail to show you what
I've done so far:

> Okay, here's my description of how to make PayPal work with Interchange. This
> is quite rough, and I might be leaving something out. I'm no programmer, but
> this gets the job done for me. Please backup all important things before
> trying this.
> Preliminaries:
> Get the web accept manual! I couldn't find it on their site, but I will upload
> a copy to http://www.signless.com/paypal/wa_manual_v5.0.pdf
> I had to change the format of my userdb some. First, I let PayPal handle the
> "billing address" completely, so I removed that. Second I changed the phone
> numbers into three separate fields each:
> | night_phone_a            | smallint(6)   | YES  |     | NULL    |       |
> | night_phone_b            | smallint(6)   | YES  |     | NULL    |       |
> | night_phone_c            | smallint(6)   | YES  |     | NULL    |       |
> | day_phone_a              | smallint(6)   | YES  |     | NULL    |       |
> | day_phone_b              | smallint(6)   | YES  |     | NULL    |       |
> | day_phone_c              | smallint(6)   | YES  |     | NULL    |       |

I did this.  I did not remove the billing address though.

> This is how PayPal want it passed. You could also use a regex to break it down
> I suppose but this is simpler if you're starting from scratch.
> Okay, on to business.
> 
> This is where I get screwed up.  How can you have a checkout page so the
> customer can choose PayPal as well as other credit card options?  Where does
> this form info go?  Where does the set containers go within the rest of the
> checkout.html content?:
> 
> Checkout:
> Neuter the checkout page. The initial takes the user's info and checks it. I
> also put a little explanation of how the checkout works and a PayPal logo.
> Here's the most relivant lines from mine:
> 
> <pre>
> <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_order_route
> VALUE="[either]__ORDER_ROUTES__[or]log main copy_user[/either]">
> <INPUT TYPE=HIDDEN NAME=mv_check    VALUE="Save_database">
> 
> [set Continue Shopping]
> mv_todo=go
> mv_nextpage=index
> [/set]
> 
> [set Recalculate]
> mv_todo=refresh
> mv_nextpage=ord/checkout
> [/set]
> 
> [set Place Order]
> mv_todo=submit
> mv_order_profile=checkout_initial
> mv_successpage=checkout2
> mv_failpage=ord/checkout
> [/set]
> 
> <INPUT TYPE=submit NAME=mv_click VALUE="Continue Shopping">
> <INPUT TYPE=submit NAME=mv_click VALUE="Recalculate">
> <INPUT TYPE=submit NAME=mv_click VALUE="Place Order">
> </pre>
> 
> Basically, the if the customer places the order it is checked against the
> order profile checkout_initial. If it fails it is returned to checkout for
> error processing as normal; if it succeeds it is sent to the page called
> checkout2 which bounces them to PayPal (see below).
> 
> The order profiles:
> 
> 
> 
> I added the following to profiles.order:
> __NAME__                            checkout_initial
> fname=required
> lname=required
> address1=required
> city=required
> country=required
> [if value country =~ /^(US|CA)$/i]
>   state=state_province
>   zip=postcode
> [/if]
> &fatal = yes
> email=required
> email=email
> &set = mv_payment Incomplete
> &final = no
> &setcheck=mv_email [value email]

> __NAME__                            checkout_profile
> fname=required
> lname=required
> address1=required
> city=required
> country=required
> [if value country =~ /^(US|CA)$/i]
>   state=state_province
>   zip=postcode
> [/if]
> &fatal = yes
> email=required
> email=email
> &set = mv_payment Complete
> &final = yes
> &setcheck=mv_email [value email]

I did that too although I'm not sure if these should be added before or
after.  I have mine set like this now:

__NAME__ Logout_choice

[if type=explicit compare="[userdb function=logout clear='[cgi
clear_values]']"]
    [set mv_no_count]1[/set]
    [set mv_no_session_id]1[/set]
    [if cgi clear_cart]
    [calc] @$Items = (); return; [/calc]
    mv_nextpage=[either][cgi mv_successpage][or][cgi mv_nextpage][/either]
[else]
    mv_nextpage=[either][cgi mv_failpage][or][cgi mv_nextpage][/either]
[/else]
[/if]

__END__

__NAME__ Logout

[if type=explicit compare="[userdb function=logout clear=1]"]
    [set mv_no_count]1[/set]
    [set mv_no_session_id]1[/set]
    mv_nextpage=[either][cgi mv_successpage][or][cgi mv_nextpage][/either]
[else]
    mv_nextpage=[either][cgi mv_failpage][or][cgi mv_nextpage][/either]
[/else]
[/if]

__END__

__NAME__ Login

[if type=explicit compare="[userdb login]"]
    [set mv_no_count][/set]
    [set mv_no_session_id][/set]
    mv_nextpage=[either][cgi mv_successpage][or][cgi mv_nextpage][/either]
[else]
    mv_nextpage=[either][cgi mv_failpage][or][cgi mv_nextpage][/either]
[/else]
[/if]

__END__

__NAME__ Change_password

[if type=explicit compare="[userdb change_pass]"]
    mv_nextpage=[either][cgi mv_successpage][or][cgi mv_nextpage][/either]
[else]
    mv_nextpage=[either][cgi mv_failpage][or][cgi mv_nextpage][/either]
[/else]
[/if]

__END__

__NAME__                            checkout_initial
fname=required
lname=required
address1=required
city=required
country=required
[if value country =~ /^(US|CA)$/i]
    state=state_province
    zip=postcode
[/if]

&fatal = yes
email=required
email=email

&set = mv_payment Incomplete

&final = no
&setcheck=mv_email [value email]

__END__

__NAME__                            checkout_profile
fname=required
lname=required
address1=required
city=required
country=required
[if value country =~ /^(US|CA)$/i]
    state=state_province
    zip=postcode
[/if]

&fatal = yes
email=required
email=email

&set = mv_payment Complete

&final = yes
&setcheck=mv_email [value email]

__END__


> ---------------------------------------------------------
> The first profile, checkout_initial, simply ensures that everything is there.
> The important part is &final = no... we do not want to submit the order yet.
> The second profile is the final profile that is &final. Obviously you can
> check on more fields, mine is fairly simple.
> 
> checkout2:
> This where the magic happens:
> <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_cmd=_xclick&busi
> ness=payment%40edenclothing.com&return=[area
> ord/paypal_standby]&amount=[scratch
> clean_price]&no_shipping=1&cancel_return=[area
> paypal-failed]&no_note=1&item_name=Eden+Clothing+Purchase&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_1]&night_phone_b=[cgi night_phone_2]&night_phone_c=[cgi
> night_phone_3]&day_phone_a=[cgi day_phone_1]&day_phone_b=[cgi
> day_phone_2]&day_phone_c=[cgi day_phone_3][/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>

Made a ord/checkout2.html page

Also PayPal has a perl verification script.  As well as a VB/ASP script.
Both are in a .PDF JT Justman posted:
http://www.signless.com/paypal/wa_manual_v5.0.pdf

I know in simple mailforms I put the link to a perl script in the form
action part.  Išve done forms that integrate with Authorizenet Credit Card
Verification Transaction Screens where I also put a url in the form action
that is a link to a perl script residing in my cgi-bin.  Can this be done in
the checkout.html page in the form?

HELP!!!!!!!
-- 
Julia Jacobs
Currant Media
407-977-4523
Fax 407-261-0176
http://www.currantmedia.com
Members of The Better Business Bureau
* Multimedia Producers
* Web Design & Development
* 2D/3D Graphics/Animation
* Hosting, domain and e-mail
* E-Commerce ­ check, credit card validation