Zikula: A Flexible Open Source Content Management System
home | forum | contact us

Dizkus

Goto page: 1 - 2 [+1]

Bottom
URL Query String not working w/FORM GET method - workaround?
  • Posted: 27.11.2005, 06:21
     
    nate_02631
    rank:
    Professional Professional
    registered:
     September 2003
    Status:
    offline
    last visit:
    11.04.08
    Posts:
    3055
    I am finishing up development on PayPalCart 1.5 (a version of PPC for PN .760+ w/pnRender, etc...) and have run into one little snafu...

    With PayPal's Shopping Cart, you can pass along two URLs for the "return" pages, one for completed and one for cancelled transactions. The URL is used in a form's "Return to Merchant" button on PayPal's site when the transaction is completed (or cancelled).

    The URLs previously used in PayPalCart are standard PN function calls (i.e mysite.com/index.php?module=PayPalCart&func=popclose&win=thankyou), but because PayPal's Shopping Cart form uses GET (using the return URL as the action), it simply returns to mysite.com/index.php regardless if the transaction is completed or cancelled.

    Can anyone think of a clever way to work around this?

    My initial thought was to create two scripts in modules/PayPalCart, return_cancel.php & return_thankyou.php to be used as the return URLs which would have simple logic to direct the user to the appropriate page output function in the module. Problem is, I need access to the pnAPI and don't know how to get it in these *dummy* scripts (path errors, etc...)

    P.S. I wrote PayPal and suggested they change the form method to POST as it's probably screwin' other sites up - or not have a form at all, and use a URL instead as the form generate security warnings in certain browsers - I'm not too optimistic anything will change though...

    --
    Get PhotoGallery, PayPalCart, Dynamenu, Enhanced Blocks & other mods

    Cape Cod Travel Info...
  • Posted: 28.11.2005, 18:54
     
    Lobos
    rank:
    Professional Professional
    registered:
     December 2002
    Status:
    offline
    last visit:
    24.08.08
    Posts:
    1588
    I can vaguely remember being able to add params to the actual form action - not sure if this can help, but maybe worth a try...

    -Lobos

    --
    -Lobos
    Professional PHP Framework Services: Concept, Development and Deployment
  • Posted: 28.11.2005, 19:09
     
    nate_02631
    rank:
    Professional Professional
    registered:
     September 2003
    Status:
    offline
    last visit:
    11.04.08
    Posts:
    3055
    Thanks Lobos, can you elaborate as I'm not sure what you mean...

    As it is now, I am passing a *query string* as the return URLs to PayPal , but they are getting lopped off...

    --
    Get PhotoGallery, PayPalCart, Dynamenu, Enhanced Blocks & other mods

    Cape Cod Travel Info...
  • Posted: 28.11.2005, 21:02
     
    rank:
    Moderator Moderator
    registered:
     March 2002
    Status:
    offline
    last visit:
    26.08.08
    Posts:
    7720
    Nate,

    What Adam means, I think, is that you can also pass the elements of the query string as hidden form fields assuming that paypal will pass POST values back. If not then i'm not sure that there's an easy solution aside from seperate files inside the PN root.

    -Mark
  • Posted: 28.11.2005, 21:47
     
    nate_02631
    rank:
    Professional Professional
    registered:
     September 2003
    Status:
    offline
    last visit:
    11.04.08
    Posts:
    3055
    Thanks - I have a feeling that won't work...

    I hate to resort to including file in the PN root in my module distribution - guess I'll have to see if PayPal comes around (doubt it)...

    --
    Get PhotoGallery, PayPalCart, Dynamenu, Enhanced Blocks & other mods

    Cape Cod Travel Info...
  • Posted: 28.11.2005, 21:59
     
    Lobos
    rank:
    Professional Professional
    registered:
     December 2002
    Status:
    offline
    last visit:
    24.08.08
    Posts:
    1588
    no I meant including the params in the action attribute - ie:

    <form action="index.php?module=PayPalCart&func=popclose&win=thankyou">

    I am not really 100% sure about what you are trying to do, but I thougt this could (outside chance) help - actually I am not sure if you can do the above - I just vaguely remember doing something along these lines once....

    -Lobos

    --
    -Lobos
    Professional PHP Framework Services: Concept, Development and Deployment</form>
  • Posted: 28.11.2005, 22:29
     
    nate_02631
    rank:
    Professional Professional
    registered:
     September 2003
    Status:
    offline
    last visit:
    11.04.08
    Posts:
    3055
    Hi - yes, actually that is what I'm doing - passing the *full* URL that PayPal will goto upon completing a transaction... however PP uses GET instead of POST, so it is not working...

    --
    Get PhotoGallery, PayPalCart, Dynamenu, Enhanced Blocks & other mods

    Cape Cod Travel Info...
  • Posted: 28.11.2005, 22:59
     
    rank:
    Moderator Moderator
    registered:
     March 2002
    Status:
    offline
    last visit:
    26.08.08
    Posts:
    7720
    Nate,

    Parameters in the URL are GET parameters hence the confusion. PP is obviously doing more than simply using GET over POST.

    -Mark
  • Posted: 29.11.2005, 01:38
     
    Chestnut
    rank:
    Steering Committee Steering Committee
    registered:
     August 2002
    Status:
    offline
    last visit:
    03.03.08
    Posts:
    1221
    Nate,

    See the Paypal documentation, all is there along with either a URL in your PayPal seller setting and/or a URL parameter in the available hidden fields you can put in your form.

    http://www.paypal.com/cgi-bin/webscr?cmd=_merchant-outside

    https://www.paypal.com/cgi-bin/webscr?cmd=_resource-center#wpstandard

    :wink:

    --
    Chestnut !
    Support via Private message won't be answered...
    http://dev.pnconcept.com
    http://www.postnuke-france.org
  • Posted: 29.11.2005, 01:49
     
    nate_02631
    rank:
    Professional Professional
    registered:
     September 2003
    Status:
    offline
    last visit:
    11.04.08
    Posts:
    3055
    Yes... thank you I know... the *problem* is URLs such as mysite.com/index.php?module=PayPalCart&func=popclose&win=thankyou do not seem to be recognized via FORM GET whether included in your PP Profile setup, or passed along as either the return_url, or return_cancel_url...

    Query string doesn't come along for the ride...

    Unless there's something I missed?

    --
    Get PhotoGallery, PayPalCart, Dynamenu, Enhanced Blocks & other mods

    Cape Cod Travel Info...
  • Posted: 29.11.2005, 02:03
     
    Chestnut
    rank:
    Steering Committee Steering Committee
    registered:
     August 2002
    Status:
    offline
    last visit:
    03.03.08
    Posts:
    1221
    ??

    Both my PayPal profiles are using ht tp : // my site.com/index.php?module=pncPayPal&func=thankyou

    All variables sent and returned by Paypal are available via pnVarCleanFromInput.

    Never add a problem with that. (Although one thing I didn't tried is to put the URL in the "return_url"... never had to use it).
    :wink:

    --
    Chestnut !
    Support via Private message won't be answered...
    http://dev.pnconcept.com
    http://www.postnuke-france.org
  • Posted: 29.11.2005, 02:14
     
    nate_02631
    rank:
    Professional Professional
    registered:
     September 2003
    Status:
    offline
    last visit:
    11.04.08
    Posts:
    3055
    Are you sure - have you checked it lately? I don't know if something's changed, but the RETURN TO MERCHANT button on PayPal's Shopping Cart uses a FORM/GET method which doesn't work correctly and directs the user instead to the index.php page... Dunno if you are talking about "donate" or another section - maybe it's different...

    I think I did try setting it in the profile - though I'll need to turn off the hidden field PPC send - though I don't see how that'd make a difference...

    --
    Get PhotoGallery, PayPalCart, Dynamenu, Enhanced Blocks & other mods

    Cape Cod Travel Info...
  • Posted: 29.11.2005, 02:21
     
    Chestnut
    rank:
    Steering Committee Steering Committee
    registered:
     August 2002
    Status:
    offline
    last visit:
    03.03.08
    Posts:
    1221
    100% sure although I use it for donation...

    Paypal doesn't (or isn't supposed to) make a difference and use the link you give "AS IS"... The thank you page is set to execute a last call to PayPal to get the transaction information... the thankyou page is a POST (from Paypal) to your thank you link...

    In the thank you function, you get the transaction id that you must send back with your seller id to get the transaction information...

    Code

    $tx_token = pnVarCleanFromInput('tx');


    Etc... etc... you know the rest I guess :)

    --
    Chestnut !
    Support via Private message won't be answered...
    http://dev.pnconcept.com
    http://www.postnuke-france.org
  • Posted: 29.11.2005, 02:23
     
    Chestnut
    rank:
    Steering Committee Steering Committee
    registered:
     August 2002
    Status:
    offline
    last visit:
    03.03.08
    Posts:
    1221
    Doc I give with pncPayPal (it tells about the thank you link that people must set in their PP profile)

    http://dev.pnconcept.com/modules/pncPayPal/pndocs/pncPayPal.pdf

    Did I forgot to mention that the PDT (PayPal Data Transfer) must be active in the PayPal profile ?...

    Well... I guess that now it's done. :)

    --
    Chestnut !
    Support via Private message won't be answered...
    http://dev.pnconcept.com
    http://www.postnuke-france.org
  • Posted: 29.11.2005, 02:28
     
    nate_02631
    rank:
    Professional Professional
    registered:
     September 2003
    Status:
    offline
    last visit:
    11.04.08
    Posts:
    3055
    Well, I'd check my own donate link, but it's broken - again...

    So you're saying at the end of the donate sequence, the "Thank You" or "Return to Merchant" button *on PayPal* that sends you back to your site's thank you page is a FORM/POST?

    It's definately a FORM/GET on the shopping cart which is the root of my problem... Unless I can somehow send it hidden vars, as Mark suggests, which I know I can't :x

    --
    Get PhotoGallery, PayPalCart, Dynamenu, Enhanced Blocks & other mods

    Cape Cod Travel Info...

Goto page: 1 - 2 [+1]

Main Menu

Extensions Database

Documentation

Development

Login

Donate to Zikula