Skip to main content

defend Method

Overview​

The defend method submits your formal argument against the customer's chargeback claim.

Business Use Case: After submitting delivery proof, submit your formal defense stating why the chargeback is illegitimate.

Request Fields​

FieldTypeRequiredDescription
disputeIdstringYesThe connector's dispute ID
reasonCodestringYesDefense reason code (see below)
explanationstringYesDetailed explanation
submitEvidencebooleanNoWhether to submit attached evidence

Defense Reason Codes​

CodeDescription
product_or_service_providedProduct/service was delivered
customer_withdrew_disputeCustomer withdrew with their bank
duplicate_charge_docCharge is not a duplicate
cancellation_policy_disclosedCustomer accepted terms

Response Fields​

FieldTypeDescription
disputeIdstringConnector's dispute ID
defenseSubmittedbooleanSuccess status
statusDisputeStatusUNDER_REVIEW
statusCodenumberHTTP status code

Example​

SDK Setup​

const { DisputeClient } = require('hyperswitch-prism');

const disputeClient = new DisputeClient({
connector: 'stripe',
apiKey: 'YOUR_API_KEY',
environment: 'SANDBOX'
});

Request​

const request = {
disputeId: "dp_xxx",
reasonCode: "product_or_service_provided",
explanation: "Customer ordered product on 2024-01-10. Package delivered on 2024-01-15 with signature.",
submitEvidence: true
};

const response = await disputeClient.defend(request);

Response​

{
disputeId: "dp_xxx",
defenseSubmitted: true,
status: "UNDER_REVIEW",
statusCode: 200
}

Next Steps​

  • get - Check dispute status after submission
  • Wait for bank decision (typically 60-75 days)