create_payment_link
Generate a payment link to receive a checkout URL for charging buyers in IQD. Supports live/test mode, line items, and webhooks.
Instructions
Create a Wayl payment link and return the checkout URL to send the buyer.
This is the general-purpose builder. For selling a book, `sell_book` is usually less
work — it derives the line items and reference ID for you.
The returned `url` is the hosted checkout page. Nothing is charged until the buyer
completes payment there; poll `check_order_paid` or handle the webhook to learn when
that happens. env='live' takes the buyer's real money; env='test' charges nobody.
`reference_id` must be unique across every link you have ever created; omit it and
one is generated. Passing `webhook_url` without `webhook_secret` is refused — an
unsigned notification cannot be authenticated.
Record the response's `code` and any `webhook_secret` you pass: neither is returned
by any other Wayl endpoint, and no read endpoint reports a link's `env` either. This
call is never retried and Wayl has no idempotency key, so after a timeout check
`get_payment_link` before creating a second link.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| env | No | 'live' takes real money, 'test' is a sandbox that charges nobody. Defaults to 'test'. | |
| total | Yes | Amount to charge in whole IQD. Minimum 1000. | |
| currency | No | Currency code. Wayl settles in IQD only. | IQD |
| line_items | No | Optional cost breakdown shown at checkout. The amounts must reconcile to `total` — increases minus decreases, or the plain sum of every amount; Wayl does not document which, so either is accepted. | |
| webhook_url | No | URL Wayl POSTs to when the payment status changes. | |
| reference_id | No | Your unique order ID. Must never repeat across your links. Omit to have one generated. | |
| webhook_secret | No | Shared secret used to sign webhooks, so you can prove a notification really came from Wayl. | |
| redirection_url | No | Where to send the buyer after paying. Wayl appends referenceId and orderid as query parameters. | |
| custom_parameter | No | Free-form string echoed back to you, for your own tracking. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||