sell_book
Create a checkout link for a book order with an itemized price breakdown, calculating total from price, quantity, delivery fee, and discount. Returns a payment URL to send the buyer.
Instructions
Create a checkout link for a book order, with the price breakdown filled in.
Builds the line items (copies, discount, delivery), computes the total as
price * quantity + delivery_fee - discount, generates a unique reference ID from
the title, and creates the payment link. Returns the checkout `url` to send the
buyer. The total must reach Wayl's 1000 IQD minimum or the call is rejected.
The buyer sees an itemised breakdown rather than a bare number, which is what you
want for anything beyond a single flat-priced copy.
Creating the link charges nobody — it only produces a checkout page, and a link
created with env='test' never moves real money at all. Do NOT deliver the book
(send a download link, ship a copy) until `check_order_paid` or `parse_webhook` returns
`safeToFulfil: true`. That is a different field from `paid`: a sandbox payment
settles and is still not something to ship against.
Use `create_payment_link` instead when you need a webhook, redirect or custom
line items for one order: here those URLs come from the server's
WAYL_WEBHOOK_URL, WAYL_WEBHOOK_SECRET and WAYL_REDIRECT_URL settings and cannot
be set per call. Persist the returned `code` — no other endpoint returns it.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| env | No | 'live' takes real money, 'test' is a sandbox that charges nobody. Defaults to 'test'. | |
| price | Yes | Price of one copy in whole IQD — no decimal subunits. The order total after delivery and discount must still reach 1000 IQD. | |
| title | Yes | Book title, used as the checkout line-item label. Long titles are truncated to Wayl's 255-character label limit; very short ones are padded to its 3-character minimum. | |
| discount | No | Discount to subtract from the whole order, in whole IQD — not per copy. | |
| quantity | No | How many copies. | |
| delivery_fee | No | Delivery or handling charge in IQD. Use 0 for ebooks. | |
| reference_id | No | Your order ID, unique across all your links. Generated from the title if omitted. | |
| customer_note | No | Free-form note stored on the order as `customParameter` and echoed back on reads, for your own tracking. May be visible at checkout, so keep secrets out of it. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||