如何在所有的支付宝交易返费
问题描述:
我正在与巴西的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余额付款时,返回这个属性
答
在某些交易,例如,没有任何费用。这可能是原因。
贝宝费用:https://www.paypal.com/webapps/helpcenter/article/?currentIssueID=11927&topicID=11500006&m=TCI