Endpoint
POST https://api.digitzs.com/payments
Overview
Use this endpoint to refund a payment or void an eligible transaction. The system automatically determines whether to perform a refund or void based on the transaction timing and type.
Void vs Refund: If the transaction is eligible to be voided, the system will perform a void instead of a refund. Voids are processed faster and don’t incur additional processing fees.
Void Eligibility
Transactions can be voided under these conditions:
Card Transactions: Can be voided before 11:59 PM PST on the same day the transaction was processed
ACH Transactions: Cannot be voided through the API. Contact support for ACH transaction issues.
Authentication
Header Value Required
x-api-keyYour API key from onboarding Yes AuthorizationBearer {appToken}Yes appIdYour application ID Yes Content-Typeapplication/jsonYes
Request Body
Container for payment attributes
data.attributes.paymentType
Must be "refund" for refund/void operations
data.attributes.parentPaymentId
The payment ID of the original transaction to refund or void
data.attributes.transaction
Transaction details Show Transaction properties
data.attributes.transaction.amount
Amount to refund in cents. Can be less than original amount for partial refunds.
data.attributes.transaction.currency
Currency code (must match original transaction)
Optional JSON string with refund reason or additional metadata
Example Request - Full Refund
{
"data" : {
"type" : "payments" ,
"attributes" : {
"paymentType" : "refund" ,
"parentPaymentId" : "pay_abc123xyz" ,
"transaction" : {
"amount" : "2500" ,
"currency" : "USD"
},
"miscData" : "{ \" reason \" : \" customer_request \" , \" notes \" : \" Item damaged \" }"
}
}
}
Example Request - Partial Refund
{
"data" : {
"type" : "payments" ,
"attributes" : {
"paymentType" : "refund" ,
"parentPaymentId" : "pay_abc123xyz" ,
"transaction" : {
"amount" : "1000" ,
"currency" : "USD"
},
"miscData" : "{ \" reason \" : \" partial_return \" }"
}
}
}
Response
Success Response (201 Created)
{
"links" : {
"self" : "https://api.digitzs.com/payments"
},
"data" : {
"type" : "payments" ,
"id" : "pay_refund_xyz789" ,
"attributes" : {
"paymentType" : "refund" ,
"parentPaymentId" : "pay_abc123xyz" ,
"transaction" : {
"code" : "0" ,
"message" : "Success" ,
"amount" : "2500" ,
"currency" : "USD" ,
"refundType" : "void"
}
}
}
}
data.attributes.transaction.refundType
Indicates whether transaction was voided ("void") or refunded ("refund")
Code Examples
cURL
JavaScript
Python
PHP
Ruby
curl -X POST https://api.digitzs.com/payments \
-H "x-api-key: your-api-key" \
-H "Authorization: Bearer your-app-token" \
-H "appId: your-app-id" \
-H "Content-Type: application/json" \
-d '{
"data": {
"type": "payments",
"attributes": {
"paymentType": "refund",
"parentPaymentId": "pay_abc123xyz",
"transaction": {
"amount": "2500",
"currency": "USD"
}
}
}
}'
Void vs Refund Comparison
Feature Void Refund
Timing Same day before 11:59 PM PST Any time after settlement Processing Speed Immediate 3-10 business days Additional Fees None May incur refund processing fees Fund Return Instantly released on customer’s card Processed as credit to customer’s card Transaction Record Transaction cancelled New refund transaction created
Error Responses
400 Bad Request - Invalid amount
404 Not Found
422 Unprocessable Entity
{
"errors" : [
{
"status" : "400" ,
"title" : "Bad Request" ,
"detail" : "Refund amount exceeds original transaction amount"
}
]
}
Common Error Scenarios
Error: 404 Not FoundSolution: Verify the parentPaymentId is correct and the payment exists in your account.
Refund amount exceeds original
Error: 400 Bad RequestSolution: Ensure the refund amount doesn’t exceed the original transaction amount or the remaining refundable balance.
Error: 422 Unprocessable EntitySolution: Check the payment status. If already fully refunded, no additional refunds are possible.
Error: 422 Unprocessable EntitySolution: Contact Digitzs support for ACH refund processing. ACH refunds require special handling.
Important Notes
ACH Transactions: Do not use this endpoint for ACH transactions. Contact Digitzs support for ACH refund assistance.
Partial Refunds: Multiple partial refunds are supported up to the original transaction amount.
Void Window: Process refunds on the same day before 11:59 PM PST to get instant voids instead of multi-day refunds.
Best Practices
Check Timing: If same-day, consider the void window for faster processing
Track Refunds: Monitor all refund transactions for reconciliation
Document Reasons: Use miscData to record why refunds were issued
Validate Amounts: Ensure refund amount doesn’t exceed original or remaining balance
Customer Communication: Inform customers about refund processing time (instant void vs 3-10 day refund)
Handle Splits: Use the split refund endpoint for split payments
Next Steps
Refund Split Payment Learn how to refund split payments
Get Payment Status Check refund status