edalzell / statamic-charge

One-time or subscription billing
13 stars 3 forks source link

Added “charge:prices” tag #94

Closed billmn closed 4 years ago

billmn commented 4 years ago

This PR add a new {{ charge:prices }} tag that allows to retrieve all product's prices, even if is set as "ONE TIME" price.

An example on how use the tag:

{{ charge:prices :product="product:id" scope="price" }}
    {{ if price:recurring }}
        <div>Price: {{ price:unit_amount divide="100" }} / {{ price:recurring:interval }}</div>
    {{ else }}
        <div>Price: {{ price:unit_amount divide="100" }}</div>
    {{ /if }}
{{ /charge:prices }}

Here a reference Stripe docs: https://stripe.com/docs/api/prices/list