{"templateId":"markdown","sharedDataIds":{"sidebar":"sidebar-guides/sidebars.yaml"},"props":{"metadata":{"markdoc":{"tagList":["admonition","cards","card"]},"type":"markdown"},"seo":{"title":"Hosted checkout","description":"Shift4 Payment Platform REST API."},"dynamicMarkdocComponents":[],"compilationErrors":[],"ast":{"$$mdtype":"Tag","name":"article","attributes":{},"children":[{"$$mdtype":"Tag","name":"Heading","attributes":{"level":1,"id":"hosted-checkout","__idx":0},"children":["Hosted checkout"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["If you don't want to embed anything on your own page, hand the payment step off to Shift4: redirect the customer to the Checkout Session's hosted ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["url"]},". This needs no client-side code — no script, no public key. Shift4 renders and hosts the payment experience; you create the Checkout Session and decide when to send the customer to it."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"set-the-return-url","__idx":1},"children":["Set the return URL"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Set ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["redirectUrl"]}," when you ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/guides/core-concepts/checkout/create-a-checkout-session"},"children":["create the Checkout Session"]}," to send the customer to a specific page after payment — useful when different flows need different landing pages."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["If you omit it, Shift4 uses the account-wide return URL from ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Settings → Payment Links"]}," in the ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/guides/core-concepts/payment-links/guides/customise-and-configure/#post-payment-behaviour"},"children":["Customer Hub"]},". If most of your payments should land on the same page, set it once there and leave ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["redirectUrl"]}," out of your requests."]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"json","header":{"controls":{"copy":{}}},"source":"{\n  \"checkoutSession\": {\n    \"lineItems\": [ /* … */ ],\n    \"redirectUrl\": \"https://yourapp.example.com/after-payment\"\n  }\n}\n","lang":"json"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"redirect-the-customer","__idx":2},"children":["Redirect the customer"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Redirect the customer's browser to the response's ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["checkoutSession.url"]}," (",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["https://pay.shift4.com/chse_…"]},"). They enter payment details on ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["pay.shift4.com"]},", and after payment Shift4 redirects them back to your ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["redirectUrl"]}," with two query parameters appended:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"header":{"controls":{"copy":{}}},"source":"https://yourapp.example.com/after-payment?status=success&checkout_session_id=chse_wMCUGVZgpf45fWHzKbYWMKmZ\n"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Read ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["checkout_session_id"]}," to identify which Checkout Session completed, then confirm it server-side."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"apple-pay--google-pay","__idx":3},"children":["Apple Pay & Google Pay"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["There is nothing to build. The Shift4-hosted page renders the Apple Pay and Google Pay buttons for you, on devices and browsers that support them. The only thing to do is turn the wallets on for your hosted checkout:"]},{"$$mdtype":"Tag","name":"ol","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Open ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Settings → Payment Links"]}," in the ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://lh.shift4.com/internet-payments/payment-links/settings"},"children":["Customer Hub"]},"."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Under ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Options"]},", turn on ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Allow Payments With Digital Wallets"]},"."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Select the ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Apple Pay"]}," and ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Google Pay"]}," checkboxes as needed."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Click ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Save"]},"."]}]},{"$$mdtype":"Tag","name":"Admonition","attributes":{"type":"info"},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The screen is currently labelled ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Payment Links"]},", but the setting covers your whole Shift4-hosted checkout — both your payment links and Hosted checkout. It does ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["not"]}," affect ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/guides/core-concepts/checkout/payment-components"},"children":["Payment components"]},", where the wallet buttons are rendered by your own page."]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"if-the-buttons-dont-appear","__idx":4},"children":["If the buttons don't appear"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The buttons only render if your business is eligible to accept the wallet. Apple and Google each restrict certain business categories — if your merchant category code (MCC) falls under the ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://developer.apple.com/apple-pay/acceptable-use-guidelines-for-websites/"},"children":["Apple Pay Acceptable Use Guidelines"]}," or the ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://payments.developers.google.com/terms/aup"},"children":["Google Pay Acceptable Use Policy"]},", that wallet is suppressed and no button is shown. If your business is permitted under both policies and the buttons are still missing, contact Shift4 support."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"confirm-before-you-fulfil","__idx":5},"children":["Confirm before you fulfil"]},{"$$mdtype":"Tag","name":"Admonition","attributes":{"type":"warning"},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["status=success"]}," redirect parameter is a ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["convenience signal"]},", not proof of payment — the customer may never return to your site, or the parameter may be tampered with. Retrieve the Checkout Session server-side and check ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["status: \"paid\""]}," before fulfilling. See ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/guides/core-concepts/checkout/confirm-payment"},"children":["Confirm the payment"]},"."]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"next-steps","__idx":6},"children":["Next steps"]},{"$$mdtype":"Tag","name":"Cards","attributes":{"columns":3,"cardMinWidth":240},"children":[{"$$mdtype":"Tag","name":"Card","attributes":{"title":"Confirm the payment","imagePosition":"start","iconPosition":"auto","layout":"vertical","align":"start","variant":"filled","to":"/guides/core-concepts/checkout/confirm-payment"},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Retrieve the Checkout Session server-side and verify ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["status: \"paid\""]}," before fulfilling."]}]},{"$$mdtype":"Tag","name":"Card","attributes":{"title":"Test cards","imagePosition":"start","iconPosition":"auto","layout":"vertical","align":"start","variant":"filled","to":"/guides/core-concepts/checkout/testing"},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Sandbox card numbers for success, failure, and 3D Secure scenarios."]}]},{"$$mdtype":"Tag","name":"Card","attributes":{"title":"Payment components","imagePosition":"start","iconPosition":"auto","layout":"vertical","align":"start","variant":"filled","to":"/guides/core-concepts/checkout/payment-components/"},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Prefer the form on your own page? Embed card fields and wallet buttons instead."]}]}]}]},"headings":[{"value":"Hosted checkout","id":"hosted-checkout","depth":1},{"value":"Set the return URL","id":"set-the-return-url","depth":2},{"value":"Redirect the customer","id":"redirect-the-customer","depth":2},{"value":"Apple Pay & Google Pay","id":"apple-pay--google-pay","depth":2},{"value":"If the buttons don't appear","id":"if-the-buttons-dont-appear","depth":3},{"value":"Confirm before you fulfil","id":"confirm-before-you-fulfil","depth":2},{"value":"Next steps","id":"next-steps","depth":2}],"frontmatter":{"title":"Hosted checkout","description":"Take payment with no client-side code — redirect the customer to the Checkout Session's hosted url on pay.shift4.com and Shift4 returns them to your redirectUrl.","markdown":{"lastUpdatedBlock":{"hide":true}},"seo":{"title":"Hosted checkout"}},"lastModified":"2026-10-08T08:30:07.000Z","pagePropGetterError":{"message":"","name":""}},"slug":"/guides/core-concepts/checkout/hosted-checkout","userData":{"isAuthenticated":false,"teams":["anonymous"]},"isPublic":true}