Paypal [error 10004] Invalid arguments on DoExpressCheckoutPayment - paypal

I'm having problems capturing Paypal payment through DoExpressCheckoutPayment method. Paypal failed and returned with only one 10004 error which said
Transaction refused because of an invalid argument. See additional error messages for details.
However, Paypal did not specify which argument was invalid.
Is there a way to request Paypal to provide more details in this case?
Below are arguments which I post to Paypal using the NVP API.
DoExpressCheckoutPayment
L_PAYMENTREQUEST_0_NAME0=Hieu+Nguyen
L_PAYMENTREQUEST_0_AMT0=20
L_PAYMENTREQUEST_0_QTY0=1
PAYMENTREQUEST_0_AMT=20
PAYMENTREQUEST_0_ITEMAMT=20
PAYMENTREQUEST_0_SHIPTOPHONENUM=452435243
EMAIL=hieu%40thirststudios.com
METHOD=DoExpressCheckoutPayment
VERSION=124.0
PWD=[masked]
USER=[masked]
SIGNATURE=[masked]
PAYMENTREQUEST_0_PAYMENTACTION=Sale
RETURNURL=http%3A%2F%2Fhakuba.centralsnowsports.com.au.local%2F%3FACT%3D53%26G%3DVXdJWStNWGFNSTIvQ09mNmE1cXJWSXlDN0lqYXlQdnNZRjBHL2NoaWpMNVAwNGlaN1A2K1crNVRBbUpmNG1yY05NTC9Mb1hHUVBQL0VsTG9rUEFzbFE9PQ%3D%3D%26M%3DVldsZFNoZVVsRTBJNjFLbmxZSWRtbitQVkZvNEI1M2hrQXNUb2hBZHozQnhCcUVFZkJmM3B0VVBvek1vV3ZPdGpubXJuQlNHd1FaU01wcDNYZVlGMVE9PQ%3D%3D
CANCELURL=http%3A%2F%2Fhakuba.centralsnowsports.com.au.local%2F%3FACT%3D53%26G%3DejNhR1BDSlhRZ1o0MzZoWFAvVmttY2pzMzF5amhqbDZzV2NMemoxbjcvY2dPQTZ4ZlVtL0ltRUx0dmkwUlV0Y3dpRDBuUWxJNk12cnREVDQ4Z1NYMWc9PQ%3D%3D%26M%3DR013TVBmL1FHZkRtOWVRSzVUL0JqMmZYa1B4RTJVNFptdjBPSGJFTlJqK2VSdkU5V25FczM4WEs2WkcwK3FPaWxwYkFSaW1JbGpHOVJSbWpTRjR4N3c9PQ%3D%3D
PAYMENTREQUEST_0_CURRENCYCODE=JPY
ALLOWNOTE=0
CHANNELTYPE=Merchant
PAYMENTREQUEST_0_ALLOWEDPAYMENTMETHOD=InstantPaymentOnly
LOCALECODE=US
ADDROVERRIDE=0
NOSHIPPING=1
SOLUTIONTYPE=Sole
LANDINGPAGE=Billing
TOKEN=EC-59S20038JL208993V
PAYERID=XAC7EG8Y2M5D6
IPADDRESS=hakuba.centralsnowsports.com.au.local
[Updated] more API call argument
SetExpressCheckout
L_PAYMENTREQUEST_0_ITEMCATEGORY0=Physical
L_PAYMENTREQUEST_0_NAME0=Hieu+Nguyen
L_PAYMENTREQUEST_0_AMT0=20
L_PAYMENTREQUEST_0_QTY0=1
PAYMENTREQUEST_0_AMT=20
PAYMENTREQUEST_0_ITEMAMT=20
PAYMENTREQUEST_0_SHIPTOPHONENUM=3143214
EMAIL=hieu%40thirststudios.com
METHOD=SetExpressCheckout
VERSION=124.0
PWD=[masked]
USER=[masked]
SIGNATURE=[masked]
PAYMENTREQUEST_0_PAYMENTACTION=Sale
RETURNURL=http%3A%2F%2Fhakuba.centralsnowsports.com.au.local%2F%3FACT%3D53%26G%3DRlN5WWJUS21HeGd6cTlSTm95MFpZMkxTTTdMZEZ1OUV6S2FIY0pYSjVnM1M0d2FjQjVIQnlqQ3F2d3NFSHRhZHB3bTVnRUE3T1NzN0EwOTcvOVlIQ3c9PQ%3D%3D%26M%3DYWNEUGhhemNVRzNpM0liMEVSUi94TmxkRDZRdmM2R3UrTUh0c2x1dFgwZ2tTNHJjV2lRUHBMWjR6d29vTkxXa3VRUnRPM0xNcnoyYlNHV2NKU2kzb2c9PQ%3D%3D
CANCELURL=http%3A%2F%2Fhakuba.centralsnowsports.com.au.local%2F%3FACT%3D53%26G%3DWnJzWDBWU1JaZndldStIY1FUNjFUWlNyTWYwR0N4NlRQK0VnajAvRjF2bFViZlVhZWphU0o3M1Z5dlNrdWlHOG4rRGd6OUdHNHJQaVhMa0tzamZvcnc9PQ%3D%3D%26M%3DemsxeGV1cnZ4a2JVWnhZRHNaU0ExTHBOaEp6dUQ1b2hiTVF5MXVxMjZyaFh1aFRhUGQvZ0M3dlZGT2dFU0FUelU3bjR6Qm5VVFBLT2xPSlJTN3ROUmc9PQ%3D%3D
PAYMENTREQUEST_0_CURRENCYCODE=JPY
ALLOWNOTE=0
CHANNELTYPE=Merchant
PAYMENTREQUEST_0_ALLOWEDPAYMENTMETHOD=InstantPaymentOnly
LOCALECODE=US
ADDROVERRIDE=0
NOSHIPPING=1
SOLUTIONTYPE=Sole
LANDINGPAGE=Billing
GetExpressCheckoutDetails
METHOD=GetExpressCheckoutDetails
VERSION=124.0
PWD=[masked]
USER=[masked]
SIGNATURE=[masked]
TOKEN=EC-75541725B7341060R

Update: For the record, the problem resolved itself after a few days. This must be an issue with Paypal internal engine. Still, we ended up moving away from Paypal after this incident.

Related

PayPal Express checkout SALUTATION not received in response

I am using PayPal Express checkout for payment. I need the SALUTATION of the user along with other shipping details. But it seems that only FIRSTNAME and LASTNAME are got from the response. What should be done to get the SALUTATION in the response as well.
This is the response got from GetExpressCheckoutDetails
TOKEN:EC%2d9F317807RE7947807
BILLINGAGREEMENTACCEPTEDSTATUS:0
CHECKOUTSTATUS:PaymentActionCompleted
TIMESTAMP:2016%2d05%2d12T11%3a54%3a16Z
CORRELATIONID:c50a6ba8b3002
ACK:Success
VERSION:93
BUILD:000000
EMAIL:nihal%40gmail%2ecom
PAYERID:2CLDDRMSKLDMA
PAYERSTATUS:unverified
FIRSTNAME:Nihal
LASTNAME:Mohammad
COUNTRYCODE:IN
SHIPTONAME:Nihal
SHIPTOSTREET:Chakkorathukulam
SHIPTOSTREET2:Nadakkavu
SHIPTOCITY:Calicut
SHIPTOSTATE:KOZHIKODE
SHIPTOZIP:670006
SHIPTOCOUNTRYCODE:IN
SHIPTOCOUNTRYNAME:India
ADDRESSSTATUS:Unconfirmed
CURRENCYCODE:USD
AMT:10%2e00
SHIPPINGAMT:0%2e00
HANDLINGAMT:0%2e00
TAXAMT:0%2e00
INSURANCEAMT:0%2e00
SHIPDISCAMT:0%2e00
PAYMENTREQUEST_0_CURRENCYCODE:USD
PAYMENTREQUEST_0_AMT:10%2e00
PAYMENTREQUEST_0_SHIPPINGAMT:0%2e00
PAYMENTREQUEST_0_HANDLINGAMT:0%2e00
PAYMENTREQUEST_0_TAXAMT:0%2e00
PAYMENTREQUEST_0_INSURANCEAMT:0%2e00
PAYMENTREQUEST_0_SHIPDISCAMT:0%2e00
PAYMENTREQUEST_0_TRANSACTIONID:2KR64654T7820071F
PAYMENTREQUEST_0_INSURANCEOPTIONOFFERED:false
PAYMENTREQUEST_0_SHIPTONAME:Nihal
PAYMENTREQUEST_0_SHIPTOSTREET:Chakkorathukulam
PAYMENTREQUEST_0_SHIPTOSTREET2:Nadakkavu
PAYMENTREQUEST_0_SHIPTOCITY:Calicut
PAYMENTREQUEST_0_SHIPTOSTATE:KOZHIKODE
PAYMENTREQUEST_0_SHIPTOZIP:670006
PAYMENTREQUEST_0_SHIPTOCOUNTRYCODE:IN
PAYMENTREQUEST_0_SHIPTOCOUNTRYNAME:India
PAYMENTREQUEST_0_ADDRESSSTATUS:Unconfirmed
PAYMENTREQUESTINFO_0_TRANSACTIONID:2KR64654T7820071F
PAYMENTREQUESTINFO_0_ERRORCODE:0
In PayPal documentation they say it is available in response.
see here
Its a simple problem. I was using the merchant account for US region. And the US region does not need the SALUTATION part for their address. That was why the response was not returning the salutation part i guess.

Getting the Unique Transaction ID seen by the customer from Express Checkout

I'm using PayPal Express Checkout on a sandbox account, and i'm trying to link up the Unique Transaction ID on the "customer" paypal site with the completed transaction via Express Checkout.
My DoExpressCheckoutPayment returned:
TOKEN=EC%2d2KG36160AM8868619&
SUCCESSPAGEREDIRECTREQUESTED=false&
TIMESTAMP=2015%2d01%2d29T09%3a45%3a09Z&
CORRELATIONID=44060412ed341&
ACK=Success&
VERSION=93&BUILD=15009693&
INSURANCEOPTIONSELECTED=false&
SHIPPINGOPTIONISDEFAULT=false&
PAYMENTINFO_0_TRANSACTIONID=011446947E558235S&
PAYMENTINFO_0_TRANSACTIONTYPE=expresscheckout&
PAYMENTINFO_0_PAYMENTTYPE=instant&
PAYMENTINFO_0_ORDERTIME=2015%2d01%2d29T09%3a45%3a08Z&
PAYMENTINFO_0_AMT=7%2e98&
PAYMENTINFO_0_FEEAMT=0%2e47&
PAYMENTINFO_0_TAXAMT=0%2e00&
PAYMENTINFO_0_CURRENCYCODE=GBP&
PAYMENTINFO_0_PAYMENTSTATUS=Completed&
PAYMENTINFO_0_PENDINGREASON=None&
PAYMENTINFO_0_REASONCODE=None&
PAYMENTINFO_0_PROTECTIONELIGIBILITY=Ineligible&
PAYMENTINFO_0_PROTECTIONELIGIBILITYTYPE=None&
PAYMENTINFO_0_SECUREMERCHANTACCOUNTID=W9SM36U76AXSS&
PAYMENTINFO_0_ERRORCODE=0&
PAYMENTINFO_0_ACK=Success
Then my GetExpressCheckoutDetails returned:
TOKEN=EC%2d2KG36160AM8868619&
BILLINGAGREEMENTACCEPTEDSTATUS=0&
CHECKOUTSTATUS=PaymentActionCompleted&
TIMESTAMP=2015%2d01%2d29T09%3a45%3a33Z&
CORRELATIONID=80e00a0067bea&
ACK=Success&
VERSION=93&
BUILD=15009693&
EMAIL=test1%40sud%2eco2euk&
PAYERID=H54VEN293PLFL&
PAYERSTATUS=verified&
FIRSTNAME=Test&
LASTNAME=User&
COUNTRYCODE=GB&
CURRENCYCODE=GBP&
AMT=7%2e98&
SHIPPINGAMT=0%2e00&
HANDLINGAMT=0%2e00&
TAXAMT=0%2e00&
INSURANCEAMT=0%2e00&
SHIPDISCAMT=0%2e00&
PAYMENTREQUEST_0_CURRENCYCODE=GBP&
PAYMENTREQUEST_0_AMT=7%2e98&
PAYMENTREQUEST_0_SHIPPINGAMT=0%2e00&
PAYMENTREQUEST_0_HANDLINGAMT=0%2e00&
PAYMENTREQUEST_0_TAXAMT=0%2e00&
PAYMENTREQUEST_0_INSURANCEAMT=0%2e00&
PAYMENTREQUEST_0_SHIPDISCAMT=0%2e00&
PAYMENTREQUEST_0_TRANSACTIONID=011446947E558235S&
PAYMENTREQUEST_0_INSURANCEOPTIONOFFERED=false&
PAYMENTREQUESTINFO_0_TRANSACTIONID=011446947E558235S&
PAYMENTREQUESTINFO_0_ERRORCODE=0
But the customer site says:
PayPal Express Checkout Payment Sent (Unique Transaction ID 7PK53077PJ222701T)
Oh..the (painful) memories :) That aforementioned "oddity" also exists elsewhere - e.g. eBay transactions
IINM, you'll need to send your own "custom ID" - the Invoice Id mentioned above (which is displayed to the end user) so both ends have some visual reference to a transaction.
In the REST API (unsure in Classic, haven't tried), if you send an Order, the Order Number (finally) is shared on both ends (same for both). Though it wouldn't hurt to still send your own "custom Id"/"Invoice Id".
Buyer/Customer Paypal UI:
Seller/Merchant Paypal UI:
Hth...

10002 Security header is not valid error when calling DoCapture in live mode

I need some helps regarding to Paypal express checkout. Here is my case
- I can do: SetExpressCheckout, DoExpressCheckout successfully
- But I was unable to DoCapture to capture authorized amount. And here is the error "10002 Security header is not valid". Noted that this only happen on live mode, it worked fine in sandbox mode.
Please help. thanks Thanh
After doing DoExpressCheckoutPayment get the authorizationID and use it in DoCapture
Endpoint URL: https://api-3t.sandbox.paypal.com/nvp
HTTP method: POST
POST data:
USER=merchant_user_name
&PWD=merchant_password
&SIGNATURE=merchant_signature
&METHOD=DoExpressCheckoutPayment
&VERSION=95
&TOKEN=EC-470284976K7901234 #Token from the SetExpressCheckout response
&PAYERID=3TXTXECKFU1234 #Customer account ID, from the GetExpressCheckoutDetails response
&PAYMENTREQUEST_0_PAYMENTACTION=Authorization #Enables you to collect payment in the future
&PAYMENTREQUEST_0_AMT=1
&PAYMENTREQUEST_0_CURRENCYCODE=USD
Response
--------
TOKEN=EC%2d470284976K7901234
&ACK=Success
&VERSION=95
&PAYMENTINFO_0_TRANSACTIONID=20K92515TX2901234 #Use this value as the authorization ID in a DoCapture request
&PAYMENTINFO_0_SECUREMERCHANTACCOUNTID=QJSRDC4JW1234
&PAYMENTINFO_0_ACK=Success
...
DoCapture call
Request
Endpoint URL: https://api-3t.sandbox.paypal.com/nvp
HTTP method: POST
POST data:
USER=merchant_user_name
&PWD=merchant_password
&SIGNATURE=merchant_signature
&METHOD=DoCapture
&VERSION=95
&AUTHORIZATIONID=20K92515TX2901234 #Authorization ID. Specify the value of PAYMENTINFO_0_TRANSACTIONID from the DoExpressCheckoutPayment response)
&AMT=1 #The amount of the payment
&CURRENCYCODE=USD
&COMPLETETYPE=Complete #Indicates that for the authorization specified, this is the last payment capture
Response
AUTHORIZATIONID=20K92515TX2901234
&ACK=Success
&TRANSACTIONID=2KF46316MJ7751234 #New transaction ID for this payment
&PARENTTRANSACTIONID=20K92515TX2901234 #Same as the ID of the original authorization
&TRANSACTIONTYPE=expresscheckout
&PAYMENTTYPE=instant
&AMT=1%2e00
&FEEAMT=0%2e33
&TAXAMT=0%2e00
&CURRENCYCODE=USD
&PAYMENTSTATUS=Completed
...
Reference : https://developer.paypal.com/docs/classic/express-checkout/ht_ec-singleAuthPayment-curl-etc/

Cannot capture amounts after DoExpressCheckoutPayment with parallel payment

I user PayPal's Express Checkout API to make an parallel Payment. Everything works fine, on the payee site, the 2 payments are booked as "open".
While DoExpressCheckoutPayment I get an transaction id for each payment. But a doCapture fails with "You%20do%20not%20have%20permissions%20to%20make%20this%20API%20call". A single authorized payment that I made several weeks ago but have never captured gives me just "Order%20has%20expired%2e" - which is fine.
I use the following parameters for the NVP API:
$parameters = array("METHOD"=>"DoCapture",
"AUTHORIZATIONID"=>$transactionid_item,
"AMT"=>$amt_item,
"CURRENCYCODE"=>$currencycode,
"COMPLETETYPE"=>"Complete"
);
when of course the variable are the corresponding values to each payment. (plus authentication/api credential).
What am I doing wrong? Is there an additional variable to set when I make a parallel instead of an single payment?
regards,
chris
This is an example call and the response:
https://api-3t.sandbox.paypal.com/nvp?METHOD=DoCapture&AUTHORIZATIONID=O-67121848EA448750G&AMT=9.70&CURRENCYCODE=EUR&COMPLETETYPE=Complete&USER=xxx&PWD=xxx&SIGNATURE=xxx&VERSION=95.0
array(9) {
["TIMESTAMP"]=>
string(28) "2013%2d06%2d15T09%3a35%3a52Z"
["CORRELATIONID"]=>
string(12) "140dec053198"
["ACK"]=>
string(7) "Failure"
["VERSION"]=>
string(6) "95%2e0"
["BUILD"]=>
string(7) "6444009"
["L_ERRORCODE0"]=>
string(5) "10007"
["L_SHORTMESSAGE0"]=>
string(19) "Permission%20denied"
["L_LONGMESSAGE0"]=>
string(67) "You%20do%20not%20have%20permissions%20to%20make%20this%20API%20call"
["L_SEVERITYCODE0"]=>
string(5) "Error"
}
It looks like you are running your Express Checkout API call as an order, then you are turning around and doing a DoCapture request but you are passing over the order id for the auth id instead of the authorization id. If you are wanting to set your Express Checkout to be an order instead of an auth or a sale, then you need to perform the calls in the following ways.
SetExpressCheckout API call (processing as order)
GetExpressCheckoutDetail API Call
DoExpressCheckoutPayment API Call (processing as order)
DoAuthorization (performs an auth, and passes over the order id that you received from the EC flow)
DoCapture (performs a capture against the auth, you will pass over the auth id that was returned in the previous call here, not the order id)

paypal checkout display shipping costs but does not include them in transaction

I do not know if the issue is in code or the paypal account settings. Paypal displays correctly the shipping cost, it displays the correct total (item price + shipping),
but in fact, the transactions includes only the item price, not the shipping costs.
I have been unable to find out what is wrong. if paypal can display it correctly, why cant it include it properly in the transaction ?
here is the request sent to paypal:
$padata = '&CURRENCYCODE='.urlencode($PayPalCurrencyCode).
'&PAYMENTACTION=Sale'.
'&ALLOWNOTE=1'.
'&PAYMENTREQUEST_0_CURRENCYCODE='.urlencode($PayPalCurrencyCode).
'&PAYMENTREQUEST_0_AMT='.urlencode($TotalPrice).
'&PAYMENTREQUEST_0_ITEMAMT='.urlencode($ItemTotalPrice).
'&L_PAYMENTREQUEST_0_QTY0='. urlencode($ItemQty).
'&L_PAYMENTREQUEST_0_AMT0='.urlencode($ItemPrice).
'&PAYMENTREQUEST_0_SHIPPINGAMT='.urlencode($deliveryCost).
'&L_PAYMENTREQUEST_0_NAME0='.urlencode($ItemName).
'&L_PAYMENTREQUEST_0_NUMBER0='.urlencode($ItemNumber).
'&AMT='.urlencode($ItemTotalPrice).
'&RETURNURL='.urlencode($PayPalReturnURL ).
'&CANCELURL='.urlencode($PayPalCancelURL);
The param for shipping that I used is :
PAYMENTREQUEST_0_SHIPPINGAMT
is it correct ? is a complementary one needed ?
Are you supplying all of your PAYMENTREQUEST_0_* and L_PAYMENTREQUEST_0_* variables in your DoExpressCheckoutPayment call as well as your SetExpressCheckout call?
SetExpressCheckout will control what the buyer sees when they go to check out on PayPal. DoExpressCheckoutPayment will control what the buyer is actually charged for. Therefore, if you want your shipping charge to be included in the transaction, you need to make sure that it's included in both calls.
for the records, correct params for DoExpressCheckoutPayment :
$padata = '&TOKEN='.urlencode($token).
'&PAYERID='.urlencode($playerid).
'&PAYMENTACTION='.urlencode("SALE").
'&PAYMENTREQUEST_0_CURRENCYCODE='.urlencode($PayPalCurrencyCode).
'&PAYMENTREQUEST_0_SHIPPINGAMT='.urlencode($deliveryCost).
'&PAYMENTREQUEST_0_AMT='.urlencode($TotalPrice).
'&PAYMENTREQUEST_0_ITEMAMT='.urlencode($ItemTotalPrice).
'&CURRENCYCODE='.urlencode($PayPalCurrencyCode);