Quotes
EveryGET /v2/surveys/{id} (and every POST /v2/surveys / PATCH /v2/surveys/{id} response) includes:
amountis the total USD price if you paid entirely on card.creditsis the same price expressed in credits (1 credit = $2 USD).discountsincludes plan-level, country-level, and API discounts already applied — the same pricing engine as the PickFu app.planRequirednames the plan tier the survey’s configuration needs, ornull. Publish fails until the owner is on that plan.quoteTokenis a consent token for this exact price and credit balance. It appears on draft surveys. See Confirm the quote.quotedAtis when the price was calculated. The most recent quote you fetched is what publish will honour.
quote_changed below.
Confirm the quote
UsequoteToken to make sure a person approved the price before PickFu charges anything. This matters most for agents, assistants, and other automated callers.
- Read the draft with
GET /v2/surveys/{id}and showcost.amountorcost.creditsto the person. - After they approve, send the same
quoteTokenin the publish body:
409 quote_changed and charges nothing. Fetch the survey again, confirm the new quote with the person, and publish with a new Idempotency-Key. Equivalent quotes keep the same token, so re-reading an unchanged draft doesn’t invalidate an approval.
quoteToken is optional on publish. It’s required on POST /v2/surveys/{id}/payment-intent.
Publishing
POST /v2/surveys/{id}/publish requires the spend scope and an Idempotency-Key header. It charges the selected owner, either a team or a personal account. In one call it:
- Confirms the recorded quote, and
quoteTokenif you sent one, still matches the current price (else409 quote_changed). - Spends credits first, oldest expiry first, from the team’s credit balance.
- Charges any shortfall off-session to the team’s default saved card, on the survey order itself. There is no separate credit-pack order in this path — the card charge is split-tendered on the survey.
- Marks the order paid and starts collection asynchronously.
200 response means paid, not live. Collection starts in the background; watch status on GET /v2/surveys/{id} (in-progress → completed) or listen for the survey.completed webhook.
Successful response:
402 insufficient_credits — buy a pack, then retry
If credits don’t cover the price and the team has no saved card, publish answers 402 insufficient_credits. Nothing is charged and the survey is still a draft.
- Buy the suggested pack:
POST /v2/orderswith{ "pack": "credit_pack_250" }(thesuggestedPack.key) and a fresh Idempotency-Key. - Send the buyer to the returned
checkoutUrlto pay by card on Stripe’s hosted page, or pay in your own page. - Wait for the order to move to
status: "paid"— pollGET /v2/orders/{id}or listen for theorder.paidwebhook. - Retry
POST /v2/surveys/{id}/publishwith a new Idempotency-Key.
402 card_declined / card_authentication_required
If credits don’t cover the price and the saved card can’t be charged off-session, publish answers 402 card_declined or 402 card_authentication_required with a billingPortalUrl:
billingPortalUrl to add or update a card, then publish again with a new Idempotency-Key.
409 quote_changed
If the price moved between your last quote and the publish call, publish refuses to charge:
GET /v2/surveys/{id}) to record the new quote, show it to the buyer, and publish again with a new Idempotency-Key.
Credit packs
POST /v2/orders sells a credit pack. By default it uses Stripe Hosted Checkout. PickFu never touches the card number.
For hosted orders, the response includes a
checkoutUrl. Send the buyer to that URL; credits land on the team once Stripe confirms the payment. Then either poll GET /v2/orders/{id} until status: "paid" or listen for the order.paid webhook.
GET /v2/orders and GET /v2/orders/{id} list and read orders. Both credit-pack orders and survey orders appear; distinguish them by the resource fields returned per order.
An unknown pack value returns 400.
Embedded payments
Embedded payments let the buyer pay by card inside your own page with Stripe’s Payment Element, instead of redirecting to Stripe Checkout. All three routes require thespend scope and an Idempotency-Key header.
To pay for a survey:
1
Prepare the payment
amount is the card shortfall. If credits cover the whole quote, PickFu pays the order without a card and returns status: "paid".2
Confirm the card in your page
Pass
clientSecret to Stripe’s Payment Element and confirm the payment in the browser. clientSecret is only returned when status is requires_payment. Responses carry Cache-Control: no-store, so don’t cache or log them.3
Reconcile the order
Call
POST /v2/orders/{orderId}/payment-reconciliation with a new Idempotency-Key. PickFu reads the payment from Stripe and marks the order paid when the payment succeeded. Repeat while status is processing, or listen for the order.paid webhook.payment_preparation shape:
If a different payment is already in progress on the order, PickFu answers
409 payment_in_progress. Reconcile the existing payment before you change or pay the order.
Coupons
Invoices
GET /v2/invoices lists the owner’s billing history as a cursor page. It includes order-backed charges, credit usage, and existing subscription invoices. It requires the read scope.
GET /v2/orders/{id}/invoice returns the invoice for one order.
documentStatus is available when Stripe has an invoice document for the order, pending when the document isn’t ready yet, and not_applicable when the order was paid without a card charge, such as with credits only. pdfUrl and hostedUrl link to the Stripe invoice. Fetch GET /v2/orders/{id}/invoice to get them for a single order.
v2 reads invoices but doesn’t manage subscriptions, PostPay, or credit auto-reload. Use v1 for those.
Managing saved cards
POST /v2/billing-portal-sessions opens a Stripe Billing Portal session for the team’s Stripe customer:
spend scope is sufficient — there is no separate billing-admin gate.
Credit balance
GET /v2/credit-balance returns the remaining credits and the underlying FIFO buckets (each with its expiry). Credits are spent oldest-expiry-first.