> For the complete documentation index, see [llms.txt](https://docs.payswap.org/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.payswap.org/products/cancan/dynamic-pricing.md).

# Dynamic Pricing

This feature enables you to set a price that changes over time. Suppose you want your product to start off with a price of 10 tokens but cost 2 tokens in the second week, 14 tokens in the third week and 100 tokens in the fourth.

We will:

* Set the prices array of our product to : 10, 2, 14, 100
* Set the period to the number of seconds in week: 24 \* 7 \* 60 \* 60 = 604800
* Set the start time to now, you can get the current time on [this website](https://www.epochconverter.com/). The time for the moment this article is being written is 1697760417

<figure><img src="/files/GcT8vJogFUeuCWLWBle0" alt=""><figcaption></figcaption></figure>

The marketplace will use the period and the start time parameters to compute the index of the price in any moment in time. For instance:

* the index during the first week: index = (current time - start time) / period = 0

Since we are still in the first week the difference between the current time and the start time will be inferior to our period (which is the duration of a week). That is why our first index is 0

* during the second week: period <= current time - start time < 2 \* period so:

index = (current time - start time) / period = 1

* during the third week: 2 \* period <= current time - start time < 3 \* period so:

index = (current time - start time) / period = 2

* during the fourth week: 3 \* period <= current time - start time < 4 \* period so:

index = (current time - start time) / period = 3

Since the index for week 1, 2, 3, 4 in the prices arrary (10, 2, 14, 100) are 0, 1, 2, 3, that translates to the following prices for our product:

* week 1: 10 tokens
* week 2: 2 tokens
* week 3: 14 tokens
* week 4: 100 tokens

You can set the parameters for your dynamic pricing when listing your product. At the end of the listing form, set the parameter View Advanced Parameters to Yes to review the advanced parameters. Find the Dynamic Prices field and input the appropriate value for your prices array, you start time and period. Obviously this is after filling in all the previous values about the product you are listing.

<figure><img src="/files/mSSHT3Mq95q9oQFJ5PKk" alt=""><figcaption></figcaption></figure>

* Validate the form

Congratulations! You have setup dynamic pricing on your product

### Benefits of Dynamic Pricing

* This can help you figure out the right price for your product. By testing different prices over different weeks/months/etc you can collect data on the price that makes the most sale for instance.
* This can also be used to automatically appreciates an items' price over time


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.payswap.org/products/cancan/dynamic-pricing.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
