0

私はPayPalサンドボックスでいくつかのeコマースのもので遊んでいます。これまでのところ、これはアプリケーションの流れです。

  • ユーザーがログインすると、サーバーはデータベースからのセッションにuser_idを保存します。ユーザーはログインしたら[今すぐ購入]ボタンをクリックできます。ペイパルに移動し、ログインして支払いを行うと、IPNは通知を受け取ります:)

これを拡張するために今やりたいのは、users_idを受信するIPNから作成して、データベースエントリにフラグを設定できるようにすることだけです。これはPayPalで行うことができますか?

私はビューで次のことを試みました:

<form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post">
  <input type="hidden" name="cmd" value="_s-xclick">
  <input type="hidden" name="hosted_button_id" value="--ID-FROM-PAYPAL--">
  <input type="hidden" name="user_id" value="<?php echo $user_id;?>">
  <input type="image" src="https://www.sandbox.paypal.com/en_US/i/btn/btn_buynowCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
  <img alt="" border="0" src="https://www.sandbox.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1">
</form>

助けてくれてありがとう :)

4

1 に答える 1

2
<input type="hidden" name="custom" id="custom" value="<?php echo $user_id;?>"/>

IPNは$_POST['custom']変数でuserIDを受け取ります。

複数の値をPaypalに渡し、IPNに戻す場合:

    <script type="text/javascript">
          // using prototype
      function checkCustom(){
        var custom1 = $F('custom1');
        var custom2 = $F('custom2');
        $('custom').value = '{"userID":"'+ custom1 +'","publicDonation":"'+ custom2 +'"}';

      }
    </script>
<input type="hidden" name="custom1" id="custom1" value="<?php echo $user_id;?>"/>
<input type="hidden" name="custom2" id="custom2" value="<?php echo $user_email;?>"/>

詳細については、ペイパルのIPNを確認してください。

習慣

商人であるあなたから渡されたカスタム値。これらは、顧客に提示されることのないパススルー変数です。長さ:255文字

https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=developer/e_howto_html_IPNandPDTVariables#id091EAB0105Z

于 2012-09-11T13:10:06.153 に答える