Skip to content
Lookups

Payment lookups

Exact answers for when a payment fails or a provider can't do what your store needs: what a decline code means, which test card triggers a scenario, why a webhook signature check fails, and what Stripe, Square, and Shopify do and don't support. Each page cites its sources and shows how Flint handles the same problem.

Errors, codes, and test values

A payment or integration is failing and you need the exact cause.

Checkout, carts, and catalog

What a checkout can offer the buyer: options, discounts, tips, pickup, and split bills.

Orders, refunds, and receipts

Where the record of a sale lives, and what you can do with it after the charge.

Subscriptions, invoices, and deposits

Money collected over time: renewals that ship, balances due, credits, late fees, and aging.

Platform fees, policies, and providers

What a platform charges or forbids, and what you owe as the seller.

How Flint answers these lookups

Card payment APIs record an amount. On Stripe, a refund takes an amount and a payment; on Square, the Refunds API takes an amount too. The items, options, discounts, tax, and delivery choice behind that amount live in a database you build and keep in sync. That is why so many of the lookups above end with a workaround.

Flint's API is built around the order, so each of those workarounds is an object you call instead:

You need toOn FlintThe lookup
Refund one item, with its share of the discount and taxPOST /v1/refunds with refund_type: "targets" and the order line item; Flint works out the discount and tax to returnRefund a line item
Sell one product in several sizes and colorsA product with options and variants, each variant with its own price and SKUProduct variants
Apply more than one discount to an orderPromotions with combines_with rules, so codes stack by discount classMultiple coupons
Hold stock while the buyer paysInventory reservations: a hold lasts 15 minutes by default and up to 24 hoursInventory tracking
Offer pickup or local delivery at checkoutDelivery methods of type shipment, local_delivery, or pickupLocal pickup
Ask for a tip on an online checkouttip settings on the checkout session: preset options, a default, and custom amountsCheckout tips
Split one bill across two cardsSeveral payment intents on one order, confirmed together with POST /v1/orders/{order_id}/paySplit payment
Sell and redeem gift cardsGift cards with their own balance and transactions, applied to an order by codeGift cards
Take a deposit and bill the balance laterAn invoice payment schedule in schedule_entries, up to 14 entriesDeposits
Charge a late fee on an overdue invoicePayment terms with a late_fee_policy, assessed with POST /v1/invoices/{invoice_id}/late-feesInvoice late fees
Show buyers their past ordersFlint's hosted customer account, or GET /v1/me/orders in an account you buildPortal order history

Refund one item from a discounted order

A buyer paid for two $24.00 mugs with a 10% order discount and 8.25% sales tax, then sends one back. Name the line item and the quantity; Flint works out the amount:

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-1042-mug" \
  -d '{
    "order_id": "ord_01KEZF7C00JBKMARG3P06Z224B",
    "refund_type": "targets",
    "reason": "requested_by_customer",
    "line_items": [
      {"order_line_item_id": "li_01KEZF7C00Q4V3M8T2W6R9Y1N5", "quantity": 1}
    ]
  }'
JSON
{
  "data": {
    "refund_id": "ref_01KEZF7C00H2GAMWD73WZ7K81W",
    "order_id": "ord_01KEZF7C00JBKMARG3P06Z224B",
    "amount_money": {"amount": 2338, "currency": "USD"},
    "status": "succeeded",
    "line_item_allocations": [
      {
        "order_line_item_id": "li_01KEZF7C00Q4V3M8T2W6R9Y1N5",
        "quantity": 1,
        "refunded_money": {"amount": 2338, "currency": "USD"},
        "automatic_refund": {
          "subtotal_money": {"amount": 2400, "currency": "USD"},
          "discount_money": {"amount": 240, "currency": "USD"},
          "tax_money": {"amount": 178, "currency": "USD"},
          "total_money": {"amount": 2338, "currency": "USD"}
        },
        "tax_refund_mode": "automatic"
      }
    ]
  }
}

The refund returns the mug's price less its share of the discount, plus the tax charged on what the buyer paid for it:

One of two $24.00 mugs, refunded
  • Subtotalautomatic_refund.subtotal_money
    $24.00
  • Discountautomatic_refund.discount_money
    10% order discount
    −$2.40
  • Taxautomatic_refund.tax_money
    8.25% of $21.60
    $1.78
  • Refundedautomatic_refund.total_money
    $23.38

The split is stored on the refund in line_item_allocations, so you never rebuild it from an amount. The refunds guide covers partial quantities, charges and tax, and restocking fees.