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.
/v1/chargesCreate 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
| Field | Type | Required | Description |
|---|---|---|---|
| amount | integer | required | Amount in cents. Must be a positive integer. |
| source | string | required | What 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. |
| currency | string | optional | ISO code, upper-cased by the server. Default USD. |
| description | string | optional | Free text stored on the charge and shown on receipts. |
| metadata | object | optional | Your own keys and values. Stored unchanged, returned by GET /v1/charges/{id} and echoed in every charge webhook. See the Metadata guide. |
| merchant_id | string | optional | Multi-business accounts only: charge through a specific business. It must belong to the key's account (403 merchant_not_found otherwise). |
| customer_name | string | optional | Buyer name (also read from customer.name or metadata.customer_name). Used to match or create the Customer record and for receipts. |
| customer_email | string | optional | Buyer email (also read from customer.email or metadata.customer_email). Same use as customer_name. |
| billing_address | object | optional | { 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_type | string | optional | Set to "ach" when source is a one-time bank token from hlhunt.js createBankToken, so the charge is priced and routed as ACH. |
| vault_reference | string | optional | The reference returned next to a one-time token by hlhunt.js. Optional. |
Response
| Field | Type | Description |
|---|---|---|
| id | string | Charge id (the processor's transaction id, e.g. TR…). Use it for GET /v1/charges/{id} and as charge on POST /v1/refunds. |
| object | string | Always "charge". |
| amount | integer | Amount in cents. |
| currency | string | Upper-case currency code. |
| status | string | succeeded, 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. |
| description | string | null | As sent. |
| source | string | The source you sent. |
| created | string | ISO 8601 timestamp. |
| metadata | object | As 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" }
}'/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
| Field | Type | Required | Description |
|---|---|---|---|
| charge_id | string (path) | required | The charge id from POST /v1/charges, or HL Hunt's internal transaction id. Scoped to the key's account and mode. |
Response
| Field | Type | Description |
|---|---|---|
| id | string | Charge id. |
| object | string | "charge". |
| amount | integer | Amount in cents. |
| fee | integer | HL Hunt processing fee in cents (0 until the charge settles). |
| currency | string | Currency code. |
| status | string | succeeded, pending, failed or canceled. canceled means the charge was fully refunded or voided. |
| captured | boolean | true once status is succeeded. |
| description | string | null | The description you sent. |
| source | string | null | The payment method or token that was charged. |
| failure_code | string | null | Processor failure code when status is failed, otherwise null. |
| failure_message | string | null | Human-readable failure reason when status is failed, otherwise null. |
| created | string | null | ISO 8601. |
| updated | string | null | ISO 8601, last state change. |
| metadata | object | Your metadata. After an ACH return it also carries a bankReturn object (see the ACH guide). |
| livemode | boolean | false for charges made with a test key. |
| amount_refunded | integer | Cents refunded so far (pending and succeeded refunds). |
| refunded | boolean | true 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"/v1/chargesList 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
| Field | Type | Required | Description |
|---|---|---|---|
| limit | integer (query) | optional | 1–100. Default 25. There is no offset parameter on this endpoint. |
| merchant_id | string (query) | optional | Multi-business accounts: list another business owned by the same account. |
Response
| Field | Type | Description |
|---|---|---|
| object | string | "list". |
| data | array | Charges: { id, object, amount, currency, status, created }. |
| has_more | boolean | true 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"/v1/charges/{charge_id}/captureCapture an authorized Charge
Settle a charge that is still pending as an authorization. Only a charge in status pending can be captured.
Request body
| Field | Type | Required | Description |
|---|---|---|---|
| charge_id | string (path) | required | The authorization's charge id. |
| amount | integer | optional | Cents to capture. Omit to capture the full authorized amount; it cannot exceed it (400 amount_too_large). |
Response
| Field | Type | Description |
|---|---|---|
| id / object / amount / currency / status / created | Same 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 }'Endpoints
/v1/charges/v1/charges/{charge_id}/v1/charges/v1/charges/{charge_id}/captureCreate a Charge
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" }
}'Retrieve a Charge
curl -X GET https://api.hlhunt.org/v1/charges/TRxxxxxxxxxxxxxxxxxx \
-H "Authorization: Bearer sk_live_your_api_key"List Charges
curl -X GET "https://api.hlhunt.org/v1/charges?limit=20" \
-H "Authorization: Bearer sk_live_your_api_key"Capture an authorized Charge
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 }'