What is wrong with this code to update the PayPal button? I get a "wrong button type error"

I am trying to dynamically update a button hosted in PayPal, but I get an error

The button type specified is invalid. 

I used the PPHttpPost function (which is probably fine), taken here: https://www.x.com/paypal-apis-dodirectpayment-php-5.3/nvp , I just deleted all the nvp variables except the API name, password and etc.

This is my code for using ButtonManager:

 // Set request-specific fields. $nvpStr = "&HOSTEDBUTTONID=buynow&BUTTONCODE=HOSTED&AMT=330.66&BUTTONTYPE=BUYNOW"; // Execute the API operation; see the PPHttpPost function above. $httpParsedResponseAr = PPHttpPost('BMUpdateButton', $nvpStr); var_dump($httpParsedResponseAr); ?> 

What am I doing wrong?

Edit

When I remove the HOSTEDBUTTONID from the query string and output the full NVP string, I get this (replaced some characters with an underscore for privacy):

 METHOD=BMUpdateButton&VERSION=98.0&PWD=1362320204&USER=___._1362320167_biz_api1.gmail.com&SIGNATURE=________________&BUTTONCODE=HOSTED&AMT=330.66 
+6
source share
1 answer

After you faced the same problem, I solved the problem.

As well as:

 "BUTTONTYPE" => "BUYNOW" 

You need:

 "BUTTONSUBTYPE" => "PRODUCTS" 

I know that it does not speak explicitly in the API docs, but it is really necessary.

The subtype will be either PRODUCTION or SERVICES.

+6
source

All Articles