PayplansPlan object allows you to perform numerous actions without writing a single query on the Plan entity.
Get current Plan
public function getPlans()
Return the id of current Plan.
Get/Set expiration time of Plan
public function setExpiration($time)
Set the Expiration time of Plan and return plan instance.
public function getExpiration()
Return an array of Expiration time of Plan.
public function getRawExpiration()
Return expiration time of plan.
public function getExpirationType()
Return expiration type of the plan that is whether plan is of Fixed, Recurring or forever type.
Get Description of Plan
public function getDescription()
Return description of Plan.
Get plan app
public function getPlanapps()
Return array of app id, the current plan is attached with.
Get details of Plan
public function getDetails()
Return details related parameters of the plan i.e. expirationtype, expiration, recurrence_count, trial price and time.
Get All Groups attached with the Plan
public function getGroups()
Return an array of all group-id, current plan is attached with.
Get Plan Price
public function getPrice($type = null)
param $type
if type is not set then return the regular/normal price
if it is set to RECURRING_TRIAL_1 then return first trial price
if it is set to RECURRING_TRIAL_2 then return second trial price
Returns the price of plan.
Find whether plan is published or not
public function getPublished()
Return 1 when plan is published else return 0
Get recurrence count
public function getRecurrenceCount()
Return the recurrence count set for current Plan.
Get url to redirect
public function getRedirecturl()
Return the url, where the user is redirected to(Thanks page), after completing subscription.
Check if plan is recurring or not
public function isRecurring()
Return whether Plan is Recurring or not.Return True if it is recurring else False.
Delete Plan
public function delete()
Delete plan only if no subscription exists for the corresponding Plan.Return true,if plan is deleted successfully else return False.
Subscribe Plan
public function subscribe($userId)
Create an order and subscription.Attach an order with subscription and return order instance.
Get Css Classes
public function getCssClasses()
Return Css class applied on current plan.
Get/Set Currency
public function getCurrency($format = null)
param $format:-way in which currency is shown.Format is set in the configuration for Payment
processor.
Return the currency based on the format.
public function setCurrency($currency = null)
Set the currency.
Get teaser text of plan
public function getTeasertext()
Return Teaser text of a Plan.
Get title of plan
public function getTitle()
Return Title of Plan.
Check if the Plan is bind with the App or not
function hasApp($appId)
param $appId = App Id
It check if Plan is attached with App having $appId or not. And return true if this plan is attached with this App else return false.
Reset plan
public function reset()
Reset current plan object.
Save Plan
public function save()
Save the Plan.