Documentation Index
Fetch the complete documentation index at: https://docs.paywithsoap.com/llms.txt
Use this file to discover all available pages before exploring further.
Payload Structure
interface WebhookEvent {
event_id: string;
type: "checkout.returned"
data: {
id: string; // id of the checkout you originally created
type: "deposit" | "withdrawal";
charge: {
id: string;
status: "returned";
from_status: "succeeded";
amount_cents: number;
transaction_type: "credit" | "debit";
};
customer: {
id: string;
};
line_items: Array<{
product_id: string;
quantity: number;
}>;
line_items_total_amount_cents: number | null;
}
}
Example Response
{
"event_id": "ev_tDaWu5aTVa2kbvDjGe55rxZpaMEmVFWB",
"type": "checkout.returned",
"data": {
"id": "chk_twijxXgVFofj9mdnvzF7vhbJSZEhfUpC",
"type": "deposit",
"charge": {
"id": "ch_yRZcCGouimTgbz4thtrfbj2mh3ZT6vnz",
"status": "returned",
"from_status": "succeeded",
"amount_cents": 2500,
"transaction_type": "credit"
},
"customer": {
"id": "cus_vi57KegYgcRqcGHqip8q6UZiqtrwMT870"
},
"line_items": [],
"line_items_total_amount_cents": null
}
}
Updating Your Internal Ledger
This is essentially a reversal of the checkout.succeeded event.
The transaction_type field in the charge object indicates the type of transaction:
credit: Money was originally added to the customer’s balance, so you should deduct it.
debit: Money was originally removed from the customer’s balance, so you should add it back.