1

我正在尝试在 codeigniter 上以测试模式配置 payflow 链接应用程序。我正在使用适用于 PayPal 的 Angell EYE PHP CodeIgniter 类库来执行此操作。

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

我在 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” - 都给出相同的响应)。

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

4

1 回答 1

2

因此,您在第一段中提到了 PayFlow Link,但这与 Express Checkout 或 Payments Pro 完全不同,这就是您在这里尝试的方式。

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

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

作为旁注,您在此处粘贴的示例代码在 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 看看是否有帮助。

于 2014-04-23T08:46:53.177 回答