# Template sales (one link, many payments) Building with an AI agent? Start at https://docs.payme.io/agents.md Last updated: 2026-11-23 ## Prerequisites - The seller's seller_payme_id (MPL) ## Related - [Create a sale (hosted payment page)](/payments/hosted-payment-page/post-generate-sale) - [Cancel a template sale](/payments/post-sale-actions/post-cancel-template) - [Create a multi-method checkout sale](/payments/hosted-payment-page/post-generate-sale-2) - [Sale Types](/payments/codes-statuses/sale-types) A template sale is one payment link that many buyers can pay, for example a link you share on a social network. ## 1. Create the link Create it with [`generate-sale`](/payments/hosted-payment-page/post-generate-sale) and `sale_type: template`. The `sale_url` you get back has the form `…/sale/template/`. | Field | Value | |---|---| | `sale_type` | `template` | Every other `generate-sale` field is on [Create a sale](/payments/hosted-payment-page/post-generate-sale). A template is not the multi-method checkout (`sale_payment_method: multi`), which lets one buyer choose how to pay: see [Create a multi-method checkout sale](/payments/hosted-payment-page/post-generate-sale-2). ## 2. What each payment creates Each payment creates a new sale (`sale_type` `4`, `SaleFromTemplate`) with its own `payme_sale_id` and its own callbacks. The template sale itself stays `initial`. ## 3. Close the link The link stays open until you cancel it with [`cancel-template`](/payments/post-sale-actions/post-cancel-template) (send the template's ID as `sale_payme_id`), or until `sale_expiry_seconds` passes, if you sent it. Cancelling works only while the template is `initial` and sets it to `canceled`; payments on it then fail with error `305`. ## Errors - You can't send `buyer_key` with a template (error `606`). - `echeck` isn't supported on templates (error `4`).