1
我正在與巴西的Magento的平臺PayPal的整合,我要捕捉貝寶返回
//---------//routine to recover the fee on database Paypal//--------//
$nvp = array(
//'TRANSACTIONID' => '7W763566L0166562G',
'TRANSACTIONID' => $transactionId,
'METHOD' => 'GetTransactionDetails',
'PWD' => 'UVAYAK9WMNPP75KA',
'USER' => 'leonardoccleao_api1.gmail.com',
'SIGNATURE' => 'AFcWxV21C7fd0v3bYYYRCpSSRl31AYlssmYYHWWmVugX7vy.se0mIMAM',
'VERSION' => '84',
);
$curl = curl_init();
curl_setopt($curl , CURLOPT_URL , 'https://api-3t.paypal.com/nvp');
curl_setopt($curl , CURLOPT_SSL_VERIFYPEER , false);
curl_setopt($curl , CURLOPT_RETURNTRANSFER , 1);
curl_setopt($curl , CURLOPT_POST , 1);
curl_setopt($curl , CURLOPT_POSTFIELDS , http_build_query($nvp));
$response = urldecode(curl_exec($curl));
$responseNvp = array();
if (preg_match_all('/(?<name>[^\=]+)\=(?<value>[^&]+)&?/' , $response , $matches)) {
foreach ($matches[ 'name' ] as $offset => $name) {
$responseNvp[ $name ] = $matches[ 'value' ][ $offset ];
}
}
$fee_amount = $responseNvp['FEEAMT'];//fee recovered
echo $fee_amount;//I get to print the fee
curl_close($curl);
//---------/end routine to recover the fee on database Paypal //--------//
我得到的費費通過給PayPal交易Id(txv_id),但它只適用於某些交易。在一些交易PayPal返回費= 0.
我做了一個腳本來填寫一個數據表與一系列的交易,但通過貝寶做的40個交易我只有2個費用。該交易具有相同的產品和相同的價格,但並不總是相同的費用
我想知道如果貝寶有一定的另一種方式與您的PayPal餘額付款時,返回這個屬性