簡體   English   中英

如何獲得paypal自適應支付IPN帖子?

[英]how to get the paypal adaptive payments IPN posts?

所以我的PHP IPN腳本正常工作,現在我只是不確定如何獲取帖子值? Paypal將帖子作為這樣的數組返回。

transaction[0].is_primary_receiver=false
&transaction[0].id_for_sender_txn=50E02759CC687801U
&log_default_shipping_address_in_transaction=false
&transaction[0].receiver=xxxxxxxxxx@gmail.com
&action_type=PAY
&transaction[1].status=Completed

顯然有更多,但你明白了,我試着訪問這個狀態的帖子。

$payment_status = $_POST['transaction'][1]['status']

但這不起作用,它返回的第一個字母是C.那么我該如何訪問所有這些值。

通過一點點搜索,我發現此鏈接有用: https//developer.paypal.com/webapps/developer/docs/classic/ipn/ht_ipn/

頁面最相關的部分:

// Reading POSTed data directly from $_POST causes serialization issues with array data in the POST.
// Instead, read raw POST data from the input stream. 
$raw_post_data = file_get_contents('php://input');
$raw_post_array = explode('&', $raw_post_data);
$myPost = array();
foreach ($raw_post_array as $keyval) {
    $keyval = explode ('=', $keyval);
    if (count($keyval) == 2)
        $myPost[$keyval[0]] = urldecode($keyval[1]);
}

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM