Create prepaid checkout
/events/:eventId/tickets/:ticketId/prepaid-checkoutCreate a Stripe Checkout session after storing the survey answers up front. Inventory is held for a limited time and released if payment is not completed.
| Auth | Login required |
|---|
Path parameters
eventIdstringrequiredEvent ID or slug.
ticketIdstringrequiredTicket type ID; required for events that have ticket types.
Request body
Array of survey answers; each element has questionId (required) and answer (a non-empty array of strings, each up to 1000 characters). All required questions must be answered.
Profile fields collected at registration; keys correspond to the event's entryProfileFields setting.
invitationCodestringoptionalInvitation code; exactly 8 characters. Required for invitation-only tickets.
faceImageUrlstringoptionalFace photo URL; must be a valid URL. Required for events with requiresFacePhoto enabled.
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; send the user there to pay. |
sessionId | string | Stripe Checkout session ID. |
curl https://api.4s.link/events/EVENT_ID/tickets/TICKET_ID/prepaid-checkout \-X POST \-H "Authorization: Bearer 4s_at_..." \-H "Content-Type: application/json" \-d '{"questionAnswers": [{ "questionId": "q1a2b3c4-...", "answer": "情報収集のため" }],"successUrl": "https://example.com/tickets/complete","cancelUrl": "https://example.com/tickets/canceled"}'
{"url": "https://checkout.stripe.com/c/pay/cs_test_...","sessionId": "cs_test_..."}