PayFacto API - v2.0 - POST /charges/{chargeId}/voids

PayFacto API - v2.0 - POST /charges/{chargeId}/voids

PayFacto API - v2.0 - POST /charges/{chargeId}/voids

Voids an unbatched captured charge. The charge must be captured but not yet included in a settled batch.

1

Prerequisites

πŸ”‘

Authentication β€” HTTP Basic Auth

All v2.0 endpoints use HTTP Basic Authentication. Set Authorization: Basic base64(username:password). Contact PayFacto for credentials.

πŸ“‹

Content-Type

All request bodies require Content-Type: application/json.

πŸ”„

Idempotency

Include Idempotency-Key header (max 64 chars) on POST requests. 200 = duplicate; 201 = newly created.

πŸ’΅

Amounts

All monetary amounts are positive integers in cents. $12.99 = 1299.

2

Request

POST  https://uat.ca.api.payfacto.cloud/payments/v1/charges/{chargeId}/voids
⚠️

If the batch has already closed, use POST /refunds instead.

Path parameter

ParameterTypeDescription
chargeIdstring (UUID) Β· requiredID of the captured charge to void.

Request body fields

FieldConstraintDescription
reasonstring Β· requiredREQUESTED_BY_CUSTOMER, REQUESTED_BY_MERCHANT, DUPLICATE, FRAUDULENT, or ERROR_CORRECTION.
terminalobject Β· optionalRequired for terminal voids. Must include terminalId.

reason values

reasonDescription
REQUESTED_BY_CUSTOMERCustomer requested
REQUESTED_BY_MERCHANTMerchant initiated
DUPLICATEDuplicate transaction
FRAUDULENTSuspected fraud
ERROR_CORRECTIONError correction
3

Request β€” Code Example

JSON β€” Card void
{
"reason": "REQUESTED_BY_CUSTOMER"
}
JSON β€” Terminal void
{
"reason": "REQUESTED_BY_CUSTOMER",
"terminal": { "terminalId": "3a2049fb-6c9f-433d-9cef-701b6843f0cd" }
}
4

Response

Response fields (charge object)

FieldTypeDescription
idstring (UUID)Unique charge identifier. Store for all subsequent operations.
amountintegerAmount in cents (e.g. 1299 = $12.99).
amountCapturedintegerTotal captured amount in cents.
amountRefundedintegerTotal refunded amount in cents.
billingDetailobjectCustomer billing info (address, email, name, phone).
capturebooleanWhether the charge was captured immediately.
capturedbooleanWhether an uncaptured charge has since been captured.
invoiceNumberstringMerchant invoice reference (max 25 chars).
metadataobjectKey-value pairs for custom data.
originalTransactionTimestring (ISO 8601)UTC timestamp of original transaction. Only on post-charge operations.
paymentMethodobjectPayment method details (type, card/terminal/token data).
refundedbooleanWhether the charge has been fully refunded.
releaseDetailobjectRelease details if the charge was released.
resultobjectAuth result: authCode, batch, declineCode, isoResponseCode, issuerMessage.
shippingDetailobjectShipping recipient information.
statementDescriptorstringMerchant descriptor on customer statement (max 23 chars).
statusstringTransaction status: AUTHORIZED, CAPTURED, DECLINED, FAILED, RELEASED, SUCCEEDED, VOIDED.
transactionTimestring (ISO 8601)UTC timestamp when this object was created.
voidDetailobjectVoid details if voided.
errorobjectError object on failure. Contains code, type, details, message.
5

Response β€” Code Examples

JSON β€” 200 Voided
{
"id": "a1822999-099d-4fb1-a354-77be553a5b22",
"amount": 1299,
"status": "VOIDED",
"voidDetail": { "reason": "REQUESTED_BY_CUSTOMER" },
"transactionTime": "2024-05-15T16:00:01Z"
}
JSON β€” 422 Invalid State
{
"error": { "code": "INVALID_STATE", "type": "INVALID_REQUEST_ERROR", "message": "The charge cannot be voided in its current state." }
}
6

Error / HTTP Status Codes

HTTP StatusMeaningRecommended Action
200OK β€” Previously created (same idempotency key)Check status field in response body
201Created β€” New resource createdStore the id for future operations
400Bad Request β€” Invalid payloadCheck error.details and error.invalidFields
402Payment Required β€” Issuer declinedCheck result.declineCode β€” do not retry automatically
404Not FoundVerify the ID in the request path
422Unprocessable β€” Invalid stateCheck error.message
500Internal Server ErrorRetry with backoff; contact PayFacto Support if persistent