Standalone to Paypal direct

Ken Ray kray at sonsothunder.com
Mon Aug 14 13:37:03 CDT 2006


On 8/13/06 7:32 PM, "Shari" <shari at gypsyware.com> wrote:

> The following is a sample paypal form from their website.  What would
> need to be changed for it to work directly from a standalone,
> completely bypassing my website altogether?
> 
> 
> <FORM ACTION="https://www.paypal.com/cgi-bin/webscr" METHOD="POST">
> <INPUT TYPE="hidden" NAME="cmd" VALUE="_ext-enter">
> <INPUT TYPE="hidden" NAME="redirect_cmd" VALUE="_xclick">
> <INPUT TYPE="hidden" NAME="business" VALUE="recipient at paypal.com">
> <INPUT TYPE="hidden" NAME="undefined_quantity" VALUE="1">
> <INPUT TYPE="hidden" NAME="item_name" VALUE="hat">
> <INPUT TYPE="hidden" NAME="item_number" VALUE="123">
> <INPUT TYPE="hidden" NAME="amount" VALUE="15.00">
> <INPUT TYPE="hidden" NAME="shipping" VALUE="1.00">
> <INPUT TYPE="hidden" NAME="shipping2" VALUE="0.50">
> <INPUT TYPE="hidden" NAME="currency_code" VALUE="USD">
> <INPUT TYPE="hidden" NAME="first_name" VALUE="John">
> <INPUT TYPE="hidden" NAME="last_name" VALUE="Doe">
> <INPUT TYPE="hidden" NAME="address1" VALUE="9 Elm Street">
> <INPUT TYPE="hidden" NAME="address2" VALUE="Apt 5">
> <INPUT TYPE="hidden" NAME="city" VALUE="Berwyn">
> <INPUT TYPE="hidden" NAME="state" VALUE="PA">
> <INPUT TYPE="hidden" NAME="zip" VALUE="19312">
> <INPUT TYPE="hidden" NAME="lc" VALUE="US">
> <INPUT TYPE="hidden" NAME="email" VALUE="buyer at domain.com">
> <INPUT TYPE="hidden" NAME="night_phone_a" VALUE="610">
> <INPUT TYPE="hidden" NAME="night_phone_b" VALUE="555">
> <INPUT TYPE="hidden" NAME="night_phone_c" VALUE="1234">
> <INPUT TYPE="image"
> SRC="http://www.paypal.com/en_US/i/btn/x-click-but01.gif" BORDER="0"
> NAME="submit" ALT=Make payments with PayPal - it's fast, free and
> secure!>
> </FORM>

Yes, you can submit forms directly using the "post" command in MC.
Basicallly you take the "ACTION" as the initial URL and then each of the
parameters (identified with the NAME parameter of each INPUT above) and
their values constructed in the form:

  field=value

And then put "&" between them, and a "?" between the ACTION and the first
parameter. Make sure that the 'value' portion above is urlencoded (doesn't
seem to be a problem with most of the params above, but couldn't hurt.

This would construct a long URL that looks like this:

  https://www.paypal.com/cgi-bin/webscr?cmd=_ext-enter&redirect_cmd=_xclick
... etc.

I usually use a repeat loop to set this up:

on mouseUp
  put "https://www.paypal.com/cgi-bin/webscr" into tURL
  put "cmd,redirect_cmd,business,undefined_quanity,item_name" into tParams
  put "_ext_enter,_xclick,recipient at paypal.com,1,hat" into tValues
  put "" into tParamString
  repeat with x = 1 to the number of items of tParams
    if x = 1 then
    put t(item x of tParams) & "=" & urlencode(item x of tValues) \
       into tParamString
    put tParamString & "&" & (item x of tParams) & "=" & \
       urlencode(item x of tValues) into tParamString
  end repeat
  post tParamString to tURL
  -- post returns a single CR if successful, otherwise it returns an error
  if the result is CR then
    -- good result
  else
    -- bad result
  end if
End mouseUp

I only showed a small handful of parameters above, but you get the idea. If
not, let me know and I'll clarify.

Ken Ray
Sons of Thunder Software
Web site: http://www.sonsothunder.com/
Email: kray at sonsothunder.com

  



More information about the metacard mailing list