Paypal - BMCreateButton - Subtotal amount is not valid - paypal

I've started to receive the error:
Ack: Failure
Correlation ID: d1ed16a437fc9
Version: 85
Error Number: 13117
Short Message: Invalid Argument
Long Message: Subtotal amount is not valid.
When making a BMCreateButton request, the script has been working fine, can anyone see what's wrong with the request below? Also I can't find a spec anywhere that states what the format for the subtotal amount should be.
METHOD=BMCreateButton
&VERSION=85
&PWD=xxxxxxx
&USER=xxxxxxx
&SIGNATURE=xxxxxxx
&BUTTONCODE=TOKEN
&BUTTONTYPE=PAYMENT
&L_BUTTONVAR0=address1=11 The Oaks
&L_BUTTONVAR1=address2=
&L_BUTTONVAR2=address_override=true
&L_BUTTONVAR3=billing_address1=11 The Oaks
&L_BUTTONVAR4=billing_address2=
&L_BUTTONVAR5=billing_city=Fleet
&L_BUTTONVAR6=billing_country=UNITED KINGDOM
&L_BUTTONVAR7=billing_first_name=Victoria
&L_BUTTONVAR8=billing_last_name=Fry
&L_BUTTONVAR9=billing_state=Hampshire
&L_BUTTONVAR10=billing_zip=GU51 4HQ
&L_BUTTONVAR11=business=XDQD9TZGYQ9YY
&L_BUTTONVAR12=buyer_email=xxxxxxx
&L_BUTTONVAR13=cancel_return=xxxxxxx
&L_BUTTONVAR14=city=Fleet
&L_BUTTONVAR15=country=UNITED KINGDOM
&L_BUTTONVAR16=currency_code=GBP
&L_BUTTONVAR17=first_name=Victoria
&L_BUTTONVAR18=invoice=8132
&L_BUTTONVAR19=last_name=Fry
&L_BUTTONVAR20=lc=US
&L_BUTTONVAR21=notify_url=xxxxxxx
&L_BUTTONVAR22=paymentaction=sale
&L_BUTTONVAR23=return=xxxxxxx
&L_BUTTONVAR24=shipping=0
&L_BUTTONVAR25=state=Hampshire
&L_BUTTONVAR26=subtotal=65
&L_BUTTONVAR27=zip=GU51 4HQ
The values are php url encoded.
Many thanks for any advise.

I was able to fix this error by adding a subtotal item ala:
"L_BUTTONVAR3" :"subtotal=10.99"

Related

Paypal shopping cart AMOUNT_ERROR

I am having a issue with a paypal cart since the update around march (bit late but the site is not used yet and we just discovered it now).
I already checked this question but it did not solve the issue for a shopping cart (Paypal : hosted button payments fail with code=AMOUNT_ERROR)
We send a object that contains the request data through a plugin called neo.js, this works fine as far as we know.
This is our data we send to paypal as a js object.
{
amount_1: 10.01,
business: "noreply#domain.com",
cancel_return: "https://dev.domain.com",
charset: "utf-8",
cmd: "_cart",
currency_code: "US",
custom: "username",
item_name_1: "$10 item",
item_number_1: "1",
no_shipping: 1,
notify_url: "https://dev.domain.com/callback/paypal.php",
quantity_1: 1,
return: "https://dev.domain.com",
upload: 1
}
It has to do something with the amount, but using a , instead of . but that only gives a normal error message on screen that the format is incorrect.
We have tried multiple things including the dollar sign and making it a string but nothing seem to be working.
I reproduced the error and it is due to the wrong currency code passed.
You are passing "US" but the currency code (that is a parameter that refers to the AMOUNT as in the error returned) must be of 3 characters as you can see on PayPal guide: https://developer.paypal.com/webapps/developer/docs/classic/api/currency_codes/
Change it to "USD" instead and you will have a working checkout.

How do I resolve a 400 bad request error using the paypal rest api?

I am currently testing credit card payments using the PayPal payments pro Rest API.
I keep getting the following error:
Exception in HttpConnection Execute: Invalid HTTP response The remote server returned an error: (400) Bad Request. --->
I created and activated my PayPal test account and as following:
Credit card
Credit card number:
ccnumber here
Credit card type:
Visa
Expiration date:
3/2019
When I enter the above information in my payment form and submit I keep getting the 400 bad request error.
I have gotton this to work before with the PayPAl joe shopper account but lost the test cc number.
I am 100% sure I have authenticated with the oauth2 credentials
What is the likely cause of this error?:
I am entering a random payer first name and last name .
Does the name have to exsist?
What could be causing the error
If anything goes wrong in the data given, paypal api will return a 400 - Bad request error.
When I got the error(PHP SDK), I caught the exception and $ex->getData() returned a json which contains the details about the bad request, in my case the currency code I given was wrong.
try {
$payment->create($apiContext);
} catch (PayPal\Exception\PPConnectionException $ex) {
var_dump(json_decode($ex->getData()));
exit(1);
}
Like others here have said, there are several things that can cause the (HTTP 400 - Bad Request).
In my case it was due to using the same invoice number. For temporary testing I just used the ShoppingCartID that I generated with a guid. You could also use a Random number generator as well. Ultimately you will need to generate an invoice number to the clients specifications.
-Good luck
I just had the same problem (HTTP 400 - Bad Request). The cause is a REST API request with "errors". In my case I had two causes:
I passed amount details to an Amount object but the sum of subtotal, shipping an tax was not equal to the amount total.
I passed amount currency values including a fracture, but passed not exactly two decimals but only one. Obviously the REST API is a bit touchy and accepts only either no or two decimals.
I passed an item_list in the Transaction object but the sum of the prices in the Item object was not equal to the subtotal given in the amount details.
I don't know a way of finding the actual cause of the error (if there is one).
In your case it could be the name of the payer that you add. Try without.
Edit:
I just tried out: It is indeed the payer info. I passed a payer_info with first and lastname and got HTTP 400 (without everything worked). I assume that payer_info must not be set by us but is set by PayPal when returning a Payment object.
Payer payer = new Payer { payment_method = "paypal", payer_info = new PayerInfo {
first_name = "Zaphod", last_name = "Beeblebrox"} }; // => HTTP 400 - Bad Request
firstly find out what exactly what Your error is
payment = PayPal::SDK::REST::DataTypes::Payment.new(...)
payment.create
# got Response[400]: Bad Request here
payment.error
# got {"name"=>"VALIDATION_ERROR", "details"=>[{"field"=>"transactions", "issue"=>"
then find out what Your issue here to get more info
https://developer.paypal.com/webapps/developer/docs/api/#validation-issues
I had the same issue. In my case it was Credit Card issue which might be over used. So I have taken new Credit card Number from this site Testing Credit card and replaced with the old one.
Here is Credit Card Information that I used
credit_card = new CreditCard()
{
billing_address = new Address()
{
city = "Johnstown",
country_code = "US",
line1 = "52 N Main ST",
postal_code = "43210",
state = "OH"
},
cvv2 = "874",
expire_month = 11,
expire_year = 2018,
first_name = "Joe",
last_name = "Shopper",
number = "4024007185826731", //New Credit card Number, Only Card type should match other details does not matter
type = "visa"
}
Note: All the Credit Card mentioned in PayPal site are not working, giving same issue for me. If it working for you then it's good otherwise use new testing Credit Card Number. Hope this will help someone.
Thank you! Enjoy Coding!
I too got struck with this issue, there might be many other possible root cause for this failure but then in my case all my passing argument is correct, but then it failed in sandbox environment, I just changed Payment option from PayPal Balance to Visa then it started working.
I recently had a 400 bad request error as well. In my case, I was processing a refund using RefundRequest, and it appears that PayPal recently changed the constraints on the "reason" field (although it isn't documented that I can find) so my lengthy descriptions of what was being returned were no longer acceptable. I found the error only because I saw another field where PayPal was now requiring that it be only single-byte alphanumeric characters. What actually helped though, was shortening the data I was putting through as a reason to simply "Returned items".
Obviously this is an old thread, and I'm sure the original problem was solved long ago, but if using some of the above methods to determine more information about an error don't yield results I would suggest submitting a request with the bare minimum of information until you can get it to go through. Then, start adding additional fields/information back to see if you can identify which field contains the information causing the bad request. That would have worked for my issue, at least.
Understand your errors
PayPal returns detailed data on every exception (except 500 INTERNAL_SERVER_ERROR), explaining what was the exact error you are seeing. You can retrieve that as follows:
Update your exception handling to catch PayPalConnectionException and print $ex->getData() as shown below:
try {
$payment->create($apiContext);
} catch (PayPal\Exception\PayPalConnectionException $ex) {
echo $ex->getCode(); // Prints the Error Code
echo $ex->getData(); // Prints the detailed error message
die($ex);
} catch (Exception $ex) {
die($ex);
}
It is due to the wrong currency or amount you have given.
I faced the issue in React JS
I was doing this. in the createOrder method.
purchase_units: [{
amount: {
currency_code: 'PHP',
value: totalAmount
}
}],
that was the issue. If i gave any currency other than USD i will get the 400 Error. So i removed the currency_code from here
And I moved the currency declaration into my component declaration.
like this.
options={{
clientId: " Your_ID " ,
currency: "PHP"
}}
Here you can give any currency you want. This solves my 400 Error
If you use Paypal Sandbox for testing Driver and on first try with buggy code it shows the client a 400 Bad request error.
Reason:- Paypal sent JWT auth and it was stored in the client's local storage.
Suggestion:- Try to clear the client's local storage cache (You only need to clear the Paypal Token).
This works for me, I hope it works for you :)

QBO API V3.0: Persistent error today retrieving Tax Rates

We have consistently getting the following error today when using API V3.0 to retrieve TaxRate from QBO:
An application error has occurred while processing your request - Detail: System Failure Error: An unexpected error occurred while accessing or saving your data. Please wait a few minutes and try again. If the problem persists, contact customer support. - Error Code: 10000
Is this a temporary issue with the servers or has something changed in the API ?
Thanks
I tried both the taxrate endpoints(findById and Query) from ApiExplorer and got a successful response.
GetById - https://qb.sbfinance.intuit.com/v3/company/688779980/taxrate/2
Query - https://qb.sbfinance.intuit.com/v3/company/688779980/query?query=select * from TaxRate
Can you please give it a try from ApiExplorer and check if you are hitting the correct endpoints. Otherwise you can raise a support ticket mentioning your company's relamID.
EDIT
Standard BASE URL for V3 - https://quickbooks.api.intuit.com/v3/company
We get the following when we try this call using devkit -
https://quickbooks.api.intuit.com/v3/company/1119166485/query?query=select+*+from+TaxRate&requestid=faf9f5e207134f24930eef40c9b8a21a&
Thanks
There is a bug in .net devkit where IDSquery will not work for count.
You need to use the following lamda function until the fix is in place-
QueryService AccQueryService2 = new QueryService(context);
int accs22= AccQueryService2.Select(c => c).Count();
Refer:
https://intuitpartnerplatform.lc.intuit.com/questions/829658-how-to-select-count-from-invoice-using-idsquery-to-return-int?jump_to=comment_1941998
EDIT:
The team has identified this a bug. They will rectify this in the next release around 1 month from now.

paypal TAXAMT error

I'm trying to add TAXAMT to the transaction. Here's what the query sent:
&PAYMENTREQUEST_0_PAYMENTACTION=Authorization
&RETURNURL=http://zzz.com/returnurl
&CANCELURL=http://zzz.com/cancelurl
&NOSHIPPING=1
&PAYMENTREQUEST_0_CURRENCYCODE=USD
&L_PAYMENTREQUEST_0_QTY0=1
&L_PAYMENTREQUEST_0_NAME0=Shirt
&L_PAYMENTREQUEST_0_AMT0=89.10
&L_PAYMENTREQUEST_0_TAXAMT0=3.56
&PAYMENTREQUEST_0_TAXAMT=3.56
&PAYMENTREQUEST_0_AMT=92.66
but for some reason it's not working. When I add the TAXAMT as a normal item it goes through:
&PAYMENTREQUEST_0_PAYMENTACTION=Authorization
&RETURNURL=http://zzz.com/returnurl
&CANCELURL=http://zzz.com/cancelurl
&NOSHIPPING=1
&PAYMENTREQUEST_0_CURRENCYCODE=USD
&L_PAYMENTREQUEST_0_QTY0=1
&L_PAYMENTREQUEST_0_NAME0=Shirt
&L_PAYMENTREQUEST_0_AMT0=89.10
&L_PAYMENTREQUEST_0_QTY1=1
&L_PAYMENTREQUEST_0_NAME1=Sales+Tax
&L_PAYMENTREQUEST_0_AMT1=3.56
&PAYMENTREQUEST_0_AMT=92.66
Can anyone help me figure out the problem with the TAXAMT. At the moment I get the following error with it:
SetExpressCheckout API call failed.
Detailed Error Message: The totals of the cart item amounts do not match order amounts.
Short Error Message: Transaction refused because of an invalid argument. See additional error messages for details.
Error Code: 10413
Error Severity Code: Error
You're missing:
&PAYMENTREQUEST_0_ITEMAMT=89.10
L_PAYMENTREQUEST_xxxxx indicates the amounts for individual items.
PAYMENTRQUEST_xxxx indicates the total amounts for all items together.

PayPal API charging card but returning error

Please excuse me if this is a newbie question but I have never worked with any sort of credit card API before and I am, well, pretty much a newbie...
I have a script with "PayPal integrated" heh, and its not working.
When I run a card on the PayPal Sandbox, the transaction seems to go through, my sandbox account gets credited the amount but the script returns this error:
TIMESTAMP: 2011-04-25T14:03:42Z
CORRELATIONID: 5e727288789fb
ACK: SuccessWithWarning
L_LONGMESSAGE0: This transaction has been completed, but the total of items in the cart did not match the total of all items.
AMT: 25.00
CURRENCYCODE: EUR
AVSCODE: X
TRANSACTIONID: 4MM79765A4836914N
I understand the error message, but I am not sure where to begin looking in order to try and rectify it.
Sorry if this question is blurry, I am pretty lost and hoping that someone could just help get me pointed in the right direction here?
Thanks in advance!
"In your request string you may have use &L_COST0=18.00& for amount".
which may create problem for transaction, The variable for line item is L_AMTn so in this case it should be &L_AMT0=18.00&.
Just try this if needed. otherwise send the request string you had pass for more detail view.
Thanks.
you are suppose to called this function-
$httpParsedResponseAr = PPHttpPost('DoDirectPayment', $nvpStr);
where
$nvpStr = &PAYMENTACTION=$paymentType&AMT=$amount&CREDITCARDTYPE=$creditCardType&ACCT=$creditCardNumber".
"&EXPDATE=$padDateMonth$expDateYear&CVV2=$cvv2Number&FIRSTNAME=$firstName&LASTNAME=$lastName".
"&STREET=$address1&CITY=$city&STATE=$state&ZIP=$zip&COUNTRYCODE=$country&CURRENCYCODE=$currencyID";
Some parameters may diff for your payment process,
so you can try this.
Thanks.