Launch a shop
A hotel wants its own shop, served by Villa Market. For payments that needs three things: a channel id, a page the customer comes back to, and a check that the two fit the checkout. One build does all three.
The kit (channel-kit/) is on the dev branch (pull request #231, merged on 1 Dec 2026). On 1 Dec 2026 it was run
from a terminal against the current dev stack, where the channel registry is on: launch made
two Villa-hosted test shops (outlet-a, outlet-b), all four checks passed for each, and one payment was made
through each and came back to that shop's own page (after 3-D Secure the return page had to be opened by hand:
gap 9). The one-click build project is still only in the CodeBuild pull
request (deploy/codebuild/ci.yaml, ChannelProjects=yes) and has not been created.
On 1 Dec 2026 the villa.kitchen address in the examples reaches an older dev stack that has no hosted
checkout (/checkout/... answers 403 there). Use the current dev stack's MainApi address in its place: see
Base URLs.
What a launch makes
| The shop | You give | The launch makes |
|---|---|---|
| has its own site | CHANNEL_ID, CHANNEL_LABEL, RETURN_BASE (https://shop.hotelx.example) | The registry entry. The shop hosts /thankyou itself (copy channel-kit/thankyou/) |
| has nothing yet | CHANNEL_ID, CHANNEL_LABEL | A stack villapayment3-shop-<id>-<branch>: a private S3 bucket and a CloudFront site with the reference pages uploaded; then the registry entry, pointing at that site |
Then, in both cases, it checks what it can reach:
- the registry entry is valid and enabled;
- the thank-you page answers
200with HTML (skipped for an app's own scheme, which cannot be fetched); - when an API base is given (
API_BASE,--api-base; a launch that makes the site needs one): the status route answers JSON, and it can be read from the shop's origin. Without an API base both are reported as skipped.
The last line of the output says what happened:
CHANNEL hotel-x LIVE branch=dev returnBase=https://d111abcdef8.cloudfront.net parameter=/payment3/dev/checkout/channels/hotel-x
or PLAN ONLY: nothing was created, or a line that starts with STOP:. If the entry was written and a check then
failed, it says REGISTERED hotel-x, but a check failed: fix what failed and run check again, or disable.
One click: the build
In the AWS console open the CodeBuild project villapayment3-channel-dev (or -master), choose
Start build with overrides and set:
| Variable | Value |
|---|---|
RELEASE_SHA | The commit to run the kit from: the full 40-character sha of a commit on the branch |
CHANNEL_ID | hotel-x |
CHANNEL_LABEL | Hotel X shop |
RETURN_BASE | Empty for a Villa-hosted starter site, or the shop's own base |
ACTION | plan (the default: prints what would be made) or launch |
The branch comes from the project's own name, and the checkout API's address is set on the project
(ChannelApiBase of the CI stack): a build cannot change either. On a project that takes its code from GitHub,
also put the same sha in Source version.
The same from a terminal:
SHA=$(git rev-parse origin/dev)
aws codebuild start-build --region ap-southeast-1 --project-name villapayment3-channel-dev --source-version "$SHA" \
--environment-variables-override \
"name=RELEASE_SHA,value=$SHA,type=PLAINTEXT" "name=CHANNEL_ID,value=hotel-x,type=PLAINTEXT" \
"name=CHANNEL_LABEL,value=Hotel X shop,type=PLAINTEXT" "name=ACTION,value=plan,type=PLAINTEXT"
Run plan first and read it. The build's role can write only the channel registry of its branch and the
villapayment3-shop-* stacks, buckets and sites; it cannot touch the payment stack.
Without the build
The kit is a command-line tool. The commands that write (register, launch, disable, enable) are a plan until
--apply is added. validate only checks what you typed; show, list and check read and change nothing
(check also fetches the thank-you page and the status route).
# What would a Villa-hosted shop for Hotel X make? (no AWS call)
python3 channel-kit/channel.py --branch dev launch --id hotel-x --label 'Hotel X shop' \
--api-base https://villa.kitchen/api/payment3devapi
# The shop has its own site: register and check
python3 channel-kit/channel.py --branch dev launch --id hotel-x --label 'Hotel X shop' \
--return-base https://shop.hotelx.example --api-base https://villa.kitchen/api/payment3devapi --apply
| Command | Does |
|---|---|
validate | Checks an id, a label and a return base against the checkout's own rules. No AWS call |
register | Writes the entry (with --apply) and reads it back |
check | The four checks above, for a channel that is registered |
launch | The stack (when there is no return base), register, then check |
disable, enable | Turns a channel off or on for new sessions |
show, list | Reads one entry, or all of a branch |
Exit codes: 0 passed, 2 refused or a failed check, 1 an AWS or network error.
check fetches the thank-you page and the status route. It connects only to public addresses: a name or a redirect
that points at a private, loopback, link-local or metadata address is refused. A check that starts at localhost
(a developer's machine, never on master) stays on that machine.
The Villa-hosted starter site
channel-kit/shop-stack.yaml: a private, versioned, encrypted bucket, read by CloudFront only (origin access
control), with a response-headers policy. The pages may load scripts and styles from the site itself and may call
one origin, the checkout API:
default-src 'none'; script-src 'self'; style-src 'self'; connect-src <the API's origin>; base-uri 'none'; form-action 'none'; frame-ancestors 'none'
It is a payment return page (/thankyou) and a placeholder home page (/, the shop's name and one sentence), not a
storefront. Because there is no shop on it, its thank-you page has no "Back to the shop" link, unless the launch is
given the shop's address on the command line (--shop-url https://www.hotelx.example, checked like a return base;
the one-click build has no variable for it). A shop that hosts the page itself points the template's link
(href="/") at its own shop. A custom domain is a later step.
Taking a payment for the shop
Once hotel-x is live, a payment for it is a hosted checkout session that names it:
- A Villa-signed-in customer: the shop's front end calls
POST /checkout/sessionswith"source": "hotel-x". - Staff, or a Villa service acting for the shop:
POST /checkout/linkswith"channel": "hotel-x", then send the customer tourl.
A partner's own server must not hold a Villa staff key. Until a Villa-owned service creates the link for a
partner, a partner shop takes payments through links Villa staff or Villa services make. That service is the open
piece: the Commerce API's partner stores (catalogue, cart and orders for a partner; built on the partner-api
branch feat/p-partner-stores, not merged or deployed) use their own payment link today, not this checkout.
Take a shop down
python3 channel-kit/channel.py --branch dev disable --id hotel-x --apply
New sessions stop returning to it at once (within a minute). Sessions that were already made keep the address they were made with. A Villa-hosted site's stack is deleted by hand; its bucket is kept.
Tests
python -m pytest channel-kit/tests -q -p no:cacheprovider # the tool, against stand-ins for SSM and HTTP
node --test channel-kit/tests/thankyou.test.mjs # the page's decisions
The browser test of the checkout (functions/checkout/tests/e2e/checkout.e2e.mjs) serves this same thank-you page
as the channel and pays through to it.