paypalrecurring-billing

Paypal BillingFrequency and BillingPeriod


I'm getting a little bit confused in payapl BillingFrequency and BillingPeriod.

The paypal sites states that

BILLINGFREQUENCY: Number of billing periods that make up one billing cycle.

BILLINGPERIOD: The unit of measure for the billing cycle. Must be one of :Day,Week,SemiMonth,Month,Year

My question is how can I create recurring profiles for following 1. Once a month 2. Once after 3 months 3. Once after 6 months 4. Once a year

I've tried the following but still not sure if I'm right.. I cannot deploy the code for testing as the site is live.

    if(intval($subsType->validity) == 1)
    {
        $paymentBillingPeriod->BillingFrequency = 1;
        $paymentBillingPeriod->BillingPeriod = "Month";
        $paymentBillingPeriod->TotalBillingCycles = 0;
    }
    elseif(intval($subsType->validity) == 3)
    {
        $paymentBillingPeriod->BillingFrequency = 3;
        $paymentBillingPeriod->BillingPeriod = "Month";
        $paymentBillingPeriod->TotalBillingCycles = 0;
    }
    elseif(intval($subsType->validity) == 6)
    {
        $paymentBillingPeriod->BillingFrequency = 6;
        $paymentBillingPeriod->BillingPeriod = "Month";
        $paymentBillingPeriod->TotalBillingCycles = 0;
    }
    elseif(intval($subsType->validity) == 12)
    {
        $paymentBillingPeriod->BillingFrequency = 1;
        $paymentBillingPeriod->BillingPeriod = "Year";
        $paymentBillingPeriod->TotalBillingCycles = 0;
    }

Solution

  • First, you need to setup a separate test site for your live site. Just like PayPal does with sandbox.paypal.com, you can create a sandbox.yourdomain.com and develop everything there against the PayPal sandbox. Then move the code to your www.yourdomain.com when you know it's ready.

    As for your samples here, I'm a little confused by your wording.

    1) This one you've got correct. It would do once per month indefinitely until canceled.

    2) If you really mean ONCE after 3 months, and not once every 3 months, then you would need to change the TotalBillingCycles to 1. That way it would bill just one time after 3 times (depending on the start date you set for the profile).

    Same goes for the the others. What you're showing would do once per month, once every 3 months, once every 6 months, and then once per year.