Hosted Payment Page (HPP) Guide
Collect card and bank payments on a Cresora-served hosted page, so payer card and bank details never touch your servers.
The Hosted Payment Page (HPP) is the integration where the payer enters card or bank account details on a Cresora-served hosted page. Your servers create a session, send the payer to the page, and learn the outcome from a webhook — you never receive, store, or transmit the payer's card or bank data.
The payment fields are served and submitted by the hosted page, not your application, so cardholder data never reaches your infrastructure. That is what keeps cardholder data out of your environment — commonly the SAQ A shape, though which SAQ applies is your QSA's call. Collect card fields yourself and that changes.
The rendering mode is a server-side field
HPP has two rendering modes, redirect and iframe, and the mode is the rendering_mode field on the session you
create — not a client-side decision about how you use the returned URL. The server validates the rest of the request
against the mode you declare: parent_origin is required in iframe mode and rejected in redirect mode, and
postMessage emission is enabled only by a valid parent_origin.
Create a session (redirect mode)
POST https://api.cresoracommerce.ai/api/v1/hpp/sessions
Idempotency-Key is required. amount is a decimal string, not a number. The only required body property is
merchant_id, but amount must be present and positive on a payment session. Unknown properties are rejected, so a
misspelled field errors rather than being ignored. There is no rail feature flag on session create: the payer is offered the payment methods the merchant's hosted page offers, narrowed by allowed_payment_methods when you send it.
curl -X POST https://api.cresoracommerce.ai/api/v1/hpp/sessions \
-H "Authorization: Bearer csk_ab12cd34_xxxxxxxxxxxxxxxxxxxxxxxx" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: idem_$(uuidgen)" \
-d '{
"merchant_id": "0190a1b2-c3d4-7e5f-8901-23456789abcd",
"amount": "50.00",
"amount_mode": "locked",
"currency": "USD"
}'import uuid, requests
body = {"merchant_id": "0190a1b2-c3d4-7e5f-8901-23456789abcd", "amount": "50.00", "amount_mode": "locked", "currency": "USD"}
headers = {
"Authorization": "Bearer csk_ab12cd34_xxxxxxxxxxxxxxxxxxxxxxxx",
"Content-Type": "application/json",
"Idempotency-Key": f"idem_{uuid.uuid4()}",
}
url = "https://api.cresoracommerce.ai/api/v1/hpp/sessions"
session = requests.post(url, headers=headers, json=body).json()import { randomUUID } from "node:crypto";
const body = { merchant_id: "0190a1b2-c3d4-7e5f-8901-23456789abcd", amount: "50.00", amount_mode: "locked", currency: "USD" };
const res = await fetch("https://api.cresoracommerce.ai/api/v1/hpp/sessions", {
method: "POST",
headers: {
Authorization: "Bearer csk_ab12cd34_xxxxxxxxxxxxxxxxxxxxxxxx",
"Content-Type": "application/json",
"Idempotency-Key": `idem_${randomUUID()}`,
},
body: JSON.stringify(body),
});
const session = await res.json();The session response
A successful create returns 200 with the session in state PENDING.
{
"id": "0190a1c4-5d6e-7f80-9123-456789abcdef",
"merchant_id": "0190a1b2-c3d4-7e5f-8901-23456789abcd",
"state": "PENDING",
"hpp_url": "<hosted page URL returned by the API>",
"iframe_url": null,
"rendering_mode": "redirect",
"capture_mode": "sale",
"amount_mode": "locked",
"page_purpose": "payment",
"payment_method": null,
"amount": "50.00",
"surcharge_amount": "0.00", "convenience_fee_amount": "0.00", "total_amount": "50.00",
"currency": "USD", "expires_at": "2026-08-12T15:15:00Z", "created_at": "2026-08-12T15:00:00Z"
}idis a UUID — session identifiers are not prefixed strings.hpp_urlis the URL the payer must reach; take it from the response, never construct it.iframe_urlequalshpp_urliniframemode and isnullinredirectmode.total_amount=amount+surcharge_amount+convenience_fee_amount. A surcharge and a convenience fee are mutually exclusive, so at most one of the two is non-zero.- The payer may add a tip, tax or shipping on the hosted page. When the gateway reports them with the payment, they become part of the transaction
amount, and the tax is also intax_amount: a $10.00 session paid with $3.00 of tax reads1300and300(integer cents, as on aGET /transactions/{transactionId}read). If the gateway reports no usable base,amountkeeps the session's value andtax_amountis0. If the base is usable but the tip, tax or shipping is malformed, those are ignored:amountis the base the gateway charged andtax_amountis0. - If the issuer approves less than the requested amount, the session stays
PENDINGand no transaction or webhook is created. Cresora operations are alerted and resolve it, so contact support if a payer reports a reduced hold. payment_methodiscard,ach, ornull, and staysnulluntil the rail is known. Do not treatnullascard.
Redirect mode
Send the payer to hpp_url. After an approved payment the page may send the browser on to the hosted page's
configured success-redirect destination, which is page-level configuration.
You cannot vary that destination per session, and the browser's arrival back on your site is not proof of payment.
Wait for the hpp_session.completed webhook, then confirm the payment with an API read before you fulfil the order (see Webhooks below).
Iframe mode
Set rendering_mode to iframe, supply parent_origin, then load iframe_url as the iframe src.
curl -X POST https://api.cresoracommerce.ai/api/v1/hpp/sessions \
-H "Authorization: Bearer csk_ab12cd34_xxxxxxxxxxxxxxxxxxxxxxxx" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: idem_$(uuidgen)" \
-d '{
"merchant_id": "0190a1b2-c3d4-7e5f-8901-23456789abcd",
"amount": "50.00",
"currency": "USD",
"rendering_mode": "iframe",
"parent_origin": "https://checkout.example.com"
}'parent_origin must match ^https://[^/]+$ (scheme and host only, no path) and is at most 256 characters. Its host
must be covered by the page's allowed embedding domains; the check is fail-closed and an uncovered host returns
422 hpp_parent_origin_not_allowed. An origin that fails the address-safety check returns 422 parent_origin_unsafe:
localhost with or without a port, a loopback, private, or link-local address, an internal host name, a host that
does not resolve, or a port other than 443. checkout.example.com above is a placeholder: use your own public origin.
For local development, put a public hostname (a dev subdomain or an HTTPS tunnel) in front of the local app and add
that hostname to the allow-list.
postMessage lifecycle events
The hosted page emits lifecycle events to the parent frame: ready, session_loaded, payment_succeeded,
payment_failed, cancelled, expired, session_invalid, and height_changed. The vendor's list ends with "etc",
so treat the set as open and ignore names you do not know. Every message is posted with your parent_origin as the
target origin, never *; with no parent_origin — that is, in redirect mode — emission is disabled fail-closed.
Your parent page must validate event.origin against the hosted page URL's origin.
The message payloads are produced by the gateway's hosted page and are not part of Cresora's published contract.
Key your UX on the event names only and confirm every outcome server-side. Cresora publishes no HPP JavaScript
client library, and there is no enable_field_events parameter on session create.
// `session` is the JSON body returned by POST /api/v1/hpp/sessions
const hppOrigin = new URL(session.iframe_url).origin;
const frame = document.createElement("iframe");
frame.src = session.iframe_url;
document.querySelector("#checkout").appendChild(frame);
window.addEventListener("message", (event) => {
if (event.origin !== hppOrigin) return; // never skip this check
// Payload shapes are not published: read what your page sends, extract the name yourself.
switch (extractLifecycleEventName(event.data)) {
case "ready":
case "session_loaded":
hideYourOwnSpinner(); break;
case "height_changed": resizeFrame(frame); break; // dimensions are not contractual either
case "payment_succeeded": showPendingConfirmation(); break; // UX only - fulfil after the webhook and an API read
case "payment_failed": keepFrameOpen(); break; // stays PENDING, the payer can retry
case "cancelled":
case "expired":
case "session_invalid":
closeFrameAndOfferRestart(); break;
// any other name: no-op, the vendor set is open
}
});Session parameters
| Property | Type / values | Notes |
|---|---|---|
merchant_id | uuid | Required — the only required property. |
amount | decimal string | Required and positive on payment sessions; omitted or "0.00" on save_card. |
currency | USD | USD only. |
expires_in_seconds | integer 60–900 | Default 900. |
rendering_mode | redirect | iframe | Default redirect. Server-side mode selector. |
parent_origin | ^https://[^/]+$, max 256 | Required on iframe, rejected on redirect. See Iframe mode. |
allowed_embedding_domains | hostnames, max 20 | Wildcards OK, checked as their parent host (*.example.com as example.com); raw IPs rejected; localhost, and a host that resolves to a loopback or private address or does not resolve, fail the address-safety check. On an iframe session each entry is at most 253 characters and must contain a dot (or start with *.). |
tokenize | boolean, default false | Vaults the card; cvt_… arrives on hpp_session.completed. |
page_purpose | payment | save_card | save_card_with_initial_charge | See the save-card sections. |
allowed_payment_methods | array of card | ach, 1–2 unique | Narrows the page's payment methods for this session: the page shows the methods in both lists. A list that excludes every method the page offers returns 422 hpp_rail_restriction_not_offered. Omit it for no restriction. |
recurring_plan | object or null | Required with, exclusive to, save_card_with_initial_charge. |
credential_usages | array, max 4 unique | Lowercase usages. Required, with at least one entry, whenever tokenize: true and no recurring_plan is sent, otherwise 400 hpp_credential_usages_required; omit it when not tokenizing. See save-card. |
capture_mode | sale | authorize | Default sale. authorize holds funds on the card rail only; an ACH payment on the same page is an ACH_DEBIT, not a hold. A session the payer could pay only by ACH is refused with 422 hpp_authorize_requires_card. Incompatible with save-card purposes. |
amount_mode | customer_entered | suggested | locked | Default locked on a payment session: the payer sees amount and cannot change it. Send suggested or customer_entered for an amount the payer may edit. amount stays required and positive on a payment session in every mode. Not accepted on a save_card or save_card_with_initial_charge session (400 validation_error), so omit it there. |
customer_email_visibility | hidden | optional | required | Whether the hosted page shows the payer an email field for this session. Omit it and the page's own setting applies. hidden cannot be combined with customer_email, and hidden with tokenize: true needs a customer_id. |
billing_address | object | Sends the payer's billing name and address to the gateway as hosted-page prefill values. Members, all optional: first_name, last_name, line1, line2, city, state, postal_code, country. Each is at most 100 characters (postal_code 20), one line of plain text, not blank, without < or >, and must not contain a card number (400 validation_error). There is no phone member. If the merchant's hosted page shows no billing address, Cresora drops the object. If the gateway still refuses a prefilled field, the session create fails: with 422 hpp_field_not_enabled when the page does not enable the field (the response does not name the member), or with 422 validation_error and errors[].field naming the member when it refuses the value. Whether the page shows a prefilled address, whether the payer can edit it, and whether it reaches the transaction or the AVS check is not confirmed. Cresora does not store it or return it on the session; the address the gateway reports for the card is described under "The billing address on the transaction", below. |
require_consent | boolean or null | Tri-state consent-tick override; requires tokenize: true. |
custom_fields | array, max 10 | Entries are {name, value} (values for a multi-value field). Each name must be an enabled custom-field definition of the merchant: a definition visible on the hosted page pre-fills the page's field, and a hidden one is still applied to the transaction, unless the gateway refuses its value at session create (422 validation_error). Rejected on save_card. |
customer_email | email, max 50 | Strongly recommended with tokenize: true. |
customer_id | uuid | The Cresora customer id, not your CRM reference. |
level3_data | object | Rejected on save-card purposes. No level2_data on this surface. |
Create-time errors
| Status | Code | Meaning |
|---|---|---|
| 422 | hpp_tokenization_not_supported | Tokenization is unavailable for this configuration. |
| 422 | hpp_parent_origin_not_allowed | parent_origin host is not covered by the allowed embedding domains. |
| 422 | parent_origin_unsafe / allowed_embedding_domain_unsafe | parent_origin / an allowed_embedding_domains entry failed the address-safety check: localhost, a loopback, private, or link-local address, an internal host name, a host that does not resolve, or (for parent_origin) a port other than 443. |
| 422 | hpp_customer_rejected | The gateway rejected the referenced customer. |
| 404 | not_found | customer_id is unknown or belongs to another merchant. |
| 400 | hpp_credential_usages_required | tokenize: true with no credential_usages and no recurring_plan. |
| 422 | multi_usage_requires_recurring_plan | credential_usages names recurring or installment alongside another usage outside save_card_with_initial_charge. |
| 422 | credential_usage_contradicts_plan | credential_usages on save_card_with_initial_charge must include recurring. |
| 422 | hpp_page_not_card_only | save_card_with_initial_charge requires a card-only page. |
| 422 | hpp_convenience_fee_line_not_shown | The convenience fee line is not displayed on the page. |
| 422 | hpp_convenience_fee_requires_card_only | The merchant charges a convenience fee, which the page does not apply to ACH payments, and the payer could pay by ACH. Send allowed_payment_methods: ["card"] or use a card-only page. |
| 422 | hpp_rail_restriction_not_offered | allowed_payment_methods excludes every payment method the merchant's page offers. Drop or widen the restriction, or have the missing method added to the page. |
| 422 | hpp_authorize_requires_card | capture_mode: authorize on a session the payer can pay only by ACH: the merchant's hosted page offers ACH alone, or allowed_payment_methods narrows it to ach. An authorization hold runs on card only. Use capture_mode: sale, or allow card on the session and on the merchant's hosted page. |
| 422 | level3_not_supported_for_save_card_only | level3_data on a save_card or save_card_with_initial_charge session. |
| 400 | custom_field_invalid | custom_fields on a save_card session, or an entry the API does not accept, for example an unknown, disabled, or reserved name, a name sent twice, or a value that is too long or fails the field's rules. A value the gateway refuses for a field hidden on the page returns 422 validation_error instead. |
| 422 | hpp_field_not_enabled | The gateway refused a field the merchant's hosted page does not enable, for example a billing_address member. The response does not name the field, and the same request is refused again. Create the session again without the optional prefills, such as billing_address, or contact Cresora support with the error_id to have the field enabled on the page. |
| 422 | hpp_save_card_not_supported | The gateway will not save a payment method without a charge on this merchant's page, so save_card is refused. Contact Cresora support. save_card_with_initial_charge also saves a card, but it takes a first payment, enrolls a recurring plan, and needs a card-only page. |
| 422 | hpp_reseller_page_disabled | Hosted payment pages are switched off for the merchant's reseller. Contact Cresora support; retrying does not help until the feature is switched back on. |
| 422 | hpp_tokenization_vetoed | The page will not save the payment method for this session. Enable saving payment details on the merchant's hosted page. |
| 422 | hpp_credential_scope_not_honoured | The page would record a different consent scope than your credential_usages. Contact Cresora support. |
| 422 | hpp_amount_mode_not_honoured | The gateway's answer names an amount mode other than the one your session runs under (the mode you sent, or the locked default), so the session is refused. Contact Cresora support if it persists. |
| 422 | hpp_plan_convenience_fee_unsuppressed | A save_card_with_initial_charge session enrolls a recurring_plan for a merchant whose convenience fee is enabled. Card brands exclude the fee from recurring charges and the gateway does not carry the session's fee suppression into the plan, so Cresora cannot keep the plan's charges fee-free. Create a one-off session, or have the merchant's convenience fee disabled, then retry. |
| 422 | hpp_customer_not_bound | The session was not bound to the customer_id you sent. Check the customer reference, then contact Cresora support. |
| 422 | hpp_consent_unexpectedly_required | The page would make the payer tick a consent box this session did not ask for. Review the page's stored-credential consent settings. |
| 422 | idempotency_key_reused | The Idempotency-Key was already used by an earlier request that succeeded or is still being processed, and this request differs from it, when Cresora can compare the two: another body, even one that is only re-serialized, or, within 24 hours, another endpoint. To receive the original session, resend the original create unchanged, byte for byte, and read its state with GET /api/v1/hpp/sessions/{sessionId}. Use a new key for a request that is genuinely different. |
| 422 | gateway_idempotency_key_reused | The payment gateway refused the Idempotency-Key as already used for another session request, and a session may already exist for it. This can happen when an earlier attempt under the key reached the gateway but Cresora recorded no session for it, for example because the gateway's response was lost, or when the key equals one that another integration sent; random keys, such as UUIDs, avoid the second case. Not retryable with the same key. Cresora holds no session to look up, so contact Cresora support with the error_id before you use a new key: a new key can open a second payment link if an earlier attempt under the old one reached the payer. |
| 502 | hpp_url_missing | The gateway returned no page URL. Retry under a new Idempotency-Key. |
| 502 | hpp_url_rejected_unsafe | The gateway returned a page URL Cresora will not hand out. Do not retry; contact Cresora support. |
| 503 | feature_disabled / gateway_circuit_open | No PROVISIONED hosted page for the merchant / gateway calls are open-circuited. |
hpp_tokenization_vetoed, hpp_credential_scope_not_honoured, hpp_customer_not_bound,
hpp_consent_unexpectedly_required, and hpp_amount_mode_not_honoured come from the gateway's answer to the session
it just created. Cresora keeps nothing and asks the gateway to cancel that session, so the same request is refused the
same way for as long as the gateway's answer to it stays the same.
Save a card
Set page_purpose to save_card with tokenize true and at least one credential_usages entry, and omit amount (or send "0.00"). The hosted page
runs a zero-dollar verification and vaults the instrument. Incompatible with capture_mode authorize.
The usages you declare fix what the token can be charged with: the use_type of a later charge must be one of them.
Each usage covers only the use_type of the same name: one_time_future covers charges the payer makes, and unscheduled_cof, recurring and installment each cover the merchant-initiated charges of that name.
recurring and installment need a recurring_plan, so only a save_card_with_initial_charge session declares them: see Save a card with an initial charge.
See Scope and consent.
curl -X POST https://api.cresoracommerce.ai/api/v1/hpp/sessions \
-H "Authorization: Bearer csk_ab12cd34_xxxxxxxxxxxxxxxxxxxxxxxx" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: idem_$(uuidgen)" \
-d '{
"merchant_id": "0190a1b2-c3d4-7e5f-8901-23456789abcd",
"page_purpose": "save_card",
"tokenize": true,
"credential_usages": ["one_time_future"],
"customer_email": "payer@example.com"
}'The vault token arrives as data.cresoraVaultToken on hpp_session.completed, prefixed cvt_. Re-saving a card
already vaulted under the same consent returns the existing cvt_… token and fires no stored_credential.vaulted.
Save a card with an initial charge
save_card_with_initial_charge requires recurring_plan and tokenize true, and amount must be omitted.
recurring_plan requires recurring_amount, frequency (daily, weekly, monthly, yearly), and
number_of_payments (2–999, including the initial charge); interval is 1–365 and defaults to 1;
initial_charge_amount is optional. The merchant needs a card-only page, otherwise you get 422 hpp_page_not_card_only.
curl -X POST https://api.cresoracommerce.ai/api/v1/hpp/sessions \
-H "Authorization: Bearer csk_ab12cd34_xxxxxxxxxxxxxxxxxxxxxxxx" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: idem_$(uuidgen)" \
-d '{
"merchant_id": "0190a1b2-c3d4-7e5f-8901-23456789abcd",
"tokenize": true,
"page_purpose": "save_card_with_initial_charge",
"credential_usages": ["recurring"],
"recurring_plan": {
"recurring_amount": "25.00",
"frequency": "monthly",
"interval": 1,
"number_of_payments": 12
}
}'Authorize now, capture later
Set capture_mode to authorize on a payment session. When the payer pays by card, the completed session materializes
an AUTHORIZED auth-only transaction that you capture later with POST /api/v1/transactions using type CAPTURE. The
hold exists on the card rail only: if the page also offers ACH and the session completes with an ACH payment, the
transaction is an ACH_DEBIT born SUBMITTED, not a hold. authorize is incompatible with both save-card purposes. The capture call's request shape is documented in Card Transactions.
Session lifecycle
HppSessionState is PENDING, COMPLETED, EXPIRED, or CANCELLED.
PENDING ──> COMPLETED | EXPIRED | CANCELLED (all three terminal)A session past expires_at reads EXPIRED before Cresora records the expiry. A completion that arrives before
Cresora records it still makes the session COMPLETED.
A decline leaves the session PENDING and the payer can retry on the hosted page until expires_at. Sessions are not
single-use per attempt, so do not tear down your checkout on the first hpp_session.attempt_failed.
Poll session status
GET https://api.cresoracommerce.ai/api/v1/hpp/sessions/{sessionId} — no Idempotency-Key on this read.
SESSION_ID="0190a1c4-5d6e-7f80-9123-456789abcdef"
curl "https://api.cresoracommerce.ai/api/v1/hpp/sessions/$SESSION_ID" \
-H "Authorization: Bearer csk_ab12cd34_xxxxxxxxxxxxxxxxxxxxxxxx"The response always carries id, state, expires_at, rendering_mode, capture_mode, amount_mode, and
page_purpose. It may also carry transaction_id (null until COMPLETED), completed_at, last_attempt with at
and reason (one of reversed, rejected, declined, failed, policy_rejected, unknown), card with a required
last4 plus expiry_month, expiry_year, brand, token_capture_failure with at and reason, recurring_plan,
customer_id, level3_data, payment_method, minimum_amount and maximum_amount (the session's amount bounds, when it has them), tokenization_outcome, bank (the settled ACH account: account_type, account_last4, routing_last4) and vault_token (null unless the key holds stored_credential:read). state is effective, not merely stored: a session past expires_at reports
EXPIRED at read time even before the sweep persists it. Polling is the fallback; the webhook is primary.
The billing address on the transaction
billing_address on the transaction is in the API reference. Whether the sandbox and production return it there is
not confirmed; code that reads it must handle its absence, as it must for the cases below. The billing_address you
send when you create a session is a different member; this note does not concern it.
Read the transaction a completed session names in transaction_id with GET /api/v1/transactions/{transactionId}. For a
hosted-page card payment it can carry billing_address: the billing address the gateway reported for the card, member by
member (address1, address2, city, state, province, zip, postal_code, country). A member is left out when
the gateway sent it empty, and also when Cresora does not record it: one longer than its bound, one that holds a control,
invisible, bidirectional or line-break character, < or >, one that is neither text nor a number, and one that holds a
card number. When the session prefilled the billing address, this can be the prefilled value the payer kept. The
gateway has not confirmed that it is always the address entered for this payment, and Cresora does not check it against
the card; avs_response_code carries the processor's address-verification result when one ran.
billing_address is payer contact data. It is returned only to a caller that holds the customer:read permission. It is
omitted for any other caller, on any payment other than a hosted-page card sale or authorization, when no member of the
address is recorded (a country alone counts as none), and on payments completed before the field existed: there is no
backfill.
A hosted-page card sale or authorization can also carry client_ip_address, the IP address the gateway names as the
client that initiated the transaction. It is left out when the gateway's value is blank, longer than 64 characters or not
an IP address (an IPv4 address or a bracketed IPv6 address may be followed by a port). The gateway has not confirmed that this is the payer's own address, so Cresora
withholds the field from every caller until it is enabled; once enabled, it is shown only to a caller that holds
customer:read.
Cancel a session
POST https://api.cresoracommerce.ai/api/v1/hpp/sessions/{sessionId}/cancel — Idempotency-Key is required. It
returns the session status with state CANCELLED, emits hpp_session.cancelled, and is idempotent on a session
that is already CANCELLED.
SESSION_ID="0190a1c4-5d6e-7f80-9123-456789abcdef"
curl -X POST "https://api.cresoracommerce.ai/api/v1/hpp/sessions/$SESSION_ID/cancel" \
-H "Authorization: Bearer csk_ab12cd34_xxxxxxxxxxxxxxxxxxxxxxxx" \
-H "Idempotency-Key: idem_$(uuidgen)"Cancel is gateway-first. On 502, 503, or 504 the session is still PENDING and still payable, and Cresora does
not retry internally — it is safe, and necessary, to retry the cancel yourself.
These refusals are expected rather than transport failures. None of them is an authentication problem, so do not rotate credentials over them.
| Status | Code | Meaning |
|---|---|---|
| 422 | invalid_state_transition | The session is no longer PENDING in Cresora (it completed or expired), or the gateway reported that finalizing its payment failed. A session already CANCELLED is returned instead. Read it with GET /api/v1/hpp/sessions/{sessionId}. |
| 422 | hpp_session_already_consumed | The payer already used the session at the gateway, and Cresora has not recorded the outcome yet. Do not treat the order as abandoned, even if a read shows EXPIRED: wait for hpp_session.completed, after which a read of the session shows the outcome, or for hpp_session.payment_unresolved if no payment can be found. If hpp_session.expired arrives instead, contact Cresora support with the session id: the payment may still have gone through. |
| 422 | hpp_session_already_cancelled | The gateway has already cancelled the session, so no payment can be taken on it. Cresora's copy can still read PENDING until it catches up. |
| 422 | hpp_session_cancel_rejected | The gateway refused for any other reason. Read the session with GET /api/v1/hpp/sessions/{sessionId}. |
Webhooks
| Event type | Fires when |
|---|---|
hpp_session.created | A session is created. |
hpp_session.completed | The payment or save-card flow succeeded. Carries data.cresoraVaultToken when tokenize is true. Before you fulfil, read the session with GET /hpp/sessions/{sessionId}: it reads COMPLETED, and for a payment transaction_id names the transaction. Read that transaction and check its state and its amount (integer cents) against the order: unless the session's amount_mode reads locked, the payer could edit the amount; even then a tip, tax or shipping the payer adds is included in it. A card sale reads CAPTURED; with capture_mode authorize it reads AUTHORIZED and is not collected until you capture it. An ACH payment's transaction reads SUBMITTED: it has not settled and can still be RETURNED. |
hpp_session.attempt_failed | Once per declined attempt on a pending session. The session stays PENDING. A declined card attempt on a payment session is also, apart from rare anomalies, booked as a FAILED transaction (transaction.failed). Branch on the session's state for the final outcome, except after hpp_session.payment_unresolved. |
hpp_session.expired | The session passed expires_at without completing. If hpp_session.payment_unresolved fired for this session, the payer may have been charged. |
hpp_session.cancelled | The session was cancelled. |
hpp_session.token_capture_failed | Vaulting the instrument failed. |
hpp_session.contract_creation_failed | A save_card_with_initial_charge session took the initial charge and saved the card, but the gateway could not create its recurring contract, so the schedule will not bill. Sent at most once per session; not getting it does not prove the contract was created, and a contract you cannot find in GET /api/v1/contracts does not prove it failed, so do not re-enroll the payer on absence alone. That list does not name the session; if you are unsure whether a contract exists, contact Cresora with the session id. Whether to re-enroll the payer or tell them is your decision. |
hpp_session.payment_unresolved | The payment's outcome could not be established. The payer may already have been charged, so do not ask them to pay again. Read the session with GET /hpp/sessions/{sessionId} and contact Cresora support with the session id. The session later reads EXPIRED; that does not mean the payer was not charged. |
The envelope names the event in event_type, and business fields are nested under data.
{
"envelope_version": 1,
"event_id": "0190d8a1-2b3c-7d4e-9f12-7a8b9c0d1e2f",
"event_type": "hpp_session.completed",
"occurred_at": "2026-08-12T14:32:11.847Z",
"partner_id": "0190a1b2-c3d4-7e5f-8901-23456789abcd",
"idempotency_key": "evt_0190d8a1-2b3c-7d4e-9f12-7a8b9c0d1e2f",
"data": { "cresoraVaultToken": "cvt_01885fec-4444-7a31-9bbb-3e5b9a1f8c42" }
}data.cresoraVaultToken is present when the session was created with tokenize: true; use idempotency_key (or the event_id it embeds) as your deduplication key.
Managing embedding domains
Two endpoints maintain the allow-list that gates parent_origin. Both take allowed_embedding_domains with at least 1
and at most 20 hostnames — on the add endpoint the cap applies to the resulting union. Raw IP addresses are rejected,
and a hostname that is localhost, resolves to a loopback or private address, or does not resolve returns
422 allowed_embedding_domain_unsafe. A wildcard entry is checked as its parent host (*.example.com as
example.com), which must itself resolve to a public address, and an add re-checks the entries already on the list.
For local development, add the public hostname in front of your local app (a dev subdomain or an HTTPS tunnel). The
hostnames below are placeholders: use your own.
MERCHANT_ID="0190a1b2-c3d4-7e5f-8901-23456789abcd"
BASE="https://api.cresoracommerce.ai/api/v1/config/hpp-page/merchants"
# PUT replaces the whole list
curl -X PUT "$BASE/$MERCHANT_ID/embedding-domains" \
-H "Authorization: Bearer csk_ab12cd34_xxxxxxxxxxxxxxxxxxxxxxxx" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: idem_$(uuidgen)" \
-d '{"allowed_embedding_domains": ["checkout.example.com", "*.example.com"]}'
# POST .../add appends to it
curl -X POST "$BASE/$MERCHANT_ID/embedding-domains/add" \
-H "Authorization: Bearer csk_ab12cd34_xxxxxxxxxxxxxxxxxxxxxxxx" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: idem_$(uuidgen)" \
-d '{"allowed_embedding_domains": ["staging.example.com"]}'Both configuration endpoints require an Idempotency-Key header, like every other write. An update re-validates the
merchant's whole stored page configuration, not only the domains you send, so a stored configuration that no longer
passes a check fails the update. It fails with the 400 that PUT /api/v1/config/hpp-page/merchants/{merchantId}
returns for that configuration (hpp_invalid_color, hpp_copy_too_long, hpp_tokenization_requires_email, or
unsafe_url), for example, for a color saved before colors were validated, or for a redirect URL whose host no longer
resolves. If the configuration offers a payment method the merchant is not enabled for, it fails with
422 hpp_payment_method_unsupported. Correct the page configuration with that PUT first.
Re-saving the page does not cure every cause. The same 422 also answers a stored page that is not on the gateway
yet (Cresora has no gateway page recorded for it), when the merchant has boarded processors, none of them can take
cards, and the page requests card (a page does, unless appearance.paymentMethods in the page-configuration PUT
lists only ach, which needs the ACH modality; card is the default when the field is omitted). Saving the page
again with card still requested does not clear it: the update stays refused until the page no longer requests
card or the merchant has a card-capable processor. An update for a merchant with no gateway merchant id, or for a
page whose create outcome is unknown, answers its own error first. Cresora does not refuse a page that is already on
the gateway for this reason.