Integrate Payment API Website 2026: Steps

By William Zhu & the InfiniSynapse Data Team · Published: 2026-06-24 · Last updated: 2026-10-01 · About: Editorial standards · About / team

Author credentials (payments-adjacent): William Zhu — InfiniSynapse cofounder; public engineering profile GitHub @allwefantasy. Desk contact: zhuhl@infinisynapse.com. This is a website integration guide for builders. It is not a PCI QSA attestation, a legal opinion, or a quote from a payment processor.

Business relationship disclosure: We build InfiniSynapse, an AI-native data agent. It is not a payment gateway. InfiniSynapse appears only as an optional backend you call after a paid entitlement already exists. Provider fees and PCI scope below are summarized from public docs.

Integrate Payment API Website: Steps


Table of Contents

  1. TL;DR
  2. What it means to integrate a payment API on a website in 2026
  3. Four ways to integrate payments on a website
  4. How to integrate a payment API into a website
  5. Payment API types a website actually calls
  6. What it costs to integrate a payment API in 2026
  7. Which payment API fits a website in 2026
  8. Sandbox, webhooks, and go-live checks
  9. FAQ
  10. Conclusion

TL;DR

Direct answer: To integrate payment api website 2026 checkout, your site creates a session on the server, lets the provider collect the card, and unlocks the order only after a signature-checked webhook. A success-page redirect is not proof of payment.

Threads on r/stripe, r/webdev, and r/SaaS still argue about plugins versus raw card fields. The setups that survived a first live charge shared one shape.

  • Hosted checkout when you want the provider's page to hold the card. That is the short path for a custom site.
  • A platform plugin when the site already runs on Shopify, WooCommerce, or a similar store admin. Do not rebuild checkout first.
  • A server route plus a webhook when you need subscriptions, trials, or an entitlement row in your own database.
  • Test success, decline, refund, and a replayed webhook before you swap in live keys.

Who this is for: a founder or developer putting payments on a website this year. What you'll learn: the four integration types, a seven-step setup, published cost bands, a provider fit table, and the webhook checks that keep a refresh from granting a second seat.

Card capture itself stays on the gateway rail in API integration for a payment gateway. Store catalog and order sync stay on eCommerce API integration.

What it means to integrate a payment API on a website in 2026

Key Definition: integrate payment api website 2026 means you connect the site to a payment provider with API calls so the site can start a payment, hear the result, and update the order. The provider authorizes and settles. Your server stores a payment id and an entitlement, not a card number.

The W3C Payment Request API only asks the browser for a stored instrument. The charge still goes through a provider API after that sheet returns.

The split that matters is where the card is typed. On a hosted page, the buyer pays on the provider's origin. On an on-site integration, provider JavaScript collects the card and your server sees a token or a session id. Logging the primary account number puts the site inside the card-data flow. Stripe's PCI guide describes that boundary for Checkout and provider-controlled fields. Confirm the form with whoever signs your PCI assessment.

Four ways to integrate payments on a website

Pick the type before you pick a logo. The type decides checkout control, build time, and whose server sees the card.

Hosted payment page

The site creates a session and redirects. The buyer enters the card on the provider's domain, and a webhook reports completion. Use this for a custom marketing site or a small SaaS pricing page. The buyer leaves your layout for one screen, and the card stays off your server.

API checkout on your domain

Provider components (Stripe Payment Element, Square Web Payments, a similar iframe) render inside your page. Leave the card fields to that component. This path fits a checkout you already designed.

Self-hosted card form

Your own inputs collect the number and security code, and your server posts them. That puts the site inside the card-data flow. Skip it unless a qualified security team already runs that program.

Mobile and wallet checkout

Phone browsers and native apps still need a server webhook. The difference is the screen and the instrument. Wallets such as Apple Pay and Google Pay ride the provider's API when that provider supports them. Test the flow on a phone before you add a native SDK. A mobile SDK is a second integration, with its own sandbox, and it does not replace the webhook.

How to integrate a payment API into a website

Follow this order when you integrate payment api website 2026 checkout. A Shopify, WooCommerce, or BigCommerce store starts with the platform plugin. A custom site has no plugin slot, so the server route is the whole job. When a plugin covers checkout and stops before subscription webhooks, move that half to a server route, the same boundary as custom API integration.

  1. Choose the provider for the site's methods and countries. The fit table is below. A US SaaS page and an EU store with local bank methods are different shortlists.
  2. Open the merchant account and finish identity checks before you announce the pricing page. Sandbox keys often work earlier than live charges are allowed.
  3. Keep secret keys on the server. Store the secret and the webhook signing secret in the host environment. The OWASP Secrets Management Cheat Sheet is the bar: separate test and live secrets, rotate on exposure, and keep them out of logs. Only the publishable key may ship to the browser.
  4. Add the plugin or one server route. On a hosted store, install the provider app. On a custom site, create the checkout session on the server and return its URL. The sample is in the go-live section.
  5. Point an HTTPS webhook at the site. Stripe's webhook signature docs show constructEvent on the raw body. Other providers use their own HMAC. A bad signature returns an error so the provider retries, and the handler does not grant access.
  6. Run the sandbox. Success, decline, refund, cancel, and a replayed event. The entitlement row must change when the webhook arrives, including when nobody opens the success URL.
  7. Switch to live keys only after the checklist later on this page is green. Repeat one low-amount live payment and watch that webhook in the dashboard.

Serve the site and the webhook over HTTPS. A weekend can finish steps 4–6. Step 7 waits on verification and the scorecard.

Payment API types a website actually calls

Providers split the surface into a few APIs. Call the one that matches the offer on the page. Do not start with payouts.

Transaction API

A one-time charge. Checkout mode: 'payment', or an Orders capture, takes a single amount and returns a payment id. Use it for a report, a license, or a single invoice. The PayPal Orders v2 API is this shape: create an order, approve it, capture it.

Subscription API

Recurring billing. Checkout mode: 'subscription' with a Price id, then events for created, paid, failed, and deleted. Stripe Billing documents trials, proration, and dunning on that object. Map each event to a row in your database. The first checkout is only the start.

Tokenization and 3-D Secure

Tokenization replaces the card number with an id the provider can charge again. 3-D Secure challenges the cardholder when the issuer asks. Both belong to the provider's checkout UI on a normal website. Pass the context the API requires. Do not build a challenge iframe unless the provider's docs say your flow has no hosted alternative.

Payout API

Payouts send money to sellers or contractors. A single-merchant site can skip them on day one. A marketplace treats payouts as a second project, with its own verification. Settlement and dispute exports are a reporting job on a schedule. They do not grant access.

What it costs to integrate a payment API in 2026

Budget two piles: the build, and the fee on every successful charge. Headline percentages hide the build.

Build bands below are for an integrate payment api website 2026 project. They come from public write-ups, not an InfiniSynapse price list:

PathWhat you are buyingPublished band
Provider-hosted plugin on an existing storeApp install, test, go-liveOften days of staff time; agency quotes for a basic plugin job commonly start in the low thousands
Simple custom checkout on your siteOne server route, one webhook, one entitlement columnStripe's payment API overview puts simple business integrations around $2,000
Custom subscriptions, tax, and failure handlingPortal, dunning, idempotency, logsThe same Stripe overview says more complex projects can exceed $30,000
Your own card-processing stackGateway, PCI audit, card-network setupA different project. Do not use the website-integration bands

Per-charge fees sit on top of the build. Stripe's pricing lists 2.9% + 30¢ per successful transaction for domestic cards. International cards, conversion, and disputes are extra lines on that page. Compare the whole schedule for your countries.

Stripe Tax is optional. Paddle and Lemon Squeezy fold tax into their fee and become the seller of record. After launch, budget a few hours a month for webhook failures and API upgrades.

Which payment API fits a website in 2026

Use integration scope, not a popularity ranking. Whether you integrate payment api website 2026 billing for a SaaS app, a store, or a marketplace changes which row fits.

ProviderFits this websiteCheckout controlTax / seller of record
StripeCustom sites and SaaS subscriptionsHosted Checkout or on-site ElementTax add-on; you stay the seller
PayPal / BraintreeBuyers who expect PayPal; split marketplace chargesPayPal button or Braintree Drop-inTax stays with you
AdyenMany countries on one contractHosted page or APIEnterprise acquiring
Checkout.comSites tuning acceptance ratesHosted or customTax stays with you
SquareOnline plus in-personWeb Payments SDKConfirm country support
Paddle or Lemon SqueezySolo SaaS that wants tax handledHosted checkoutMerchant of record

Start with one row. A second provider means two webhook shapes and two fee reports. Add it when a country or a method is blocked.

Sandbox, webhooks, and go-live checks

The unique part of a website integration is the server you own. The samples below are a minimal Next.js App Router path. Swap the SDK if you are not on Stripe. Keep the sequence: create on the server, verify the webhook, grant once.

Checkout session route

// app/api/checkout/route.ts
import Stripe from "stripe";
const stripe = new Stripe(process.env.STRIPE_SECRET_KEY!);

export async function POST(req: Request) {
  const { priceId, customerEmail } = await req.json();
  const session = await stripe.checkout.sessions.create({
    mode: "subscription",
    customer_email: customerEmail,
    line_items: [{ price: priceId, quantity: 1 }],
    success_url: `${process.env.APP_URL}/welcome?session_id={CHECKOUT_SESSION_ID}`,
    cancel_url: `${process.env.APP_URL}/pricing`,
  });
  return Response.json({ url: session.url });
}

For a one-time product, set mode to "payment". Never put STRIPE_SECRET_KEY in a client component.

Webhook handler

// app/api/webhooks/stripe/route.ts
import Stripe from "stripe";
const stripe = new Stripe(process.env.STRIPE_SECRET_KEY!);

export async function POST(req: Request) {
  const body = await req.text();
  const sig = req.headers.get("stripe-signature")!;
  const event = stripe.webhooks.constructEvent(body, sig, process.env.STRIPE_WEBHOOK_SECRET!);
  if (await alreadyProcessed(event.id)) return Response.json({ received: true });
  if (event.type === "checkout.session.completed") {
    await grantEntitlement(event.data.object);
  }
  await markProcessed(event.id);
  return Response.json({ received: true });
}

A second delivery of the same event.id must not create a second seat. A worked webhook skeleton with the same rule lives in API integration examples.

Entitlement map

EventDatabase action
checkout.session.completedInsert the row, status active
invoice.payment_failedStatus past_due, restrict the paid feature
customer.subscription.updatedSync the price id to the plan tier
customer.subscription.deletedStatus canceled, revoke keys

Gate routes on subscription.status === 'active' in server code. A localStorage flag is not an entitlement. Supabase row level security can enforce the same check on the table.

Cancel in the provider's portal. Stripe's customer portal covers plan changes and card updates.

Test checklist

A soft decline (insufficient funds, a temporary issuer timeout) can be retried. A hard decline (closed account, stolen card) should stop. When the provider's retries end, downgrade the entitlement and tell the buyer what to fix.

Run these against test keys:

  1. Complete checkout with the provider's test card. The entitlement row appears even if you never open the success URL.
  2. Force a failed renewal. Access drops when the failed-payment event lands.
  3. Cancel in the customer portal. The deleted event revokes the feature.
  4. Replay the same webhook. The idempotency store blocks a second grant.
  5. Search the client bundle for secret key prefixes. None should be there.

Stripe test clocks move a subscription forward so you can see renewal and failure without waiting a month.

Readiness scorecard

Give one point for each pass.

CheckPass?
Checkout is created only on the server
Webhook signature is verified
Idempotency is keyed by event id
Entitlements change only from webhooks
Test and live keys are separated
A cancel path exists
A failed payment restricts access
Logs include event type, customer id, and latency

7–8: live charges are reasonable. 5–6: stay in test. Below 5: fix the webhook path before you market a launch.

Worked example: first paid seat

A small analytics site had a one-time $49 payment link and needed $19 per month with a 7-day trial. The change was a subscription Checkout Session, a subscriptions table, and a webhook that stored event.id. The plugin was removed so it could not write a second row.

After ten days: the first live renewal landed on day 4, twelve replayed events created zero duplicate rows, and the handler's 95th percentile was about 120ms. Two tickets were trial-copy questions.

The payment API unlocks the product. After the entitlement is active, a proxy can send a long job to the InfiniSynapse web app or to your own queue. Check the subscription row before you spend compute. The wider launch list is the production readiness checklist.

Frequently Asked Questions

How do you integrate a payment API into a website?

Open a merchant account, keep the secret key on the server, and either install the provider's plugin or add a route that creates a checkout session. Register a webhook, test success and failure in the sandbox, then switch to live keys. Grant the order from the webhook, not from the browser's return URL.

What is the difference between a hosted page and an API integration?

A hosted page collects the card on the provider's domain, which is the usual way to stay out of the card-data flow. An API integration keeps the buyer on your site and uses the provider's fields or tokens. If your server receives the raw card number, expect the long PCI assessment, not the short one. Hosted checkout detail is on API integration for a payment gateway.

Which PCI form applies when you integrate payments on a website?

Teams aim for the short self-assessment when a hosted page handles the card and the site only stores a session id. A server that receives the card number falls into the full merchant assessment. Provider-hosted fields sit between those poles. Confirm the form with a qualified security assessor before you rely on it.

What does it cost to integrate a payment API in 2026?

Stripe's own overview puts a simple integration around $2,000 and a complex one above $30,000. Those are build ranges, not processor fees. Stripe's published domestic card rate is 2.9% + 30¢ per successful charge, plus extra for international cards and disputes. Plugin installs on an existing store can be cheaper than a custom subscription stack.

How should a website handle a failed payment?

Read the decline code. Retry soft declines. Stop on hard declines. When the provider's retries end, set the entitlement to past due so the paid feature turns off. Tell the buyer what to fix. A generic "payment failed" page with the feature still unlocked is the bug.

Conclusion

integrate payment api website 2026 means a server-created checkout, a verified webhook, and an entitlement row. Hosted pages and store plugins are the fast paths. On-site components are for teams that need the buyer to stay on the domain. Raw card fields are a compliance project, not a styling choice.

Do the seven steps in order: provider, account, server-side keys, plugin or route, webhook, sandbox, live. Then add the customer portal and only later a payout API.

The cluster map for the rest of the integration work is API integration services.

Integrate Payment API Website 2026: Steps