GoDaddy

About online payments

View as Markdown

How Unified Checkout takes card payments on your website, what your server is responsible for, and how you learn the result of a payment.

Overview

Unified Checkout takes card payments from your customers on your website. Your server creates a checkout session, then the shopper pays through a checkout interface that GoDaddy provides.

This page covers how Unified Checkout works, what happens during a payment, and how you learn the result.

Compare checkout forms

Unified Checkout comes in two forms, embedded and hosted. Both create the session the same way, so the choice affects only where the shopper pays and how much of the interface your business owns.

The following table describes what differs between them.

EmbeddedHosted
Where the shopper paysInside your own websiteOn a page GoDaddy hosts
How checkout rendersA React component in your pageYour page redirects to the session url
Stack requirementReact 18 or 19Any stack that can redirect
Interface your business maintainsThe page around checkoutNone
Shopper leaves your siteNoYes

Everything else is shared. Both forms use the same server-side session create, the same session fields, the same card iframe on GoDaddy's origin, and the same return to your successUrl.

Start with hosted checkout unless the shopper has to stay on your site. Moving to embedded checkout later doesn't change the server call.

Go to How to create a checkout session for the server call both forms share.

What your server does

Your server holds the Personal Access Token (PAT) that creates a checkout session. It decides the order, names the store the payment belongs to, and supplies the URLs the shopper returns to.

Creating the session is the only privileged step you own. The session comes back as an object your server passes to the page. Your PAT stays on the server. The session carries a token of its own, and that's what the checkout interface authenticates with.

You call createCheckoutSession from @godaddy/react/server in your own server process, and it calls GoDaddy with the token you pass it. The package runs on your infrastructure: it isn't a hosted service tier, and it isn't a gateway you must route through.

Register the checkout domain before you offer Apple Pay. Go to How to set up Apple Pay for domain registration.

What happens after the session exists

The checkout interface authenticates with the session itself, so the browser never needs your PAT. Card details are entered in an iframe that GoDaddy hosts, which keeps card data out of your systems. GoDaddy Payments then charges the card on behalf of your business.

Session create is the only GoDaddy call your own code makes during checkout. After the session exists, the rest runs on GoDaddy infrastructure.

The following diagram shows one online payment from session create through to the shopper returning to your site.

Rendering diagram...

The checkout interface is a React component inside your own page for embedded checkout, and a page GoDaddy serves for hosted checkout. The steps are the same either way.

Only step one uses your PAT. The session authorizes every later call, which is why the browser never needs your PAT. Checkout performs the token exchange in step four on its own: there's no API for you to call there.

When you learn the result

The shopper's browser tells you first:

  • After a successful payment, the shopper goes to your successUrl.
  • After a cancel, the shopper goes to your returnUrl.
  • A declined or failed payment stays on the checkout form, where the shopper might retry.

A checkout session sends no callback to your server when a payment completes, and the shopper might never reach successUrl. Treat the order as pending, and confirm the payment in the transaction record before you fulfill it.

GET /v2/commerce/stores/{storeId}/transactions lists the store's transactions. The matching transaction has a references entry whose value is the session's draftOrder.id. The list doesn't filter by reference, so pass updatedAtAfter to narrow it, then match the reference.

Go to How to view transactions for the list call and its filters.

What the session controls

Beyond the order and return URLs, the session decides what the checkout form collects from the shopper and what it offers them.

The following table summarizes the types of options, what they control, and whether they need store setup:

TypeOptionsNeeds store setup?
CollectPhone number, notes, shipping address, billing addressNo
OfferShipping rates, taxYes (go to How to configure checkout for what each needs)
OfferPickup, promotions, tipsNo

This matters for how you build. Start with collect options to get a working payment end to end, then add offer options as the store becomes ready.

Go to How to configure checkout for the full list and what each offer option needs from the store.

Go to How to use hosted checkout or How to render embedded checkout for the implementation steps.

Last updated on

How is this guide?

On this page