Skip to content

Commit

Permalink
Add “limit” param to plans tag
Browse files Browse the repository at this point in the history
  • Loading branch information
edalzell committed Feb 17, 2020
1 parent 271c41e commit 3e80a10
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 1 deletion.
2 changes: 2 additions & 0 deletions Charge/Traits/HasSubscriptions.php
Original file line number Diff line number Diff line change
Expand Up @@ -189,9 +189,11 @@ public function plan()
*/
public function plans()
{
$limit = $this->getParamInt('limit', 10);
$plans = Plan::all(
[
'expand' => ['data.product'],
'limit' => $limit
]
)->toArray();

Expand Down
30 changes: 29 additions & 1 deletion docs/subscription/general.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,16 +54,40 @@ The general flow to subscribe a user to a plan/product is:

## Tags

All of these tags assume a logged in user.
### Plans

Lists your Stripe Plans

Supported Parameters:
* `limit` - optional, how many plans to return, defaults to 10 (Stripe default)

Fields:
* All data listed [here](https://stripe.com/docs/api/plans/object)

### Example

```
<select name="plan">
<option value="">--Please choose a plan--</option>
{{ charge:plans limit="20" }}
<option value="{{ id }}" {{ if plan == id }} selected{{ /if }}>{{ product.name }}{{ if nickname }}({{ nickname }}){{ /if }}</option>
{{ /charge:plans }}
</select>
```

### Create Subscription

Assumes a logged in user.

There are two ways to do it, with a mix of tags & JS or completely in JS:

* [JS + tag](create-subscription-tag.md)
* [JS](create-subscription-ajax.md)

### Update Plan/Quantity

Assumes a logged in user.

Use this tag to allow users to change their own subscription plan and/or quantity

Supported Parameters:
Expand All @@ -90,6 +114,8 @@ Fields:

### Update Billing Information

Assumes a logged in user.

Use this tag to allow users to change their billing information (credit card, etc)

Supported Parameters:
Expand Down Expand Up @@ -153,6 +179,8 @@ Fields:

### Cancel Subscription

Assumes a logged in user.

Use this tag to allow users to cancel their subscription

Supported Parameters:
Expand Down

0 comments on commit 3e80a10

Please sign in to comment.