cancel
Showing results for 
Search instead for 
Did you mean: 

PayPal Billing-Plans Error

Options
MichaelM2
Contributor
Posted on

I have some Problem with PayPal billing-plans this is my code.

$url='https://'.PPURL.'/v1/payments/billing-plans/'.$resultGetPlanURL['id'].'/';
$JSONrequest='[
    {
        "op": "replace",
        "path": "/",
        "value": {
            "state": "ACTIVE"
        }
    }
]';

  $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_HTTPHEADER, array(
        'Content-Type: application/json',
        'Authorization: Bearer '.$_SESSION['access_token']
        ));

    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION,1);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
    curl_setopt($ch, CURLOPT_POSTFIELDS, $JSONrequest);

    $result = curl_exec($ch); 
    $resultGetPlanActive = json_decode($result,true);
    curl_close ($ch);

 

The result i get is 'java.lang.NullPointerException'.

The Billing Plan ID is right and the access_token too.

 

Whats the problem?

I don't use SDK.

 

3 REPLIES 3

PayPal Billing-Plans Error

Options
MTS_Ciaran
PayPal Employee

Hi, the error you're getting looks to be a Java related error, but the code you posted looks to be PHP. Can you let me know a little more about what type of setup you have on your server?

PayPal Billing-Plans Error

Options
Dark-Unicorn
Contributor

Hi,

 

I saw this thread and thought that's exactly the same problem I have, so I wanted to provide a bit of information from my side.

 

I have a self written PHP application to integrate the Rest API.

I can successfully create a billing plan. But when trying to activate it the above Java exception is returned.

This strikes me as strange as normally API errors are returned as such.

 

 

Since this forum doesn't allow me to post my debug information, [here] is the link to my provisional test script.

 

Maybe someone can help and tell me what is wrong here.

Is this a PayPal problem or am I doing something wrong?

 

PayPal Billing-Plans Error

Options
Dark-Unicorn
Contributor

I found the error, now.

 

The problem was that I used POST method for updating the billing plan but it has to be method PATCH.

Haven't Found your Answer?

It happens. Hit the "Login to Ask the community" button to create a question for the PayPal community.