> ## Documentation Index
> Fetch the complete documentation index at: https://developers.redo.com/llms.txt
> Use this file to discover all available pages before exploring further.

# hsaCheckoutCreate

> Create an HSA/FSA checkout for an order on the store's own platform, and return it. Send the shopper to its `paymentUrl`, then read `payment` to learn whether they paid. A known `reference` with the same details returns its saved checkout without creating another. A store without HSA/FSA payments set up fails with PAYMENTS_NOT_ENABLED (403). A create that the payments provider is still working on, or can't be reached for, fails with PAYMENTS_PROVIDER_UNAVAILABLE (503); retry it. A known `reference` with other details fails with HSA_CHECKOUT_REFERENCE_CONFLICT (409). A known `reference` whose checkout is closed without payment (expired or voided) fails with HSA_CHECKOUT_CLOSED (409): the checkout stays tied to its reference, so send a new one, for example the order number with a suffix.

**Required scopes:** [`payments_write`](https://developers.redo.com/docs/api-reference/v3/reference/scopes#scope-payments_write)

**Store must have one of:** `HSA`

## Arguments

**input** `[HsaCheckoutCreateInput!](/docs/api-reference/v3/reference/payments/hsa-checkout-create-input)` *required*

The order.

**fields**

**billingAddress** `[HsaCheckoutAddressInput](/docs/api-reference/v3/reference/payments/hsa-checkout-address-input)`

The shopper's billing address. Left out, it is the shipping address.

**fields**

**city** `String!` *required*

City.

**countryCode** `[CountryCode!](/docs/api-reference/v3/reference/common/country-code)` *required*

Country.

**line1** `String!` *required*

Street address.

**line2** `String`

Apartment, suite or unit. Left out or blank for none.

**postalCode** `String!` *required*

Postal code.

**province** `String!` *required*

State or province code (e.g. "CA").

**customer** `[HsaCheckoutCustomerInput!](/docs/api-reference/v3/reference/payments/hsa-checkout-customer-input)` *required*

The shopper.

**fields**

**email** `String!` *required*

Email address.

**firstName** `String!` *required*

First name.

**lastName** `String!` *required*

Last name.

**phone** `String!` *required*

Phone number.

**discountAmount** `[MoneyInput!](/docs/api-reference/v3/reference/common/money-input)` *required*

Taken off the lines' total. Zero for none.

**fields**

**amount** `[Decimal!](/docs/api-reference/v3/reference/common/decimal)` *required*

The amount as an exact decimal string (e.g. "19.99").

**currency** `String!` *required*

ISO 4217 currency code (e.g. USD).

**lines** `[\[HsaCheckoutLineInput!\]!](/docs/api-reference/v3/reference/payments/hsa-checkout-line-input)` *required*

The order's lines. At least one.

**fields**

**name** `String!` *required*

The name the shopper sees.

**productId** `String!` *required*

The store's id for the product, the one its HSA/FSA eligibility was decided for.

**quantity** `Int!` *required*

At least 1.

**unitPrice** `[MoneyInput!](/docs/api-reference/v3/reference/common/money-input)` *required*

The price of one unit, before the order's discount.

**reference** `String!` *required*

The store's order reference, at most 50 characters. A checkout stays tied to its reference: a create with a known reference and the same details returns the saved checkout and changes nothing; with other details it fails with HSA\_CHECKOUT\_REFERENCE\_CONFLICT (409). Once that checkout is closed without payment (expired or voided), a create for its reference fails with HSA\_CHECKOUT\_CLOSED (409); send a new reference, for example the order number with a suffix.

**returnUrl** `String!` *required*

An https URL on the store for a shopper who leaves without paying.

**shippingAddress** `[HsaCheckoutAddressInput!](/docs/api-reference/v3/reference/payments/hsa-checkout-address-input)` *required*

Where the order ships.

**fields**

**city** `String!` *required*

City.

**countryCode** `[CountryCode!](/docs/api-reference/v3/reference/common/country-code)` *required*

Country.

**line1** `String!` *required*

Street address.

**line2** `String`

Apartment, suite or unit. Left out or blank for none.

**postalCode** `String!` *required*

Postal code.

**province** `String!` *required*

State or province code (e.g. "CA").

**shippingAmount** `[MoneyInput!](/docs/api-reference/v3/reference/common/money-input)` *required*

Shipping charged on the order.

**fields**

**amount** `[Decimal!](/docs/api-reference/v3/reference/common/decimal)` *required*

The amount as an exact decimal string (e.g. "19.99").

**currency** `String!` *required*

ISO 4217 currency code (e.g. USD).

**successUrl** `String!` *required*

An https URL on the store for a shopper who paid.

**taxAmount** `[MoneyInput!](/docs/api-reference/v3/reference/common/money-input)` *required*

Tax charged on the order.

**fields**

**amount** `[Decimal!](/docs/api-reference/v3/reference/common/decimal)` *required*

The amount as an exact decimal string (e.g. "19.99").

**currency** `String!` *required*

ISO 4217 currency code (e.g. USD).

## Returns

**hsaCheckoutCreate** `[HsaCheckout!](/docs/api-reference/v3/reference/payments/hsa-checkout)` *required*

An HSA/FSA checkout the store created for an order on its own platform. The shopper pays it on Redo's hosted checkout.

**fields**

**createdAt** `[DateTime!](/docs/api-reference/v3/reference/common/date-time)` *required*

When the checkout was created.

**id** `ID!` *required*

The id of the checkout.

**payment** `[HsaCheckoutPayment](/docs/api-reference/v3/reference/payments/hsa-checkout-payment)`

The checkout's payment, read live from the payments provider. Null when the provider has no record of it. An unreachable provider fails with PAYMENTS\_PROVIDER\_UNAVAILABLE (503).

**Requires:** [`payments_read`](https://developers.redo.com/docs/api-reference/v3/reference/scopes#scope-payments_read)

**fields**

**balanceDue** `Boolean!` *required*

Whether the HSA/FSA card covered only part of the total and a second card must pay the rest. While true, the checkout is not fully paid.

**state** `[HsaCheckoutPaymentState!](/docs/api-reference/v3/reference/payments/hsa-checkout-payment-state)` *required*

Where the payment is.

**paymentUrl** `String!` *required*

Where to send the shopper to pay. Use it as given: it may be Redo's checkout or the payments provider's page.

**reference** `String!` *required*

The store's order reference the checkout was created for, such as an order number.

## Example

```graphql theme={null}
mutation {
  hsaCheckoutCreate(input: { ... }) {
    createdAt
    id
    paymentUrl
    reference
  }
}
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.