feat: hosted checkout URL, redirect_url, and OpenAPI docs for payment links - #204
Merged
Merged
Conversation
… links
A developer had no way to actually integrate payment links into their
own checkout: create-link responses only returned a bare slug (the
/pay/{slug} URL convention existed only as client-side JS in the
dashboard), there was no way to redirect a payer back to the
merchant's site after paying, and docs/openapi.yaml had zero entries
for any payment-link route.
- migration 0017: nullable redirect_url column on payment_links.
- PaymentLinkView / PublicPaymentLinkView gain url (the full hosted
checkout URL, built server-side from a new PUBLIC_APP_URL config,
defaulted to localhost:3000 like HORIZON_URL) and redirect_url
(bare passthrough, same treatment as image_url -- it's merchant-set
via their own API key and only ever used for a browser redirect,
never fetched server-side, so no SSRF surface).
- docs/openapi.yaml: added all 8 payment-link routes (owner-authenticated
create/list/get/activate/payments, and the public /v1/pay/:slug/*
checkout flow) with matching response schemas, mirroring the actual
Rust response shapes field-for-field.
No SDK -- this is a server-to-server integration (create a link, get
a URL, redirect, get webhooked), not client-side signing.
Confirms url is a real hosted checkout link (ends in /pay/<slug>) and redirect_url round-trips through create, owner-authenticated get, and the public /v1/pay/:slug route.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
A developer had no way to actually integrate payment links into their own checkout: create-link responses only returned a bare
slug(the/pay/{slug}URL convention existed only as client-side JS in the dashboard frontend), there was no way to redirect a payer back to the merchant's site after paying, anddocs/openapi.yamlhad zero entries for any payment-link route.0017: nullableredirect_urlcolumn onpayment_links.PaymentLinkView/PublicPaymentLinkViewgainurl(the full hosted checkout URL, built server-side from a newPUBLIC_APP_URLconfig var, defaulted tohttp://localhost:3000the same wayHORIZON_URLdefaults) andredirect_url(bare passthrough, same treatment asimage_url— it's merchant-set via their own API key and only ever used for a browser redirect, never fetched server-side, so no SSRF surface).docs/openapi.yaml: added all 8 payment-link routes (owner-authenticated create/list/get/activate/payments, and the public/v1/pay/:slug/*checkout flow) with matching response schemas, mirroring the actual Rust response shapes field-for-field.payment_link_response_includes_checkout_url_and_redirect_url— confirmsurlis a real hosted checkout link andredirect_urlround-trips through create, owner-authenticated get, and the public route.No SDK — this is a server-to-server integration (create a link, get a URL, redirect, get webhooked via the existing
payment_link.paidevent), not client-side signing. Reference: Blockradar's checkout docs use the same shape and ship no SDK either.Companion frontend PR wires the returned
url/redirect_urlinto the dashboard and the hosted/pay/[slug]checkout page, plus a new/docs/checkoutpage.Test plan
cargo test --workspace --locked— 37/37 greencargo clippy --workspace --all-targets --locked -- -D warnings— cleancargo fmt --all -- --check— cleanredirect_url, confirmed the response'surlfield is a working link andredirect_urlround-trips through create/get/public routes