laravel-paypal: can not create plan without trial pricing

I can not create subscription plan for a user if I pass without add addPlanTrialPricing() method, and if i send 0 days as trial days it also can not create plan. without addPlanTrialPricing() method its giving Request is not well-formed, syntactically incorrect, or violates schema error

here is my sample code

if($userPackage->regular_tier == 'D'){ 
           $plan = 'addDailyPlan';
        } elseif ($userPackage->regular_tier == 'M') {
            $plan = 'addMonthlyPlan';
        } elseif ($userPackage->regular_tier == 'W') {
            $plan = 'addWeeklyPlan';
        } else {
            $plan = 'addYearlyPlan';
        }
$provider = PayPal::setProvider();
        $provider->getAccessToken();
$response = $provider->addProduct( $userPackage->title . " teacher: #".auth()->id(), $userPackage->desc, 'SERVICE', 'SOFTWARE' )
       // ->addPlanTrialPricing( $trialTier, $userPackage->trial_period )
        ->$plan( $userPackage->title . " teacher: #".auth()->id(). " plan", $userPackage->desc, $userPackage->regular_amount )
        ->setupSubscription( auth()->user()->full_name, auth()->user()->email,now()->addMinute() );
        

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 16 (6 by maintainers)

Most upvoted comments

@fftfaisal You are not offering a solution for the solution you reported, but you kept pointing out the mistake. You could have quietly opened a PR for this.

The issue of no trial pricing has been fixed, and a new release has been tagged.

Your code is wrong. now()->addMinute() creates a Carbon instance and returns it. Look at my code, I am passing in a simple date string.

I just create one with & without trial pricing. Obviously, the problem seems to be with your account. The code just works. I would rather have a different description for the product & plan.

Stop making it so complex for yourself.

I have the same problem, I can’t create a plan without the trial. I have also seen that it is not possible to create a different payment cycle (every six months for example) by passing the data. I fork your repository, now I make the changes and do the PR

If you can come up with a fix, please add a PR for this.