Good Afternoon
I’m making a paypal integration with a Brasilian Magento Platform and I have to capture the fee returned by 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 //--------//
I get the fee by giving to PayPal the transaction Id (txv_id) but it only works in some transactions. In some transactions PayPal returns fee = 0.
I made a script to fill a data table with a range of transaction but of the 40 transactions made through paypal I just got 2 fees. The transactions have the same product and the same price, but not always the same fee
I want know if PayPal has some another way to return this attribute