Passing and Parse PayPal IPN Custom field

后端 未结 3 1480
梦谈多话
梦谈多话 2020-12-06 06:37

I have setup a PayPal IPN file. When the user is at the site and press submit details about the transaction is uploaded to the db. The relevant id is sent via PayPal as the

3条回答
  •  清歌不尽
    2020-12-06 07:25

    Here is an example using JSON:

    
    
    

    Then on the other side:

    $custom = json_decode($_POST['custom'], true);
    $member_id = $custom[0];
    $coupon = $custom[1];
    

    You can also parse associative arrays too:

     $member_id, 'coupon' => $coupon);
      $data = json_encode($arr);
    ?>
    
    

    Then on the other side:

    $custom = json_decode($_POST['custom'], true);
    $member_id = $custom['id'];
    $coupon = $custom['coupon'];
    

    There's a nice symmetry when using JSON to parse the data.

提交回复
热议问题