Create a payment link
/events/:eventId/tickets/:ticketId/payment-linkCreate a Stripe payment link for a paid ticket. Send the user to the returned url; the registration is confirmed via webhook once payment completes. Use successUrl / cancelUrl to bring the user back to your own site after payment.
| Auth | Login required |
|---|
Path parameters
eventIdstringrequiredEvent ID or slug.
ticketIdstringrequiredTicket type ID; required for events that have ticket types.
Request body
quantitynumberoptionalNumber of tickets (default 1). Must be 1 when eventEntryId is given.
invitationCodestringoptionalReferral code; exactly 8 characters. Any discount is applied to the amount.
eventEntryIdstringoptionalFor the pay-after-approval flow: the ID of your own registration in the AWAITING_PAYMENT state.
successUrlstringoptionalURL to redirect to after a completed payment. If omitted, the user returns to the 4S ticket purchase completion page. Must be an absolute https URL (http only for local development), without a fragment (#...), at most 2048 characters, and on the same origin as one of your OAuth client's registered redirect URIs.
cancelUrlstringoptionalURL to redirect to when the user cancels the payment. If omitted, the user stays on the Stripe Checkout page. The same format and origin rules as successUrl apply.
Notes
When redirecting, the Stripe Checkout session ID is appended to successUrl as a session_id query parameter (for example ?session_id=cs_test_...). Query parameters already present in your URL are preserved, and session_id is not appended if your URL already contains one.
No query parameters are appended to cancelUrl; the user returns to exactly the URL you supplied. If you need to tell which purchase was canceled, include your own query parameter (for example ?orderId=...) in the URL you pass.
Reaching successUrl does not guarantee that the payment completed. Registrations are confirmed by Stripe's webhook, so match the returned session_id against the sessionId from the response and verify the registration state through the API.
A successUrl / cancelUrl that is not a valid URL, or whose origin does not match a registered redirect URI, returns 400 (errorCode 10020 and 60002 respectively).
Response
| Field | Type | Description |
|---|---|---|
url | string | Stripe Checkout URL. |
sessionId | string | Stripe Checkout session ID. |
curl https://api.4s.link/events/EVENT_ID/tickets/TICKET_ID/payment-link \-X POST \-H "Authorization: Bearer 4s_at_..." \-H "Content-Type: application/json" \-d '{"quantity": 1,"successUrl": "https://example.com/tickets/complete","cancelUrl": "https://example.com/tickets/canceled"}'
{"url": "https://checkout.stripe.com/c/pay/cs_test_...","sessionId": "cs_test_..."}