Question

I am trying to configure payflow link application in test mode on codeigniter. I am doing this with Angell EYE PHP CodeIgniter Class Library for PayPal.

I have set up my developer sandbox account and added a user of Business-Pro type and a user of Personal type.

I have set up an account on manager.payflow.com and added a user with role 'API_FULL_TRANSACTIONS'.

Now here is my /application/config/paypal.php file:

<?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'] = '';

Next I'm running the function in the /application/controllers/payflow.php controller:

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);
    }
}

And the respnse I get is:

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
)

Why does it keep returning this error? The permission for the user on manager.paypal.com is set to 'API_FULL_TRASACTIONS' (also tried with 'ADMIN', 'ADMIN_TRANSACTIONS', 'FULL_TRASACTIONS' - all give same response).

What should configuration be to process test payments?

Was it helpful?

Solution

So, you said PayFlow Link in your first paragraph, but that's something completely different from Express Checkout or Payments Pro, which is what it looks like you're trying here.

If you use TENDER=C and you're getting that error it likely means you don't have Payments Pro enabled on your PayPal account. You mentioned that you do, but can you confirm that it's actually activated and setup for test mode? You should see a little table with the status of the account on the overview page when you login to the PayPal Manager site.

If you're using P to try and setup an Express Checkout flow then you would need to make sure you remove the credit card number from the request.

As a side note, the sample code you pasted here is missing a comma in the $PayPalRequestData array after the billtomiddlename parameter. I had to fix that before it would run at all.

With that fixed, I was able to successfully run your sample request with a test credit card number from the PayFlow documentation.

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
)

I ran it with TENDER=P, too, and I got an expected error that the tender type isn't enabled on my account.

So I would double check your API credentials, and maybe even try switching it to FULL_TRANSACTIONS and see if that helps.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top