【问题标题】:How to return fee in all PayPal transactions如何在所有 PayPal 交易中退还费用
【发布时间】:2012-07-30 21:07:27
【问题描述】:

下午好

我正在将 paypal 与巴西 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 是否有其他方法可以返回此属性

【问题讨论】:

    标签: magento curl paypal nvp


    【解决方案1】:

    在某些交易中,例如使用您的 PayPal 余额付款时,是免费的。这可能是原因。

    支付宝费用:https://www.paypal.com/webapps/helpcenter/article/?currentIssueID=11927&topicID=11500006&m=TCI

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-05-11
      • 2013-12-28
      • 2011-12-22
      • 1970-01-01
      • 2016-07-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多