Creating a plan in braintree is giving 500 internal server error in php

113 views Asked by At

I am trying to create a plan in my braintree sandbox but it is giving me 500 internal server error. Creating plan via php because i want to test 1 day recurring payment so that i can perform my rest operation.

here is my code

Braintree_Configuration::environment(BRAINTREE_ENVIRONMENT); // Change to production
Braintree_Configuration::merchantId(BRAINTREE_MERCHANT_ID);
Braintree_Configuration::publicKey(BRAINTREE_PUBLIC_KEY);
Braintree_Configuration::privateKey(BRAINTREE_PRIVATE_KEY);
    
try{
    $plan = Braintree_Plan::create([
          'name' => 'My Example',
          'price' => '10.00',
          'billingDayOfMonth' => 1,
          'billingFrequency' => 1,
          'numberOfBillingCycles' => 12, // Number of billing cycles, or set to 0 for indefinite
          'trialDuration' => 0,
          'trialDurationUnit' => Braintree\Subscription::TRIAL_DURATION_UNIT_DAY
      ]);
      echo'<pre>';print_r($plan);die;
    }catch(Braintree_Exception $e){
        echo 'Some error: ' . $e->getMessage();
    } 

If this is right code to achieve what i want then what would be porblem?

The error I am getting is

Call to undefined method Braintree\Plan::create()

0

There are 0 answers