Skip to content

Migrating from Square

You have an app on Square's APIs and want it running on Flint. Most of the server-side work is a mapping exercise: Flint has customers, catalog products, orders, payment links, subscriptions, invoices, refunds, gift cards, and webhooks, and it uses the same money shape Square does. Four parts need real work:

  • The card form. Flint processes cards through Stripe, so the browser collects them with Stripe Elements instead of Square's Web Payments SDK.
  • Cards on file. A Square card ID (ccof:...) can be charged only through Square. Each customer enters their card again in Flint before you can charge it while they're away.
  • Subscribers. Import each one's current period so Flint charges nothing until the renewal Square would have made.
  • Gift card balances. Import each balance as a Flint gift card and deactivate the Square card, so the value can't be spent twice.

You can move one flow at a time. A common order is new checkouts first, then saved cards, then subscribers and gift cards, then webhooks and the Square shutdown. The cutover checklist lists every step.

If you're still weighing the switch, Flint vs Square compares Square's per-location plans and Orders API fee with what a Flint account includes.

What changes in every request#

SquareFlint
Base URLconnect.squareup.com, or connect.squareupsandbox.com for the sandboxhttps://api.withflintpay.com for both. A test key (flint_test_...) runs in a sandbox, and a live key moves real money.
AuthenticationAuthorization: Bearer with an access tokenAuthorization: Bearer with an API key that has the permissions each call needs
API versionSquare-Version headerOptional Flint-Version header. Without it, your merchant default applies. See API versions.
Idempotencyidempotency_key in the bodyIdempotency-Key header, required on routes that can create a money or stock movement.
Money{"amount": 2500, "currency": "USD"}The same shape: an integer in the currency's minor unit and a currency code
QuantitiesStrings, such as "2"Integers, such as 2
Locationslocation_id on orders, subscriptions, and other callsPayments take no location. Locations are for inventory and fulfillment.
Your own IDsreference_idexternal_reference_id, which list endpoints filter by
Phone numbersSeveral formats acceptedE.164 only, such as +14155551234

Store each Square ID in external_reference_id on the Flint object you create from it. Customers, products, orders, subscription plans, subscriptions, invoices, and gift cards accept it, and their list endpoints filter by it, so an import that stops halfway can look up what it already created before it creates again.

Square calls and their Flint equivalents#

Square to Flint
CustomerSquareCreateCustomerFlintPOST /v1/customers
CatalogSquareITEM and ITEM_VARIATION objectsFlintProducts and their variants, POST /v1/products
OrderSquareCreateOrderFlintPOST /v1/orders
Pay an orderSquareCreatePayment with order_id, then PayOrder for several paymentsFlintPOST /v1/orders/{order_id}/pay, or confirm the order's payment intent with POST /v1/payment-intents/{payment_intent_id}/confirm. Several payment methods or gift cards: pay
Payment with no orderSquareCreatePaymentFlintPOST /v1/payment-intents
Authorize now, capture laterSquareautocomplete: false, then CompletePaymentFlintManual capture
Card formSquareWeb Payments SDK, card.tokenize()FlintStripe Elements, stripe.createConfirmationToken()
Card on fileSquareCreateCardFlintPOST /v1/payment-methods, then stripe.confirmSetup()
Hosted payment pageSquareCreatePaymentLinkFlintPOST /v1/payment-links for a shared link, POST /v1/checkout-sessions for one buyer
Subscription planSquarePlan and plan variationFlintPOST /v1/subscription-plans
SubscriptionSquareCreateSubscriptionFlintPOST /v1/subscriptions
InvoiceSquareCreateInvoice, then PublishInvoiceFlintPOST /v1/invoices, then POST /v1/invoices/{invoice_id}/issue, or both in one call
RefundSquareRefundPayment with payment_idFlintPOST /v1/refunds with order_id or payment_intent_id
Gift cardSquareCreateGiftCard and gift card activitiesFlintPOST /v1/gift-cards
WebhooksSquareWebhook subscriptionFlintPOST /v1/webhook-endpoints

Move orders along with payments. If you keep Square's Orders API and charge cards through another processor, Square adds a 1% fee to each of those payments, and your code has to keep two systems in step. Square Orders API with Stripe works through the cost. The table below maps Square's catalog objects to Flint's, and the catalog guide shows how to create each one.

Square catalog objects and their Flint equivalents#

SquareFlintNotes
ITEMProduct, POST /v1/productsA product has no price or SKU of its own
ITEM_VARIATIONVariant, POST /v1/products/{product_id}/variantsCarries the price and SKU. An order line names a variant_id, never a product
CATEGORYCategory, POST /v1/categoriesA product joins categories by their handles with category_handles
MODIFIER_LIST and its MODIFIER objectsModifier group and its modifiers, POST /v1/modifier-groupsA modifier set attaches groups to a product, variant, or bundle
LOCATIONLocation, POST /v1/locationsStock is kept per location
Inventory countsInventory item, linked from the variant, and an inventory level at each locationA variant with no inventory item sells without a stock check

Send each Square catalog object ID as external_reference_id on the product, location, or inventory item you create from it. Products, categories, locations, and inventory items accept the field.

Import customers#

Create one Flint customer per Square customer profile, with the Square ID in external_reference_id:

cURL
curl -X POST https://api.withflintpay.com/v1/customers \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Idempotency-Key: import-customer-JDKYHBWT1D4F8MFH63DBMEN8Y4" \
  -d '{
    "name": "Ada Lovelace",
    "email": "ada@example.com",
    "phone": "+14155551234",
    "external_reference_id": "JDKYHBWT1D4F8MFH63DBMEN8Y4"
  }'
Response
{
  "data": {
    "customer_id": "cus_1kmn0aExample",
    "status": "active",
    "name": "Ada Lovelace",
    "email": "ada@example.com",
    "phone": "+14155551234",
    "external_reference_id": "JDKYHBWT1D4F8MFH63DBMEN8Y4",
    "default_payment_method_id": null,
    "version": 1
  }
}

Two Square habits fail here:

  • Shared emails. Square lets several profiles share one email. In Flint an email belongs to one customer in the environment, compared without case, and a second customer with the same email returns 409 ALREADY_EXISTS with the existing customer in details[0].current_resource. Decide per pair: merge them by sending "on_email_conflict": "return_existing", which returns the existing customer unchanged, and record both Square IDs in your own mapping; or create the second profile without an email.
  • Phone formats. Flint accepts only E.164 numbers. Normalize each Square number first, or leave phone out, because anything else returns 400 INVALID_REQUEST naming phone.

Before creating, check for an earlier run with GET /v1/customers?external_reference_id=JDKYHBWT1D4F8MFH63DBMEN8Y4. The customers reference covers the remaining fields.

Guest orders that were unlinked before the import stay unlinked. When a returning buyer checks out as a guest and types an imported customer's email, that order also stays unlinked (customer_id: null) and doesn't appear in the customer's order history. To attach earlier guest purchases, have the buyer verify that email with a Flint code, then call link-guest-purchases.

For future purchases, set customer_id on the order before checkout for a signed-in buyer, or let a guest verify their email in checkout where that option is available. After cutover, share your Flint customer account link so buyers can see the purchases linked to them.

Move hosted checkout#

Square's CreatePaymentLink covers two Flint objects. Choose by how many buyers pay through one URL:

Your Square codeUse in Flint
Creates a link per buyer, cart, or order, often with quick_pay or orderA checkout session. It collects one order and closes once paid.
Creates one link and shares it with many buyersA payment link. Every buyer who opens it gets their own order.
Sets checkout_options.subscription_plan_idA checkout session with type: "subscription_plan", or a payment link with subscription_plan_id

Square's quick_pay maps to a checkout session of type: "quick_pay". Flint creates a one-line order for the amount, so refunds and reports work from the order as they do for any other sale:

cURL
curl -X POST https://api.withflintpay.com/v1/checkout-sessions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Idempotency-Key: checkout-consult-1042" \
  -d '{
    "type": "quick_pay",
    "quick_pay_item": {
      "name": "Design consultation",
      "amount_money": {"amount": 9900, "currency": "USD"}
    },
    "external_reference_id": "consult-1042",
    "redirects": {"success_url": "https://example.com/thanks"}
  }'
Response
{
  "data": {
    "checkout_session_id": "cs_1kmn0aExample",
    "type": "quick_pay",
    "status": "open",
    "surface": "hosted",
    "order_id": "ord_1kmn0aExample",
    "expires_at": "2026-07-04T17:04:05Z",
    "url": "https://checkout.withflintpay.com/checkout/cs_1kmn0aExample#checkout_token=cklt_v1..."
  }
}

Send the buyer to url exactly as returned. For a Square link built from an order, create the Flint order first and send "type": "order" with its order_id.

A shared link that sells a fixed-price item:

cURL
curl -X POST https://api.withflintpay.com/v1/payment-links \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Idempotency-Key: payment-link-consulting-001" \
  -d '{
    "name": "Consulting session",
    "line_items": [{
      "type": "custom_fixed",
      "key": "consulting",
      "name": "One-hour consulting session",
      "quantity": 1,
      "unit_price_money": {"amount": 15000, "currency": "USD"}
    }],
    "buyer_fields": {"require_email": true},
    "redirects": {"success_url": "https://example.com/thanks"}
  }'

The response carries the link's url and payment_link_id. Fulfill from the order.paid webhook, not from the redirect, and check the order's dispute_status first (access rules).

Replace the Web Payments SDK#

A Square embedded checkout tokenizes the card with card.tokenize() and charges the token with CreatePayment. In Flint, the order says how to collect, the browser creates a single-use credential with Stripe.js, and your backend pays the order with it:

An embedded card payment on FlintResponse
BrowserYour backendFlintPOST /v1/ordersGET /v1/orders/{order_id}payment_collectionpayment_collectionStripe Elements creates a pm_... credentialthe credentialPOST /v1/orders/{order_id}/payorder and payment attempt
  1. Your backend sends POST /v1/orders to Flint
  2. Your backend sends GET /v1/orders/{order_id} to Flint
  3. Flint returns payment_collection to Your backend
  4. Your backend returns payment_collection to Browser
  5. Browser sends Stripe Elements creates a pm_... credential to Browser
  6. Browser sends the credential to Your backend
  7. Your backend sends POST /v1/orders/{order_id}/pay to Flint
  8. Flint returns order and payment attempt to Your backend

Read the order right before the buyer pays, and pass data.payment_collection.stripe to the browser. It holds the publishable key and connected account Stripe.js needs, and no secrets. Mount Elements from it where you used to attach Square's card:

JavaScript
// Replaces payments.card(), card.attach(), and card.tokenize().
const collection = paymentCollection.stripe;
const guidance = collection.elements;

const stripe = Stripe(collection.publishable_key, {
  stripeAccount: collection.account_id,
});
// Stripe Elements takes processor method types. Apple Pay and Google Pay ride on card.
const STRIPE_METHOD_TYPES = {card: "card", apple_pay: "card", google_pay: "card", affirm: "affirm", ach_debit: "us_bank_account"};
const paymentMethodTypes = [...new Set(guidance.payment_options.flatMap((option) => STRIPE_METHOD_TYPES[option] ?? []))];

const elements = stripe.elements({
  mode: guidance.mode,
  amount: guidance.amount_money.amount,
  currency: guidance.amount_money.currency.toLowerCase(),
  paymentMethodCreation: guidance.payment_method_creation,
  paymentMethodTypes,
});
elements
  .create("payment", {
    // Show only the wallets Flint offers; Stripe's default can show others.
    wallets: {
      applePay: guidance.payment_options.includes("apple_pay") ? "auto" : "never",
      googlePay: guidance.payment_options.includes("google_pay") ? "auto" : "never",
    },
  })
  .mount("#payment-element");

async function tokenize() {
  const {error: submitError} = await elements.submit();
  if (submitError) throw submitError;
  const {error, confirmationToken} = await stripe.createConfirmationToken({elements});
  if (error) throw error;
  return confirmationToken.id; // ctoken_..., where Square gave you cnon:...
}

Every payment-mode read returns next_step: "create_confirmation_token", including API-key and checkout-session reads. Embedded payments covers the same browser flow for both.

Your backend sends the credential where it used to call CreatePayment. Send the balance the buyer saw as expected_outstanding_money, so a total that changed in the meantime is refused instead of charged:

cURL
curl -X POST https://api.withflintpay.com/v1/orders/ord_1kmn0aExample/pay \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Idempotency-Key: pay-ord_1kmn0aExample-ctoken_1kmn0aExample" \
  -d '{
    "action": "pay",
    "payment_source": {"credential_type": "stripe_confirmation_token", "stripe": {"confirmation_token": "ctoken_1kmn0aExample"}},
    "expected_outstanding_money": {"amount": 9900, "currency": "USD"}
  }'
Response
{
  "data": {
    "order": {
      "order_id": "ord_1kmn0aExample",
      "status": "closed",
      "payment_status": "paid"
    },
    "order_payment_attempt": {
      "order_payment_attempt_id": "opat_1kmn0aExample",
      "status": "succeeded",
      "is_resumable": false,
      "pending_actions": []
    }
  },
  "request_id": "req_..."
}

Three behaviors differ from Square's:

  • Declines return 200. Square reports a declined card as an error response. Flint returns 200 for every outcome, so branch on order_payment_attempt.status: succeeded, failed for a decline, or requires_action for 3D Secure. Declines and payment attempts lists every status.
  • 3D Secure comes after the charge starts. Instead of calling verifyBuyer() before you charge, run the attempt's pending action in the browser when it returns requires_action, then resume the attempt. See Finish 3D Secure.
  • Flint confirms the payment. Never call stripe.confirmPayment for an order. The browser only creates the credential.

Embedded payments is the full integration, including order changes after Elements is mounted. If your Square code charges amounts with no order, a standalone payment intent is the closer match; see Server-confirmed payments.

Saved cards and subscribers#

Contact Flint to migrate saved cards. Flint coordinates the import with Stripe if Square can provide a compatible export. The same process can work for Braintree and other providers that Stripe accepts. Migrating from Stripe covers copies from a Stripe account instead.

  1. Map your customers. Create each customer in Flint. Give Flint the Square customer IDs and corresponding Flint customer_id values, or tell Flint if you stored those IDs as unique external_reference_id values. Never send card numbers or security codes to Flint.
  2. Confirm which cards can move. Authorize Square to send the export to Stripe and confirm that the buyers' permission covers future charges after the move. For expired or ineligible cards, or when fresh consent is needed, ask the buyer to save a card.
  3. Import each subscription with its card. Use the mapping Flint provides to match the card the subscription uses in Square to its Flint payment_method_id. Import the current paid period with that ID so Flint starts charging at the next renewal.
  4. Switch renewals one subscriber at a time. Check that the Flint card and first charge date are correct before stopping the next Square renewal. Verify Square won't renew. If you defer the cutover, keep the renewal on Square. If you already created the Flint subscription, cancel it immediately and verify it has ended without charging the renewal. After Square renews, import the newly paid period with a new Idempotency-Key.

Import without a card describes the reminder and what happens if you import a subscription but can't bind a card before the deadline.

Collect cards on file again#

Square card IDs don't work outside Square. If Flint can't migrate an existing card, ask the customer to save one before their next charge is due. Saving a card is three calls:

  1. Your backend creates a pending payment method for the customer.
  2. The browser confirms the setup with Stripe.js, which runs any 3D Secure check.
  3. Flint marks the card active and sends payment_method.activated.
cURL
curl -X POST https://api.withflintpay.com/v1/payment-methods \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Idempotency-Key: save-card-cus_1kmn0aExample-001" \
  -d '{"customer_id": "cus_1kmn0aExample"}'
Response
{
  "data": {
    "payment_method_id": "pm_1kmn0aExample",
    "customer_id": "cus_1kmn0aExample",
    "type": "card",
    "status": "pending",
    "usage": "off_session",
    "is_default": false,
    "client_setup": {
      "stripe": {
        "account_id": "acct_Example",
        "publishable_key": "pk_test_Example",
        "setup_intent": {
          "stripe_js_call": "confirm_setup",
          "client_secret": "seti_Example_secret_Example"
        }
      }
    }
  }
}

Send client_setup.stripe to the browser and confirm the setup where your Square code called CreateCard:

JavaScript
const setup = clientSetup.stripe;
const stripe = Stripe(setup.publishable_key, {stripeAccount: setup.account_id});
const elements = stripe.elements({clientSecret: setup.setup_intent.client_secret});
elements
  .create("payment", {
    // Show only the wallets Flint offers; Stripe's default can show others.
    wallets: {
      applePay: guidance.payment_options.includes("apple_pay") ? "auto" : "never",
      googlePay: guidance.payment_options.includes("google_pay") ? "auto" : "never",
    },
  })
  .mount("#payment-element");

const {error} = await stripe.confirmSetup({
  elements,
  confirmParams: {return_url: "https://example.com/account/cards"},
  redirect: "if_required",
});

A successful confirmSetup doesn't make the card chargeable yet. Wait for payment_method.activated, or poll GET /v1/payment-methods/{payment_method_id} until status is active. Save a card and charge it later covers refused cards and the other statuses.

To make the card the customer's default, as Square apps often track themselves, send default_payment_method_id with PATCH /v1/customers/{customer_id}. The card must be active. Send null to clear the default. Changing the default sends customer.updated. Deleting a card sets its status to archived and sends payment_method.archived.

Charge a saved card in one of two ways:

  • With the customer present, pay an order with "payment_source": {"credential_type": "payment_method", "payment_method_id": "pm_1kmn0aExample"}. The bank can still ask for 3D Secure.
  • With the customer away, where Square apps call CreatePayment with a card_id, pay an order with the same payment_source plus "customer_presence": "absent". Flint charges the card as a merchant-initiated payment. To bill usage and retry declines on your schedule, issue an invoice with collection.mode set to automatic instead. See When the customer is not there.

Move subscriptions#

SquareFlint
Plan and plan variationSubscription plan, with its price in line_items and cadence in billing_interval and billing_interval_count
card_idpayment_method_id, or the customer's default card when you leave it out
start_datebilling_start of type: "scheduled" with starts_at
monthly_billing_anchor_datebilling_anchor_day
An existing subscriber's paid periodbilling_start of type: "imported"

A Square subscription with no card_id bills each period by emailed invoice. A Flint subscription charges a saved card, so each subscriber saves a card before their first Flint charge. You can import them first and bind the card afterward.

Create the plan#

cURL
curl -X POST https://api.withflintpay.com/v1/subscription-plans \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Idempotency-Key: plan-pro-monthly-001" \
  -d '{
    "name": "Pro Monthly",
    "billing_interval": "monthly",
    "billing_interval_count": 1,
    "currency": "USD",
    "line_items": [{
      "type": "custom",
      "name": "Pro plan",
      "unit_price_money": {"amount": 2999, "currency": "USD"},
      "quantity": 1
    }],
    "external_reference_id": "square-plan-variation-6JHXF3B2CW3YKHDV4XEM674H"
  }'

Import each subscriber#

Send the start of the period the subscriber already paid Square for as period_started_at. Flint charges nothing for that period, computes its end from the plan's interval, and takes the first payment at the renewal Square would have made. Set completed_cycles to the number of periods already paid on Square, including the current period. It must be at least 1. Omit it to default to 1, so the first Flint renewal has subscription_cycle: 2.

Run each body through POST /v1/subscription-previews with "mode": "create" first. It runs every check a real create runs, returns is_valid and the full errors list, and creates nothing. Import subscribers from another tool shows the request. Then create:

cURL
curl -X POST https://api.withflintpay.com/v1/subscriptions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Idempotency-Key: import-square-sub-8151fc89" \
  -d '{
    "terms": {
      "type": "subscription_plan",
      "subscription_plan_id": "plan_1kmn0aExample"
    },
    "customer_id": "cus_1kmn0aExample",
    "payment_method_id": "pm_1kmn0aExample",
    "billing_start": {
      "type": "imported",
      "period_started_at": "2026-10-01T00:00:00Z",
      "completed_cycles": 7
    },
    "external_reference_id": "8151fc89-da15-4eb9-a685-1a70883cebfc"
  }'

Then cancel the Square subscription, so only Flint renews it.

  • Import before the period ends. A period that has already ended returns 400 INVALID_REQUEST on billing_start.period_started_at. Don't fall back to "type": "immediate" for an existing subscriber: it charges the full period now, so they pay twice.
  • A card isn't required to import. Without payment_method_id or a default card on the customer, the subscription is created with payment_method_id: null and a payment_method_due_at time, and subscription.created carries both. A default card that can't be used fails the request, and so does a payment_method_id you send that isn't an active card of the customer. Bind the card later with PATCH; a customer's default card doesn't bind to an existing subscription.
  • Retry safely. POST /v1/subscriptions requires an Idempotency-Key. Use one key per subscriber and reuse it on retries. Look up GET /v1/subscriptions?external_reference_id=... before creating, so a re-run batch doesn't create a second subscription under a new key.
  • Provisioning runs again. An imported subscription sends subscription.created and subscription.activated. If your handler grants access on subscription.activated, make it a no-op for subscribers who already have access.

New signups don't need an import. Send them to a checkout session with "type": "subscription_plan", or create the subscription with "billing_start": {"type": "immediate"} once they've saved a card. Subscription billing covers every start mode, trials, and failed renewals.

Move invoices#

Square drafts an invoice with CreateInvoice and sends it with PublishInvoice. Flint does the same with POST /v1/invoices and POST /v1/invoices/{invoice_id}/issue, or in one call when you add issue to the create. Flint can bill an existing order ("type": "order" with order_id) or create the order for you from quick_pay:

cURL
curl -X POST https://api.withflintpay.com/v1/invoices \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Idempotency-Key: invoice-po-1048" \
  -d '{
    "type": "quick_pay",
    "quick_pay": {
      "customer_id": "cus_1kmn0aExample",
      "line_items": [{
        "type": "custom",
        "name": "Consulting, October 2026",
        "quantity": 1,
        "unit_price_money": {"amount": 250000, "currency": "USD"},
        "fulfillment": {"requirement": "none"}
      }]
    },
    "recipient_email": "ap@example.com",
    "po_number": "PO-1048",
    "payment_due": {"type": "date", "due_date": "2026-11-30"},
    "issue": {"delivery_mode": "email"}
  }'

The response is the invoice, already open, with invoice_number and the hosted public_url.

SquareFlint
primary_recipientrecipient_email, and quick_pay.customer_id or the order's customer
payment_requests[].due_datepayment_due
automatic_payment_source: "CARD_ON_FILE""collection": {"mode": "automatic", "payment_method_id": "pm_..."}
DEPOSIT and INSTALLMENT payment requestsschedule_entries
delivery_method: "EMAIL" or "SHARE_MANUALLY"issue.delivery_mode of email or caller_managed
public_urlpublic_url

Leave invoices that are already open in Square to be paid there, and issue new ones in Flint. If you move an open invoice, cancel it in Square first, so the customer can't pay both. Invoicing covers reminders, late fees, offline payments, and voiding.

Refunds#

Refund a payment taken in Square through Square. For payments taken in Flint, POST /v1/refunds replaces RefundPayment. Name the order or the payment intent, and say what to refund with refund_type:

refund_typeRefundsSquare equivalent
fullEverything still refundableRefundPayment for the payment's full amount
amountThe amount_money you sendRefundPayment with a partial amount_money
targetsThe line items and charges you name, with their discount and tax shareNone: Square's Refunds API refunds amounts only
cURL
curl -X POST https://api.withflintpay.com/v1/refunds \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Idempotency-Key: refund-ord_1kmn0aExample-full" \
  -d '{
    "refund_type": "full",
    "order_id": "ord_1kmn0aExample",
    "reason": "requested_by_customer"
  }'

Use order_id when the order is how you reconcile, and payment_intent_id when your Square code is organized around payments. A 201 means Flint recorded the refund, not that the money went back. Read its status: pending, succeeded, partially_succeeded, or failed. Only failed is final, because a bank can reject a refund after accepting it, so follow refund.updated as well as refund.succeeded and refund.failed. Track the refund to completion has the details. Refunds shows a line-item refund, and Can the Square API refund one item? compares the two APIs.

Past orders and refunds#

Flint doesn't import order or payment history: no route creates a paid order for a sale Square already took. Keep your Square history in Square and in your own records, and refund payments made before the cutover in Square. Store each Square ID on the Flint objects you do create, in external_reference_id and metadata, so a support tool can find the Square payment behind a Flint customer, subscription, or order.

Move gift card balances#

For each active Square card, import its current balance with its original 16-digit number in code, then deactivate the Square card. Flint ignores spaces and hyphens in codes:

cURL
curl -X POST https://api.withflintpay.com/v1/gift-cards \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Idempotency-Key: import-square-gift-card-gftc-7a3d" \
  -d '{
    "currency": "USD",
    "code": "7783 3200 0100 1635",
    "customer_id": "cus_1kmn0aExample",
    "external_reference_id": "gftc:7a3d0e1c9b2f4a6e8d5c1b0a9f8e7d6c",
    "funding": {
      "value_money": {"amount": 3750, "currency": "USD"},
      "source": {
        "funding_source_type": "import",
        "external_reference_id": "square-balance-gftc:7a3d0e1c9b2f4a6e8d5c1b0a9f8e7d6c"
      }
    }
  }'

The response holds the new card in data.gift_card, with code_source: imported. When you supply a code, Flint omits data.code and data.code_recovery_expires_at; buyers keep using the code they already hold. A duplicate code returns 409 ALREADY_EXISTS at code. Codes must contain 16 gift card alphabet characters after removing spaces and hyphens. Rotate imported codes when you can reach the holder, and delete migration exports after completing the import. To send a private recipient link, add notification with the recipient's email; that needs the commerce.gift_cards.secrets.write permission. Gift cards are USD only. Add value later with POST /v1/gift-card-loads, with gift_card_id in the body. Loads and POST /v1/gift-card-redemptions take optional expected_gift_card_version for the card you read. Gift cards covers redemption, loads, and code rotation.

Switch webhooks#

Register an endpoint and list the events you handle:

cURL
curl -X POST https://api.withflintpay.com/v1/webhook-endpoints \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Idempotency-Key: webhook-endpoint-square-migration-001" \
  -d '{
    "url": "https://example.com/flint/webhooks",
    "enabled_events": [
      "order.paid",
      "refund.succeeded",
      "refund.failed",
      "refund.updated",
      "subscription.activated",
      "subscription.past_due",
      "subscription.canceled",
      "invoice.paid",
      "payment_method.activated"
    ],
    "description": "Square migration"
  }'

enabled_events is required and lists current event names. Square signs each notification with an HMAC in x-square-hmacsha256-signature. Flint signs new endpoints with a JWT that you verify against Flint's public keys, and sends an HMAC signature only when you add hmac to signing_methods. Webhooks has the verification code.

Most Square events that handlers branch on have a direct Flint replacement. Flint's events are more specific, so a handler that read a Square *.updated event and checked status becomes several handlers with no status check:

  • order.paid
    The order is paid in full, however it was paid. Fulfill from this event, after you check dispute_status.
    payment.updated
  • payment_intent.succeeded
    One payment succeeded. Use it when you track individual payments rather than orders.
    payment.updated
  • refund.succeeded
    Every part of the refund succeeded.
    refund.updated
  • refund.failed
    No money went back, and the amount can be refunded again.
    refund.updated
  • invoice.issued
    The invoice is open and can be paid. invoice.sent follows when Flint emails it.
    invoice.published
  • invoice.paid
    The invoice's balance is paid.
    invoice.payment_made
  • invoice.partially_paid
    A payment arrived and a balance remains.
    invoice.payment_made
  • invoice_payment_attempt.failed
    An automatic charge on the invoice was declined.
    invoice.scheduled_charge_failed
  • invoice.voided
    The invoice can no longer be paid.
    invoice.canceled
  • subscription.activated
    The first period is paid or imported. Grant access.
    subscription.updated
  • subscription.past_due
    A renewal charge failed.
    subscription.updated
  • subscription.canceled
    The subscription ended. Remove access.
    subscription.updated
  • payment_method.activated
    A saved card is ready to charge.
    card.created
  • payment_method.archived
    A saved card was deleted and can't be charged.
    card.disabled
  • customer.updated
    A customer changed, including their default card.
    customer.updated

The event catalog lists every event Flint sends.

Errors you'll see during a migration#

  • HTTP 409
    A customer already has this email. details[0].current_resource names them. Merge with on_email_conflict: "return_existing", or create the profile without an email.
  • HTTP 400
    param names the input. On phone, the number isn't E.164. On billing_start.period_started_at, the imported period has already ended. On payment_method_id with detail code REQUIRED, the subscriber has no card. On Idempotency-Key, the route requires a key.
  • HTTP 409
    The saved card isn't active yet, or was deleted. Wait for payment_method.activated, or ask the customer to save a card again.
  • HTTP 409
    Two import steps shared a key. Derive keys from the Square ID and the action, as Choose a key describes.
  • HTTP 409
    The account can't take card payments or save cards yet. Finish onboarding in the dashboard, then check GET /v1/merchant.

Cutover checklist#

  1. Create a test API key and run the whole migration in a sandbox first. Test keys use the same base URL as live keys.
  2. Register a webhook endpoint and deploy handlers for the Flint events you need.
  3. Import customers and the catalog, with Square IDs in external_reference_id.
  4. Switch new checkouts to checkout sessions, payment links, or embedded Stripe Elements.
  5. Ask customers with Square cards on file to save a card in Flint, and set defaults as cards activate.
  6. Migrate saved cards and subscribers. Verify the Flint subscription's card and first charge date before stopping the next renewal on Square.
  7. Import gift card balances, deliver the new codes, and deactivate the Square cards.
  8. Let open Square invoices finish in Square, and refund Square payments in Square.
  9. Remove your Square webhook subscriptions once nothing new is created there.

Next steps#

Embedded paymentsThe full Stripe Elements integration: collection guidance, 3D Secure, declines, and order changes.Save a card and charge it laterCard statuses, defaults, and charging with or without the customer present.Subscription billingPlans, imports, renewals, failed payments, and plan changes.WebhooksRegister endpoints, verify signatures, and handle retries.

Was this helpful?