Skip to main content
POST https://xquik.com/api/v1/credits/quick-topup Add API credits from the Xquik dashboard with a saved payment method.

Add API credits with a saved payment method

Use quick top-up after the dashboard confirms an amount from USD 10 through 500. This route requires a same-origin Xquik session. External integrations must use the hosted top-up endpoint. Read outcome before handling any other response field. charged means the credits and new balance are ready. requires_action means the client must complete payment authentication. declined means the saved method failed. no_payment_method means the account has no reusable payment method. Never print or store clientSecret. Pass it directly to the payment confirmation flow. Log only the outcome, added credits, and resulting balance after a successful charge. Quick top-up differs from standard checkout status. The status route polls a hosted checkout session by session_id. This route returns its own immediate payment outcome for the saved payment method.
Free. This endpoint does not consume credits.

Headers

Body

At USD 0.00015 per credit, a USD 25 quick top-up adds 166,666 credits. Xquik rounds down to whole credits. Only charged grants credits. Complete requires_action with clientSecret. Use hosted checkout for declined or no_payment_method.

Response

200 Charged

The payment succeeded. Xquik added the credits to your balance.

200 Requires action

Payment requires more authentication, such as 3D Secure. Use the returned client secret with the billing confirmation flow to complete the payment.

200 No payment method

The account has no saved payment method. Redirect the user to add one in the billing portal. Or use the standard top-up endpoint instead.

200 Declined

The saved method failed. Open hosted checkout so the user can choose another.

400 Invalid input

{ "error": "invalid_input", "message": "Maximum quick top-up is $500" } Xquik charges nothing. The message names the field to fix.
  • dollars is missing, below USD 10, above USD 500 or has over 2 decimals.
  • currency is not 1 of the 10 codes.
  • chargedMinorUnits is not a positive whole number.

401 Unauthenticated

Missing or expired dashboard session. This route does not accept API keys.

409 Conflict

Xquik charged nothing for this request. { "error": "price_changed", "message": "The price changed. Resend with this chargedCurrency & chargedMinorUnits to pay.", "chargedCurrency": "USD", "chargedMinorUnits": 2500 } price_changed means the charge differs from the one you sent. Show the payer the new charge. To pay it, resend with currency set to chargedCurrency and the new chargedMinorUnits.idempotency_conflict means an Idempotency-Key came back with another amount or currency. Send a new key to buy again. topup_in_progress means another top-up for this account is still running. Check your balance before you try again.

429 Rate limited

Too many requests. Wait for the Retry-After header before retrying.

Response examples

  • 400 { "error": "invalid_input", "message": "Invalid input. Check the request body." }
  • 401 { "error": "unauthenticated", "message": "Authentication required. Provide a valid API key or bearer token." }
  • 403 { "error": "session_required", "message": "API keys & OAuth tokens cannot use this route. Sign in at dashboard.xquik.com/account instead." }
  • 409 { "error": "price_changed", "message": "The price changed. Resend with this chargedCurrency & chargedMinorUnits to pay." }
  • 429 { "error": "rate_limit_exceeded", "message": "Too many requests. Try again later.", "retryAfter": 60 }