Dynamic links
A Link Template is a URL with{{placeholders}} that is rendered when a voucher is redeemed. Use it in two ways:
- Code sets with a link:
linkTemplatein the set’s content renders a link next to each code, for examplehttps://acme-scooters.example.com/r?c={{code}}. The consumer gets both the code and the link. - Link sets with personal links: the
valueof each link voucher may itself contain placeholders, for examplehttps://acme-scooters.example.com/unlock/{{voucherId}}.{{code}}is not allowed there.
valid, renderedUrl, scheme, linkStyle (web for https, app for a custom scheme), the placeholders used, and issues when the template is invalid (invalid-link-template, link-host-not-allowed, scheme-not-allowed, unknown-placeholder, placeholder-in-host).
Placeholders
Data about consumers or their customers (redemption entity, link metadata, consumer identity) is never available to templates. Any other placeholder →
unknown-placeholder.
Encoding
- Placeholders may appear only in the path, query or fragment. Scheme, host and port are literal, so they can always be checked (
placeholder-in-hostotherwise). - Every substituted value is percent-encoded as an RFC 3986 component: the code
A B&Crenders asA%20B%26C. - The rendered link must parse again with an allowed host or scheme. If it does not, the redemption fails without using up a voucher, and AllRide is alerted.
https://acme-scooters.example.com/r?c={{code}}&v={{voucherId}} with code A B&C and voucher 5030 renders https://acme-scooters.example.com/r?c=A%20B%26C&v=5030.
Allowed hosts
- https links: the host must be listed in the set’s
allowedLinkHosts(up to 10 hosts, not under AllRide’s own domain). It is required as soon as an https link can occur: onlinksets and on code sets with an httpslinkTemplate. - App deep links: a custom scheme such as
acmescooters://must be listed inallowedLinkSchemes(up to 3, lower-case, pattern^[a-z][a-z0-9+.-]{1,31}$). Dashboards show app links only as an “Open in app” button. javascript,data,vbscript,file,blob,about,httpandintentare always refused, andhttpsbelongs inallowedLinkHosts, not inallowedLinkSchemes.- Both lists are content and change through change requests. A change request that removes a host or scheme still used by available link vouchers or by the template → 422
link-host-in-use; revoke those vouchers first.