Skip to content

Commit

Permalink
Pricing as code update
Browse files Browse the repository at this point in the history
  • Loading branch information
kyyberi committed Oct 5, 2024
1 parent c5046c0 commit 79eced3
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 63 deletions.
23 changes: 2 additions & 21 deletions source/examples/Pricing/pricing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,8 @@ pricingPlans:
- Billed monthly
executable:
- name: Premium subscription 1 year
type: Stripe
# On Stripe to get started with Payment Links, create a product, then use that product to create a price.
reference: urls to Stripe docs

# CREATE: Here we want to provide YAML or alike as code in order to create the product in Stripe
# Stripe supports standard pricing (charging the same price for each unit—either
# one time or recurring) and Customer chooses price (letting your customer specify
# the price). It doesn’t support advanced options like package pricing, graduated
# pricing, or volume pricing. Additionally, Customer choose prices currently doesn’t
# support recurring payments or donations. https://docs.stripe.com/payment-links/api

type: Stripe
reference: https://docs.stripe.com/payment-links/api
create:
spec: |-
stripe products create \
Expand All @@ -34,23 +25,13 @@ pricingPlans:
--unit-amount=50 \
-d "recurring[interval]"=month \
-d "product_data[name]"="Premium subscription 1 year"
# MODIFY: Here we want to provide YAML or alike as code in order to modify the product in Stripe

update:
spec: |-
- update the product
- update the price
# RETIRE: Here we want to provide YAML or alike as code in order to retire the product in Stripe

retire:
spec: |-
- retire the product
# PURCHASE: Here we want to generate active link or other information
# to ignite the purchase on Stripe

purchase:
spec: |-
- generate or get the link in order to provide method for client to ignite purchase process
Expand Down
89 changes: 47 additions & 42 deletions source/includes/_pricing.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,54 +77,50 @@ The _unit_ attribute defines the plan and options for that are fixed unless exte
```yml

pricingPlans:
en:
- name: Premium subscription 1 year
priceCurrency: EUR
price: 50.00
billingDuration: year
unit: recurring
maxTransactionQuantity: unlimited
offering:
- High Quality Pets data
- Unlimited transactions
- Billed annually
- name: Premium Package Monthly
priceCurrency: EUR
price: 5.00
billingDuration: month
unit: recurring
maxTransactionQuantity: unlimited
offering:
- High Quality Pets data
- Unlimited transactions
- Billed monthly
- name: Freemium Package
priceCurrency: EUR
price: 0.00
billingDuration: month
unit: recurring
maxTransactionQuantity: 1000
offering:
- High Quality Pets data
- Free to use, no cost at all!
- Fair amount of transactions for testing and small business
- name: Revenue sharing
priceCurrency: percentage
price: 5.50
billingDuration: month
unit: revenue-sharing
maxTransactionQuantity: 20000
offering:
- High Quality Pets data
- No upfront fee
- Billed monthly

declarative:
en:
- name: Premium subscription 1 month
priceCurrency: EUR
price: 50.00
billingDuration: month
unit: recurring
maxTransactionQuantity: 200000
offering:
- High Quality Pets data
- High amount of transactions
- Billed monthly
executable:
type: Stripe
version: 1.2
reference: https://docs.stripe.com/payment-links/api
create:
spec: |-
stripe products create \
--name="Premium subscription 1 year"
stripe prices create \
--currency=eur \
--unit-amount=50 \
-d "recurring[interval]"=month \
-d "product_data[name]"="Premium subscription 1 year"
update:
spec: |-
# update plan as Stripe requires
retire:
spec: |-
# delete of the plan as Stripe requires
purchase:
spec: |-
# generate or get the link in order to
# provide method for client to ignite purchase process
```
| <div style="width:150px">Element name</div> | Type | Options | Description |
|---|---|---|---|
| **pricingPlans** | element | - | Binds the pricing plans related elements and attributes together |
| **en** | element | [ISO 639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) defined 2-letter codes | **NOTE! This is a dynamic element!** This element binds together other product pricing plan attributes and expresses the langugage used. In the example this is "en", which indicates that pricing plan details are in English. If you would like to use French details, then name the element "fr". The naming of this element follows options (language codes) listed in [ISO 639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) standard. <br/><br/> You can have product pricing plan details in multiple languages simply by adding similar sets like the example - just change the binding element name to matching language code. <br/><br/> The pattern to implement multilanguage support for data products was adopted from de facto UI translation practices. The attributes inside this element are commonly rendered in the UI for the consumer and providing a simple way to implement that was the driving reasoning. See for example [JSON - Multi Language](https://simplelocalize.io/docs/file-formats/multi-language-json/) |
| **declarative** | element | - | Grouping element which collects together data product pricing plans with business details |
| **priceCurrency** | string | Use standard formats: [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) currency format e.g. "USD"; Ticker symbol for cryptocurrencies e.g. "BTC" | The primary currency used in pricing. Platforms are assumed to use this as primary currency if currency conversions are used to display product pricing in different locations for various currencies. If the *unit* is revenue-sharing, then this attribute value MUST be percentage. |
| **price** | string | - | The offer price of a product, or of a price component, or revenue-sharing percentage. <br/><br/> If the *unit* of pricing is revenue-sharing, then this *price* attribute value is percentage value. <br/><br/> Use '.' (Unicode 'FULL STOP' (U+002E)) rather than ',' to indicate a decimal point. Avoid using these symbols as a readability separator. Use values from 0123456789 (Unicode 'DIGIT ZERO' (U+0030) to 'DIGIT NINE' (U+0039)) rather than superficially similiar Unicode symbols. <br/><br/>With *data-volume* the price is for each 1GB of data. |
| **billingDuration** | string | options: instant, day, week, month, year | Specifies for how long this price (or price component) will be billed. Can be used, for example, to model the contractual duration of a subscription or payment plan. |
Expand All @@ -140,5 +136,14 @@ pricingPlans:
| **additionalPrice** | string | - | This is used to define fees for usage which exceeds the defined max transaction quantity. This value is for each additional transaction. Use '.' (Unicode 'FULL STOP' (U+002E)) rather than ',' to indicate a decimal point. Avoid using these symbols as a readability separator. Use values from 0123456789 (Unicode 'DIGIT ZERO' (U+0030) to 'DIGIT NINE' (U+0039)) rather than superficially similiar Unicode symbols. |
| **maxDataQuantity** | Integer | - | The maximum amount of data transferred during the billing duration. Unit is GB. |
| **valueSimulator** | url | valid url | Intended to be used with *value-based* pricing plan. Provide url to value simulator in which customer can see the value in various cases. In the simulator customer might be able to input own variables to match their exact case and see the gained value. |
| **executable** | element | - | Grouping element which collects together pricing plans payment gateway management features. You can define the needed action (CRUP) to setup and use the gateway to ignite purchase process. <br/><br/> CRUP stands for: **C**reate, **R**etire, **U**pdate, and **P**urchase. The actual as code part is added with _spec_ element. |
| **type** | attribute | string, one of: _Stripe_, _Custom_ | Payment gateway system name. Use one of the predefined options only. With _Custom_ type you can use your in-house solution. |
| **version** | attribute | string | The version of the payment gateway tool used. |
| **reference** | URL | Valid URL | Provide URL pointing to the reference documentation |
| **create** | element | - | Contains the as code part to create pricing plan in the payment gateway |
| **retire** | element | - | Contains the as code part to retire (delete) pricing plan in the payment gateway |
| **update** | element | - | Contains the as code part to update pricing plan in the payment gateway |
| **purchase** | element | - | Contains the as code part to create or get pricing plan purchase igniting link in the payment gateway |
| **spec** | element | YAML/URL/string | The content the as code part for the pricing plan. Content is intended to be in a form that can be injected as is to _type_ defined payment gateway system. Content depends of the system used and reference attribute is expected to provide more information. <br/><br/> **Note!** By default the rules must be provide as valid YAML, either as inline element (YAML) or as valid URL (filesystem or online) pointing to valid YAML content file. String content is allowed and used only if _type_ attribute value is _Custom_. In the custom case your string of course can be YAML too. |
If you see something missing, described inaccurately or plain wrong, or you want to comment the specification, [raise an issue in Github](https://github.com/Open-Data-Product-Initiative/dev/issues)

0 comments on commit 79eced3

Please sign in to comment.