w3up
w3up copied to clipboard
Pricing capabilities
We want to have capabilities to switch between pricing plans. Here is the preliminary list
Check current plan
{
"can": "plan/get",
"with": "did:mailto:web.mail:alice"
}
// receipt
{
out:
ok: {
updatedAt: 1696865150828, // timestamp when plan was set
product: "did:web:starter.w3up.storage"
}
}
}
Update plan
{
"can": "plan/set"
"with": "did:mailto:web.mail:alice"
"nb": {
"product": "did:web:lite.w3up.storage"
}
}
// receipt
{
out:
ok: {
updatedAt: 1696865387813, // timestamp when plan was set
product: "did:web:lite.w3up.storage"
}
}
}
List plans (user can choose from)
{
"can": "plan/list",
"with": "did:mailto:web.mail:alice"
}
{
out: {
ok: {
"did:web:starter.w3up.storage": {
???
},
"did:web:lite.w3up.storage": {
???
},
"did:web:expert.w3up.storage": {
??
}
}
}
}
And here is the my sketch of dynamo table
export const customerTableProps = {
fields: {
/**
* CID of the UCAN invocation that set it to the current value.
*/
cause: 'string',
/**
* DID of the user account e.g. `did:mailto:agent`.
*/
customer: 'string',
/**
* Opaque identifier representing an account in the payment system
* e.g. Stripe customer ID (stripe:cus_9s6XKzkNRiz8i3)
*/
account: 'string',
/**
* Unique identifier of the product a.k.a tier.
*/
product: 'string',
insertedAt: 'string', // `2022-12-24T...`
updatedAt: 'string', // `2022-12-24T...`
},
primaryIndex: { partitionKey: 'customer' },
}
updatedAt: 1696865150828, // timestamp when plan was set
We have generally used ISO8601 date strings in capabilities, so I think it makes sense to stick with them.
Otherwise this all looks great!
per the update above, I've implemented plan/get
in https://github.com/web3-storage/w3up/pull/1005