I am trying to get the instant payment notification module on paypal to work with my server. I have this script running fine on regular transactions, but on subscriptions it doesn't work. PayPal said that the subscriptions engine that interacts with the database is pickier than the standard one, and that it only accepts the variables from your script if they are in the same order that was sent. I can't seem to get them to be in the same order as they were sent to me. Any ideas?
#!/usr/bin/perl my $query=''; my @inp=split(/\:/,$input{input_fields}); foreach my $ikey (@inp){ next if $ikey=~/inview|cid/is; $query .= "\&$ikey=$input{$ikey}"; } $query .= '&cmd=_notify-validate'; # post back to PayPal system to validate (in same order as they passed + it to us) use LWP::UserAgent; $ua = new LWP::UserAgent; $req = new HTTP::Request 'POST','http://www.paypal.com/cgi-bin/webscr' +; $req->content_type('application/x-www-form-urlencoded'); $req->content($query); $res = $ua->request($req); my $result=''; if ($res->is_error) { $result='HTTP Error'; print 'HTTP Error\n'; } else{ $result = $input{payment_status}; } print "\nRESULT:$result\n";


Michael Jensen
michael at inshift.com
http://www.inshift.com

In reply to post variables in same order by inblosam

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.