paypalpaypal-sandboxpaypal-subscriptionspaypal-webhooks

Update subscription to end trial period and execute regular billing cycle using PayPal APIs


I have a subscription for a product with PayPal, such that it has some free trial given for n days. The trial period is on, and I want to end the trial period, and execute the regular cycle for the subscription. What can be done to update the subscription and handle this case?

I hope the approach will trigger webhook by its own.

billing_info: {
      outstanding_balance: { currency_code: 'USD', value: '0.0' },
      cycle_executions: [
        {
          tenure_type: 'TRIAL',
          sequence: 1,
          cycles_completed: 1,
          cycles_remaining: 0,
          total_cycles: 1
        },
        {
          tenure_type: 'REGULAR',
          sequence: 2,
          cycles_completed: 0,
          cycles_remaining: 0,
          current_pricing_scheme_version: 1,
          total_cycles: 0
        }
      ],
      next_billing_time: '2025-02-01T10:00:00Z',
      failed_payments_count: 0
    }

I have tried to use the update subscription API provided in the document, to update value for total_cycles for trial to 0

Update subscription API docs


Solution

  • I have found the solution for my use case. Instead of updating the subscription, I tried to revise my subscription plan by updating the plan ID.

    Referred documentation can be found here: Revise Subscription