Paypal Instant Update API - MAXAMT Error - php

since hours I try to solve the following error from the paypal Instant Update API
[L_ERRORCODE0] => 11832
[L_SHORTMESSAGE0] => Maximum amount of order is less than itemized amounts.
[L_LONGMESSAGE0] => Maximum amount of order is less than itemized amounts.
Here is the Request:
Method: SetExpressCheckout
Request:
Formatted Request: Array
(
[PAYMENTREQUEST_0_AMT] => 3.00
[PAYMENTREQUEST_0_CURRENCYCODE] => EUR
[PAYMENTREQUEST_0_ITEMAMT] => 1.00
[PAYMENTREQUEST_0_SHIPPINGAMT] => 1.00
[PAYMENTREQUEST_0_NOTIFYURL] => http://www.eee.de/ipn.php
[PAYMENTREQUEST_0_CALLBACK] => http://www.eee.de/ajax.php?action=eee
[PAYMENTREQUEST_0_MAXAMT] => 11.00
[LOGO] => https://www.eee.de/template/img/logo-eee.png
[CANCELURL] => http://eee.de/bestellung.php?paypal_express=cancel
[RETURNURL] => http://eee.de/bestellung.php?paypal_express=return
[L_PAYMENTREQUEST_0_AMT0] => 1.00
[L_PAYMENTREQUEST_0_NAME0] => Item
[L_PAYMENTREQUEST_0_DESC0] => Desc
[L_PAYMENTREQUEST_0_QTY0] => 1
[L_PAYMENTREQUEST_0_NUMBER0] => 123
[CALLBACKVERSION] => 82.0
[CALLBACK] => http://www.eee.de/ajax.php?action=ppe_shipping
[L_SHIPPINGOPTIONISDEFAULT0] => true
[L_SHIPPINGOPTIONNAME0] => UPS0
[L_SHIPPINGOPTIONAMOUNT0] => 1.00
[L_SHIPPINGOPTIONISDEFAULT1] => false
[L_SHIPPINGOPTIONNAME1] => UPS2
[L_SHIPPINGOPTIONAMOUNT1] => 2.00
[L_SHIPPINGOPTIONISDEFAULT2] => false
[L_SHIPPINGOPTIONAMOUNT2] => 3.00
[PAYMENTREQUEST_0_INSURANCEOPTIONOFFERED] => true
[PAYMENTREQUEST_0_INSURANCEAMT] => 1.00
)
I tried every combination of values
this is the response from the Callbackurl:
METHOD=CallbackResponse
&OFFERINSURANCEOPTION=true
&L_SHIPPINGOPTIONNAME0=UPS0
&L_SHIPPINGOPTIONAMOUNT0=1.00
&L_INSURANCEAMOUNT0=1.00
&L_SHIPPINGOPTIONISDEFAULT0=true
&L_SHIPPINGOPTIONNAME1=UPS1
&L_SHIPPINGOPTIONAMOUNT1=2.00
&L_INSURANCEAMOUNT1=1.00
&L_SHIPPINGOPTIONISDEFAULT1=false
&L_SHIPPINGOPTIONNAME2=UPS2
&L_SHIPPINGOPTIONAMOUNT2=3.00
&L_INSURANCEAMOUNT2=1.00
&L_SHIPPINGOPTIONISDEFAULT2=false
As far as I understand, the MAXAMT value is the total of items + max shipping + tax + factor x so why to hell does it compare it this way? 11.00 < 3.00 (3.00 = item+shipping+insurance)
I am totally lost!
Thanks for any hint!

Try to use MAXAMT instead of PAYMENTREQUEST_0_MAXAMT.
Actually the PayPal documentation sucks as same things are described totally differently in PayPal documentation.

Related

Paypal PayFlow pro Response always Fail

I need to integrate paypal payflow payment in my website. I have Used this Library.
My sample paypal pay flow sample response, Sample Output:
Array
(
[RESULT] => 0
[PNREF] => A30A2C9B2AD0
[RESPMSG] => Approved
[AUTHCODE] => 785PNI
[AVSADDR] => Y
[AVSZIP] => Y
[CVV2MATCH] => Y
[HOSTCODE] => A
[PROCAVS] => Y
[PROCCVV2] => M
[VISACARDLEVEL] => 12
[TRANSTIME] => 2018-01-22 03:51:49
[BILLTOFIRSTNAME] => Tester
[BILLTOLASTNAME] => Testerson
[AMT] => 10.50
[ACCT] => 1111
[EXPDATE] => 1219
[CARDTYPE] => 0
[IAVS] => N
[PREFPSMSG] => No Rules Triggered
[POSTFPSMSG] => No Rules Triggered
[RAWREQUEST] => BUTTONSOURCE[18]=Paypal Transaction&VERBOSITY[4]=HIGH&USER[8]=aswinraj&VENDOR[11]=Vigneshwari&PARTNER[6]=Paypal&PWD[13]=vickyaswin#13&TENDER[1]=C&TRXTYPE[1]=S&ACCT[16]=4111111111111111&EXPDATE[4]=1219&AMT[5]=10.50&FREIGHTAMT[4]=5.00&TAXAMT[4]=2.50&COMMENT1[15]=This is a test!&COMMENT2[20]=This is only a test!&CVV2[3]=123&BILLTOEMAIL[22]=sandbox#testdomain.com&BILLTOPHONENUM[12]=816-555-5555&BILLTOFIRSTNAME[6]=Tester&BILLTOLASTNAME[9]=Testerson&BILLTOSTREET[13]=123 Test Ave.&BILLTOCITY[6]=TUCSON&BILLTOSTATE[2]=AZ&BILLTOZIP[9]=123456789&BILLTOCOUNTRY[3]=USA&SHIPTOFIRSTNAME[6]=Tester&SHIPTOLASTNAME[9]=Testerson&SHIPTOSTREET[13]=123 Test Ave.&SHIPTOCITY[6]=TUCSON&SHIPTOSTATE[2]=AZ&SHIPTOZIP[9]=123456789&SHIPTOCOUNTRY[3]=USA
[RAWRESPONSE] => RESULT=0&PNREF=A30A2C9B2AD0&RESPMSG=Approved&AUTHCODE=785PNI&AVSADDR=Y&AVSZIP=Y&CVV2MATCH=Y&HOSTCODE=A&PROCAVS=Y&PROCCVV2=M&VISACARDLEVEL=12&TRANSTIME=2018-01-22 03:51:49&BILLTOFIRSTNAME=Tester&BILLTOLASTNAME=Testerson&AMT=10.50&ACCT=1111&EXPDATE=1219&CARDTYPE=0&IAVS=N&PREFPSMSG=No Rules Triggered&POSTFPSMSG=No Rules Triggered
)
I have got only RESULT column as 0 and RESPMSG as approved in error response . But I need success Response .Please help me to fix the issue .
If Payflow API responds as RESTULT=0 & RESPMSG=approved, it means transaction has been completed without any error.
Click here to know about Payflow API response.
Click here to know more about RESPMSG with its explanation.

Palpal Mass Payment Responce

I am using Paypal Masspayment API and its working just fine, but I want to know how much fees I had paid for transaction, or transaction was domestic or international, But I am only getting this array in response
Array
(
[TIMESTAMP] => 2015%2d02%2d03T05%3a31%3a25Z
[CORRELATIONID] => 1bccbfad582e7
[ACK] => Success
[VERSION] => 51%2e0
[BUILD] => 15110743
)
Is it even possible with Mass Pay API ?
Or if there is any way to get calculated result my website from this mass payment fees calculator ?
https://www.paypal.com/np/cgi-bin/webscr?cmd=_batch-payment-overview-outside
I will prefer solution written in PHP
The best way to handle this would be to setup an Instant Payment Notification (IPN) solution. You would get an IPN with more details when you make a MassPay transaction. Here's an example of one:
Array
(
[payer_id] => ATSCG2QMC9KAU
[payment_date] => 09:23:59 Jan 28, 2015 PST
[payment_gross_1] => 10.00
[payment_gross_2] => 10.00
[payment_gross_3] => 10.00
[payment_status] => Processed
[receiver_email_1] => andrew_1342623385_per#angelleye.com
[receiver_email_2] => usb_1329725429_biz#angelleye.com
[charset] => windows-1252
[receiver_email_3] => andrew_1277258815_per#angelleye.com
[mc_currency_1] => USD
[masspay_txn_id_1] => 1M205262R4107805K
[mc_currency_2] => USD
[masspay_txn_id_2] => 95942086WL824160N
[mc_currency_3] => USD
[masspay_txn_id_3] => 21W68993Y67646416
[first_name] => Drew
[unique_id_1] =>
[notify_version] => 3.8
[unique_id_2] =>
[unique_id_3] =>
[payer_status] => verified
[verify_sign] => AJ-yMngskqU0wKMAcE2BE6cQ.uxhA3cw3neNnb2W68Ic2ZwqkxjYIgMg
[payer_email] => sandbo_1215254764_biz#angelleye.com
[payer_business_name] => Drew Angell's Test Store
[last_name] => Angell
[status_1] => Completed
[status_2] => Completed
[status_3] => Completed
[txn_type] => masspay
[mc_gross_1] => 10.00
[mc_gross_2] => 10.00
[mc_gross_3] => 10.00
[payment_fee_1] => 0.20
[residence_country] => US
[test_ipn] => 1
[payment_fee_2] => 0.20
[payment_fee_3] => 0.20
[mc_fee_1] => 0.20
[mc_fee_2] => 0.20
[mc_fee_3] => 0.20
[ipn_track_id] => 205e7228cfda3
)
That particular MassPay had 3 payments included on it, so you can see separate data for each one that you could loop through and process accordingly.
There are plenty of PHP classes available for IPN on GitHub and/or Packagist and available for use with Composer if you happen to be using that. If you happen to be using WordPress I'd take a look at PayPal IPN for WordPress, which would get you up-and-running very quickly, and then you could easily extend it to handle your own needs.
Paypal doesn't share any confidential information so it may not be possible, but you can calculate the fees using curl, here is the working code
$url = "https://www.paypal.com/np/cgi-bin/webscr";
$data=array(
"cmd" => '_calc-masspay-fee',
"sender_country" => $Country,
"receiver_country" => 'GB',
"currency_code" => Mage::app()->getStore()->getCurrentCurrencyCode(),
"curr_list_reqd" => 1
);
$cr = curl_init($url);
curl_setopt($cr, CURLOPT_RETURNTRANSFER, true); // Get returned value as string (dont put to screen)
curl_setopt($cr, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']); // Spoof the user-agent to be the browser that the user is on (and accessing the php $
curl_setopt($cr, CURLOPT_POST, true); // Tell curl that we are posting data
curl_setopt($cr, CURLOPT_POSTFIELDS, $data); // Post the data in the array above
$output = curl_exec($cr);
$output = json_decode($output);

Recurring payment IPN request rp_invoice_id field

Here is example of PayPal Express Checkout Recurring Payment IPN request:
[mc_gross] => 6.56
[period_type] => Regular
[outstanding_balance] => 0.00
[next_payment_date] => 03:00:00 Jun 21, 2012 PDT
[protection_eligibility] => Ineligible
[payment_cycle] => Weekly
[tax] => 0.00
[payer_id] => K48P3Fxxxx
[payment_date] => 16:52:28 Jun 14, 2012 PDT
[payment_status] => Completed
[product_name] => Virtual Subscription $6.56 / week for 3 weeks
[charset] => windows-1252
[rp_invoice_id] => 208
[recurring_payment_id] => I-4DHKxxxx
[first_name] => Test
[mc_fee] => 0.38
[notify_version] => 3.4
[amount_per_cycle] => 6.56
[payer_status] => verified
[currency_code] => USD
[business] => xxxx#gmail.com
[verify_sign] => AlAlnsACWRTf4OV6vRMZG4sCyEdYACBnr7ishagKt60BxtlJgPjaRIAh
[payer_email] => xxxx#gmail.com
[initial_payment_amount] => 0.00
[profile_status] => Active
[amount] => 6.56
[txn_id] => 3PE0612xxxx
[payment_type] => instant
[last_name] => User
[receiver_email] => xxxx#gmail.com
[payment_fee] => 0.38
[receiver_id] => TYDEKWLxxxx
[txn_type] => recurring_payment
[mc_currency] => USD
[residence_country] => US
[test_ipn] => 1
[transaction_subject] => Virtual Subscription $6.56 / week for 3 weeks
[payment_gross] => 6.56
[shipping] => 0.00
[product_type] => 1
[time_created] => 23:48:22 Jun 13, 2012 PDT
[ipn_track_id] => b2c853ddxxxx
As you can see, there is field called rp_invoice_id which is The merchant’s own unique reference or invoice number, which can be used to uniquely identify a profile.
When creating API call CreateRecurringPaymentsProfile, how to pass this value, which field should I set in the API call?
Thank you
You need to use the PROFILEREFERENCE parameter to pass in a value that will be returned via IPN in the rp_invoice_id parameter.
PROFILEREFERENCE
(Optional) The merchant's own unique reference or invoice number.
Character length and limitations: 127 single-byte alphanumeric characters
https://developer.paypal.com/webapps/developer/docs/classic/api/merchant/CreateRecurringPaymentsProfile_API_Operation_NVP/
It will not work like this, newer versions of API are using REST calls.
To make this working you have to first download Paypal SDK. It is available at http://paypal.github.io/sdk/
Make sure you use official version of SDK, there might be chances that you may use different version and someone may be sitting there to steal your valuable information. My suggestion is before start working go through original documentation, to have an idea.
Once you install SDK, then you could use the example given in the link below
https://devtools-paypal.com/guide/recurring_payment_cc/php?interactive=ON&env=sandbox
This will make API call.
Also you can try with complete documentation available at https://developer.paypal.com/webapps/developer/docs/api/
Happy Coding!
Atul Jindal

The totals of the cart item amounts do not match order amounts

I have read other posts on the very same subject but I am pretty sure I have not fallen foul of the issues of those posts. This is really frustrating me now so any help or advice would be appreciated.
I am building the following array to be sent in the SetExpressCheckout call but upon each submission i get "The totals of the cart item amounts do not match order amounts " but I dont understand how!!
[METHOD] => SetExpressCheckout
[USER] => myusername
[PWD] => 1398341028
[SIGNATURE] => xxxsignaturexxx
[VERSION] => 85.0
[RETURNURL] => http://www.mysite.dev/payment/process
[CANCELURL] => http://www.mysite.dev/payment/cancelled
[PAYMENTREQUEST_0_PAYMENTACTION] => SALE
[NOSHIPPING] => 0
[PAYMENTREQUEST_0_AMT] => 189.00
[PAYMENTREQUEST_0_ITEMAMT] => 189.00
[PAYMENTREQUEST_0_TAXAMT] => 0
[PAYMENTREQUEST_0_SHIPPINGAMT] => 0
[PAYMENTREQUEST_0_HANDLINGAMT] => 0
[PAYMENTREQUEST_0_SHIPDISCAMT] => 0
[PAYMENTREQUEST_0_INSURANCEAMT] => 0
[PAYMENTREQUEST_0_CURRENCYCODE] => GBP
[LOCALECODE] => GB
[ALLOWNOTE] => 1
[L_PAYMENTREQUEST_0_NAME0] => Website Order
[L_PAYMENTREQUEST_0_NUMBER0] => 28424747
[L_PAYMENTREQUEST_0_AMT0] => 189.00
[L_PAYMENTREQUEST_0_QTY0] => 1
Many Thanks for reading.
Kris
I went ahead and tested your call using a test account and initially it gave a similar error to what you described. I did get it to work with the only modifications I made being the format and spacing of the call.
This is the call I submitted and got a successful response, note I did have to change the user, pwd, signature, version, returnrul, and cancelurl to be able to test it:
USER=chad_1311276857_biz_api1.x.com
PWD=NGAEWP367NNSDXP2
SIGNATURE=Aef0iZ4csmtdchFhBLFKNKS88OSVA0f08rNWMEUk1J-tsdbDOFq0JpNi
METHOD=SetExpressCheckout
VERSION=113.0
RETURNURL=http://ccaples.com/index.php/api-s/paypal-nvp/nvp-quick-test
CANCELURL=http://ccaples.com/index.php/api-s/paypal-nvp/nvp-quick-test
PAYMENTREQUEST_0_PAYMENTACTION=SALE
NOSHIPPING=0
PAYMENTREQUEST_0_AMT=189.00
PAYMENTREQUEST_0_ITEMAMT=189.00
PAYMENTREQUEST_0_TAXAMT=0
PAYMENTREQUEST_0_SHIPPINGAMT=0
PAYMENTREQUEST_0_HANDLINGAMT=0
PAYMENTREQUEST_0_SHIPDISCAMT=0
PAYMENTREQUEST_0_INSURANCEAMT=0
PAYMENTREQUEST_0_CURRENCYCODE=GBP
LOCALECODE=GB
ALLOWNOTE=1
L_PAYMENTREQUEST_0_NAME0=Website Order
L_PAYMENTREQUEST_0_NUMBER0=28424747
L_PAYMENTREQUEST_0_AMT0=189.00
L_PAYMENTREQUEST_0_QTY0=1

PayPal Order Summary is empty

I use Express Checkout API (Name-Value Pair) to do the PayPal checkout. The problem is the login screen doesn't show Order Summary. I tried to set the below params like this post but it still shows empty info.
$options["PAYMENTREQUEST_0_DESC"] = "hieutot";
$options["PAYMENTREQUEST_0_ITEMAMT"] = "123";
$options["PAYMENTREQUEST_0_AMT"] = 300;
$options["PAYMENTREQUEST_0_PAYMENTACTION"] = "Sale";
$options["L_PAYMENTREQUEST_0_NAME0"] = "zzz";
$options["L_PAYMENTREQUEST_0_QTY0"] = 1;
$options["L_PAYMENTREQUEST_0_AMT0"] = 1000.00;
$options["L_PAYMENTREQUEST_0_NAME1"] = "test";
$options["L_PAYMENTREQUEST_0_QTY1"] = 1;
$options["L_PAYMENTREQUEST_0_AMT1"] = 200.00;
But when I tried to generate 10486 transaction error. The order summary appears! What a strange problem! How to fix it? Could it be a PayPal API bug? I'm using Zend Cart 1.3.8.
This is the request and response using cURL
REQUEST
Array
(
[ITEMAMT] => 0.00
[LOCALECODE] => US
[PAYMENTACTION] => Sale
[EMAIL] => sorryICannotShowThis#gmail.com
[PHONENUM] => xxxxxxxx
[SOLUTIONTYPE] => SOLE
[PAYMENTREQUEST_0_DESC] => hieutot
[PAYMENTREQUEST_0_ITEMAMT] => 123
[PAYMENTREQUEST_0_AMT] => 300
[PAYMENTREQUEST_0_PAYMENTACTION] => Sale
[L_PAYMENTREQUEST_0_NAME0] => zzz
[L_PAYMENTREQUEST_0_QTY0] => 1
[L_PAYMENTREQUEST_0_AMT0] => 1000
[L_PAYMENTREQUEST_0_NAME1] => test
[L_PAYMENTREQUEST_0_QTY1] => 1
[L_PAYMENTREQUEST_0_AMT1] => 200
[AMT] => 3,700.00
[RETURNURL] => https%3A%2F%2Flocalhost%2Fipn_main_handler.php%3Ftype%3Dec
[CANCELURL] => https%3A%2F%2Flocalhost%2Findex.php%3Fmain_page%3Dshopping_cart%26amp%3Bec_cancel%3D1
[PAGESTYLE] => Primary
[METHOD] => SetExpressCheckout
[CURRENCYCODE] => JPY
)
RESPONSE
Array
(
[TOKEN] => sorryICannotShowThis
[TIMESTAMP] => 2013%2d11%2d21T08%3a37%3a09Z
[CORRELATIONID] => 35adcd4bd76d5
[ACK] => Success
[VERSION] => 3%2e2
[BUILD] => 8549850
[CURL_ERRORS] =>
)
Please double check the VERSION used in your API requests:
[VERSION] => 3%2e2
I'd suggest to use any version above 63.0 (which can support Line item)
See: https://developer.paypal.com/webapps/developer/docs/classic/api/merchant/SetExpressCheckout_API_Operation_NVP/
"This field is introduced in version 53.0. L_NAMEn is deprecated since version 63.0. Use L_PAYMENTREQUEST_0_NAMEm instead."

Categories