Charges

A Charge debits a buyer's saved payment method or a one-time hlhunt.js token. Amounts are integers in cents. A card charge is answered synchronously (status succeeded, or a 400 card_error if it was declined); an ACH debit is answered with status pending and settles later (see the ACH & bank accounts guide). The object returned by GET /v1/charges/{id} is byte-identical to the one carried by the charge.succeeded and charge.failed webhooks.

POST
/v1/charges

Create a Charge

Debit a payment method. Secret key only. Send an Idempotency-Key header to make retries safe (same key + same body replays the original 201; see Idempotent Requests).

Request body

FieldTypeRequiredDescription
amountintegerrequiredAmount in cents. Must be a positive integer.
sourcestringrequiredWhat to charge: the id returned by POST /v1/payment-methods (a processor instrument id, or a pcivault_… id for a vaulted card), the payment_instrument_id of a completed Checkout Session, or a one-time token from hlhunt.js createToken / createBankToken (32–128 hex characters). The payment method must belong to the key's account and mode, otherwise 404 resource_missing.
currencystringoptionalISO code, upper-cased by the server. Default USD.
descriptionstringoptionalFree text stored on the charge and shown on receipts.
metadataobjectoptionalYour own keys and values. Stored unchanged, returned by GET /v1/charges/{id} and echoed in every charge webhook. See the Metadata guide.
merchant_idstringoptionalMulti-business accounts only: charge through a specific business. It must belong to the key's account (403 merchant_not_found otherwise).
customer_namestringoptionalBuyer name (also read from customer.name or metadata.customer_name). Used to match or create the Customer record and for receipts.
customer_emailstringoptionalBuyer email (also read from customer.email or metadata.customer_email). Same use as customer_name.
billing_addressobjectoptional{ line1, city, state, postal_code, country }. Used only for the IP-vs-billing risk signal; it is never sent to the processor as AVS data.
payment_typestringoptionalSet to "ach" when source is a one-time bank token from hlhunt.js createBankToken, so the charge is priced and routed as ACH.
vault_referencestringoptionalThe reference returned next to a one-time token by hlhunt.js. Optional.

Response

FieldTypeDescription
idstringCharge id (the processor's transaction id, e.g. TR…). Use it for GET /v1/charges/{id} and as charge on POST /v1/refunds.
objectstringAlways "charge".
amountintegerAmount in cents.
currencystringUpper-case currency code.
statusstringsucceeded, pending, failed or canceled. A card charge is succeeded or the request fails with 400 card_error; an ACH debit is pending until the bank clears it.
descriptionstring | nullAs sent.
sourcestringThe source you sent.
createdstringISO 8601 timestamp.
metadataobjectAs sent, or {}.
  • HTTP 201 on success. The create response is a short form; GET /v1/charges/{id} returns the full object (fee, captured, failure_code, failure_message, amount_refunded, refunded, livemode, updated).
  • A decline is not a charge object: the response is 400 { error: { type: "card_error", code: "charge_failed", message } }. If the processor recorded the declined attempt, a charge.failed webhook follows with failure_code and failure_message.
  • 400 missing_required_param (amount, source) · 400 invalid_source · 402 card_error bank_account_unverified / bank_account_verification_failed / bank_account_disabled (a bank account that has not passed microdeposit verification) · 403 tier_limit_exceeded, merchant_not_found, merchant_not_onboarded, processing_disabled, ach_disabled · 404 resource_missing (unknown or removed source) · 409 payment_method_requires_reentry (instrument saved under a previous processor) · 409 / 422 idempotency conflicts · 500 internal_error.
  • Webhooks: charge.succeeded or charge.failed once the outcome is final; charge.created when the charge is still pending (ACH).
curl -X POST https://api.hlhunt.org/v1/charges \
  -H "Authorization: Bearer sk_live_your_api_key" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: order-1234-attempt-1" \
  -d '{
    "amount": 2000,
    "currency": "USD",
    "source": "PIxxxxxxxxxxxxxxxxxx",
    "description": "Order #1234",
    "customer_email": "jenny@example.com",
    "metadata": { "order_id": "1234" }
  }'
GET
/v1/charges/{charge_id}

Retrieve a Charge

Fetch one charge by its id. This is the canonical charge object — the same JSON the charge.succeeded and charge.failed webhooks deliver — so it is the right call for polling an ACH debit or confirming a webhook.

Parameters

FieldTypeRequiredDescription
charge_idstring (path)requiredThe charge id from POST /v1/charges, or HL Hunt's internal transaction id. Scoped to the key's account and mode.

Response

FieldTypeDescription
idstringCharge id.
objectstring"charge".
amountintegerAmount in cents.
feeintegerHL Hunt processing fee in cents (0 until the charge settles).
currencystringCurrency code.
statusstringsucceeded, pending, failed or canceled. canceled means the charge was fully refunded or voided.
capturedbooleantrue once status is succeeded.
descriptionstring | nullThe description you sent.
sourcestring | nullThe payment method or token that was charged.
failure_codestring | nullProcessor failure code when status is failed, otherwise null.
failure_messagestring | nullHuman-readable failure reason when status is failed, otherwise null.
createdstring | nullISO 8601.
updatedstring | nullISO 8601, last state change.
metadataobjectYour metadata. After an ACH return it also carries a bankReturn object (see the ACH guide).
livemodebooleanfalse for charges made with a test key.
amount_refundedintegerCents refunded so far (pending and succeeded refunds).
refundedbooleantrue once the whole amount has been refunded.
  • 404 resource_not_found when the id is unknown, belongs to another account, or was made in the other mode (a test key never sees live charges).
curl -X GET https://api.hlhunt.org/v1/charges/TRxxxxxxxxxxxxxxxxxx \
  -H "Authorization: Bearer sk_live_your_api_key"
GET
/v1/charges

List Charges

Lists the charges the current processor reports for the key's business, newest first. This list is a summary; call GET /v1/charges/{id} for the full object.

Parameters

FieldTypeRequiredDescription
limitinteger (query)optional1–100. Default 25. There is no offset parameter on this endpoint.
merchant_idstring (query)optionalMulti-business accounts: list another business owned by the same account.

Response

FieldTypeDescription
objectstring"list".
dataarrayCharges: { id, object, amount, currency, status, created }.
has_morebooleantrue when the page is full (data.length === limit).
  • Charges made before a processor transfer are not included; retrieve them by id instead.
curl -X GET "https://api.hlhunt.org/v1/charges?limit=20" \
  -H "Authorization: Bearer sk_live_your_api_key"
POST
/v1/charges/{charge_id}/capture

Capture an authorized Charge

Settle a charge that is still pending as an authorization. Only a charge in status pending can be captured.

Request body

FieldTypeRequiredDescription
charge_idstring (path)requiredThe authorization's charge id.
amountintegeroptionalCents to capture. Omit to capture the full authorized amount; it cannot exceed it (400 amount_too_large).

Response

FieldTypeDescription
id / object / amount / currency / status / createdSame short form as POST /v1/charges; status is succeeded or pending.
  • 400 charge_not_capturable when the charge is not pending · 400 capture_failed when the processor refuses · 403 merchant_not_onboarded / processing_disabled · 404 resource_not_found.
  • Emits charge.succeeded once captured.
curl -X POST https://api.hlhunt.org/v1/charges/TRxxxxxxxxxxxxxxxxxx/capture \
  -H "Authorization: Bearer sk_live_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{ "amount": 1500 }'