Payflow Error 52:在测试模式下执行事务的权限不足

时间:2014-04-23 07:38:39

标签: codeigniter paypal payflowlink

我正在尝试在codeigniter上以测试模式配置payflow链接应用程序。我和Angell EYE一起做PHP CodeIgniter Class Library for PayPal

我已经设置了开发人员沙盒帐户并添加了Business-Pro类型的用户和个人类型的用户。

我在manager.payflow.com上设置了一个帐户,并添加了一个角色为“API_FULL_TRANSACTIONS”的用户。

现在这是我的/application/config/paypal.php文件:

<?php  
    if ( ! defined('BASEPATH')) exit('No direct script access allowed');
    $config['Sandbox'] = TRUE;
    $config['APIVersion'] = '98.0';
    $config['APIUsername'] = $config['Sandbox'] ? '/*here goes Business user    username from sandbox*/' : '';
    $config['APIPassword'] = $config['Sandbox'] ? '/*here goes Business user password*/' : '';
    $config['APISignature'] = $config['Sandbox'] ? '/*here goes Business user API signature*/' : '';

    $config['PayFlowUsername'] = $config['Sandbox'] ? '/*here goes username of a user with API_FULL TRANSACTIONS role on manager.paypal.com*/' : '';
    $config['PayFlowPassword'] = $config['Sandbox'] ? '/*here goes password of a user with API_FULL TRANSACTIONS role on manager.paypal.com*/' : '';
    $config['PayFlowVendor'] = $config['Sandbox'] ? '/*here goes login to manager.paypal.com*/' : '';

    $config['PayFlowPartner'] = $config['Sandbox'] ? 'PayPal' : '';
    $config['ApplicationID'] = $config['Sandbox'] ? '' : 'PRODUCTION_APP_ID_GOES_HERE';
    $config['DeveloperEmailAccount'] = '/*my email at developer.paypal.com*/';
    $config['DeviceID'] = '';

接下来我在/application/controllers/payflow.php控制器中运行该函数:

function Process_transaction_demo()
{
    $PayPalRequestData = array(
        'tender'=>'P', //also tried this with 'C'
        'trxtype'=>'S',
        'acct'=>'/*here goes card number for Personal type sandbox acct*/',
        'expdate'=>'0419', // as in sandbox Personal acct settings
        'amt'=>'10.00',
        'dutyamt'=>'',
        'freightamt'=>'5.00',
        'taxamt'=>'2.50', 
        'taxexempt'=>'',
        'comment1'=>'This is a test!',
        'comment2'=>'This is only a test!',
        'cvv2'=>'123',
        'recurring'=>'',
        'swipe'=>'',
        'orderid'=>'',
        'billtoemail'=>'', // as in sandbox Personal acct settings
        'billtophonenum'=>'816-555-5555',
        'billtofirstname'=>'Tester',
        'billtomiddlename'=>''
        'billtolastname'=>'Testerson',
        'billtostreet'=>'123 Test Ave.',
        'billtocity'=>'Kansas City',
        'billtostate'=>'MO',
        'billtozip'=>'64111',
        'billtocountry'=>'US',
        'shiptofirstname'=>'Tester',
        'shiptomiddlename'=>'',
        'shiptolastname'=>'Testerson',
        'shiptostreet'=>'123 Test Ave.',
        'shiptocity'=>'Kansas City',
        'shiptostate'=>'MO',
        'shiptozip'=>'64111',
        'shiptocountry'=>'US',
        'origid'=>'',
        'custref'=>'',              
        'custcode'=>'',              
        'custip'=>'',                
        'invnum'=>'',               
        'ponum'=>'',                 
        'starttime'=>'',            
        'endtime'=>'',              
        'securetoken'=>'',          
        'partialauth'=>'',              
        'authcode'=>''          
        );

    $PayPalResult = $this->paypal_payflow->ProcessTransaction($PayPalRequestData);

    if(!$this->paypal_payflow->APICallSuccessful($PayPalResult['RESULT']))
    {
        // Error
        echo '<pre />';
        print_r($PayPalResult);
    }
    else
    {
        // Successful call.  Load view or whatever you need to do here.
        echo '<pre />';
        print_r($PayPalResult);
    }
}

我得到的回应是:

Array
(
    [RESULT] => 52
    [PNREF] => A7P06B2A9D83
    [RESPMSG] => Insufficient permissions to perform transaction
    [RAWREQUEST] => /*request details*/
    [RAWRESPONSE] => RESULT=52&PNREF=A7P06B2A9D83&RESPMSG=Insufficient permissions to perform transaction
)

为什么会一直返回此错误? manager.paypal.com上的用户权限设置为“API_FULL_TRASACTIONS”(也尝试使用“ADMIN”,“ADMIN_TRANSACTIONS”,“FULL_TRASACTIONS” - 都给出相同的响应)。

处理测试付款的配置应该是什么?

1 个答案:

答案 0 :(得分:2)

所以,你在第一段中说过PayFlow Link,但这与Express Checkout或Payments Pro完全不同,这就是你在这里尝试的。

如果您使用TENDER = C并且您收到该错误,则可能意味着您没有在PayPal帐户上启用Payments Pro。您提到过,但是您能否确认它已经实际激活并设置为测试模式?登录PayPal Manager站点时,您应该在概述页面上看到一个包含帐户状态的小表。

如果您使用P尝试设置快速结账流程,则需要确保从请求中删除信用卡号。

作为旁注,您粘贴的示例代码在billtomiddlename参数之后的$ PayPalRequestData数组中缺少逗号。我必须在它运行之前解决这个问题。

通过修复,我能够使用PayFlow文档中的测试信用卡号成功运行您的样本请求。

Array
(
    [RESULT] => 0
    [PNREF] => A10M6CE2A65B
    [RESPMSG] => Approved
    [AUTHCODE] => 000041
    [AVSADDR] => Y
    [AVSZIP] => N
    [CVV2MATCH] => Y
    [PROCAVS] => A
    [PROCCVV2] => M
    [TRANSTIME] => 2014-04-23 01:43:58
    [BILLTOFIRSTNAME] => Tester
    [BILLTOLASTNAME] => Testerson
    [AMT] => 10.00
    [ACCT] => 1881
    [EXPDATE] => 0419
    [CARDTYPE] => 0
    [IAVS] => N
    [RAWREQUEST] => BUTTONSOURCE[18]=AngellEYE_PHPClass&VERBOSITY[4]=HIGH&USER[6]=****&VENDOR[9]=****&PARTNER[6]=PayPal&PWD[8]=****&TENDER[1]=C&TRXTYPE[1]=S&ACCT[16]=4012888888881881&EXPDATE[4]=0419&AMT[5]=10.00&FREIGHTAMT[4]=5.00&TAXAMT[4]=2.50&COMMENT1[15]=This is a test!&COMMENT2[20]=This is only a test!&CVV2[3]=123&BILLTOPHONENUM[12]=816-555-5555&BILLTOFIRSTNAME[6]=Tester&BILLTOLASTNAME[9]=Testerson&BILLTOSTREET[13]=123 Test Ave.&BILLTOCITY[11]=Kansas City&BILLTOSTATE[2]=MO&BILLTOZIP[5]=64111&BILLTOCOUNTRY[2]=US&SHIPTOFIRSTNAME[6]=Tester&SHIPTOLASTNAME[9]=Testerson&SHIPTOSTREET[13]=123 Test Ave.&SHIPTOCITY[11]=Kansas City&SHIPTOSTATE[2]=MO&SHIPTOZIP[5]=64111&SHIPTOCOUNTRY[2]=US
    [RAWRESPONSE] => RESULT=0&PNREF=A10M6CE2A65B&RESPMSG=Approved&AUTHCODE=000041&AVSADDR=Y&AVSZIP=N&CVV2MATCH=Y&PROCAVS=A&PROCCVV2=M&TRANSTIME=2014-04-23 01:43:58&BILLTOFIRSTNAME=Tester&BILLTOLASTNAME=Testerson&AMT=10.00&ACCT=1881&EXPDATE=0419&CARDTYPE=0&IAVS=N
)

我也用TENDER = P运行它,我得到了一个预期的错误,即我的帐户上没有启用投标类型。

因此,我会仔细检查您的API凭据,甚至可能尝试将其切换为FULL_TRANSACTIONS,看看是否有帮助。