Refunds
Refunds are not currently supported directly within Credyt. If you need to issue refunds, you must do so directly with your payment provider (your PSP or Stripe, if you use Credyt’s built-in payments).
You can then use the Wallet Adjustments API to adjust the customer’s balance within Credyt.
Refunds with an External PSP
If you use your own PSP for payment processing:
- Initiate the refund through your PSP’s dashboard or API.
- Notify Credyt of the refunded amount using the Adjustments API. Use a unique
transaction_idand specifyreason: "external_refund".
Example
This subtracts $20 from the customer’s fiat account balance.
- REST API
- TypeScript SDK
- Python SDK
POST https://api.credyt.ai/customers/cust_473cr1y0ghbyc3m1yfbwvn3nxx/wallet/adjustments
{
"transaction_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"account_name": "default",
"asset": "USD",
"amount": -20,
"description": "Technical failure",
"reason": "external_refund",
"expires_at": "2024-07-29T15:51:28.071Z"
}
Response
{
"id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"created_at": "2024-07-29T15:51:28.071Z"
}
await client.customerWalletOps.createAdjustment("cust_473cr1y0ghbyc3m1yfbwvn3nxx", {
transactionId: "3fa85f64-5717-4562-b3fc-2c963f66afa6",
accountName: "default",
asset: "USD",
amount: -20,
description: "Technical failure",
reason: "external_refund",
expiresAt: "2024-07-29T15:51:28.071Z",
});
SDK response object
const response = {
id: "3fa85f64-5717-4562-b3fc-2c963f66afa6",
createdAt: "2024-07-29T15:51:28.071Z",
};
response = client.customer_wallet_ops.create_adjustment(
customer_id="cust_473cr1y0ghbyc3m1yfbwvn3nxx",
body={
"transaction_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"account_name": "default",
"asset": "USD",
"amount": -20,
"description": "Technical failure",
"reason": "external_refund",
"expires_at": "2024-07-29T15:51:28.071Z",
},
)
SDK response object
response = {
"id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"created_at": "2024-07-29T15:51:28.071Z",
}
Refunds with Credyt Payments
If you use Credyt’s built-in payments processing (via Stripe):
- Initiate the refund in the Stripe Dashboard. Stripe handles payment reversal, receipts, and settlement.
- Notify Credyt of the refund through the Adjustments API, so the customer’s balance is updated.
Example
This subtracts $20 from the customer’s fiat account balance.
- REST API
- TypeScript SDK
- Python SDK
POST https://api.credyt.ai/customers/cust_473cr1y0ghbyc3m1yfbwvn3nxx/wallet/adjustments
{
"transaction_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"account_name": "default",
"asset": "USD",
"amount": -20,
"description": "Technical failure",
"reason": "external_refund",
"expires_at": "2024-07-29T15:51:28.071Z"
}
Response
{
"id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"created_at": "2024-07-29T15:51:28.071Z"
}
await client.customerWalletOps.createAdjustment("cust_473cr1y0ghbyc3m1yfbwvn3nxx", {
transactionId: "3fa85f64-5717-4562-b3fc-2c963f66afa6",
accountName: "default",
asset: "USD",
amount: -20,
description: "Technical failure",
reason: "external_refund",
expiresAt: "2024-07-29T15:51:28.071Z",
});
SDK response object
const response = {
id: "3fa85f64-5717-4562-b3fc-2c963f66afa6",
createdAt: "2024-07-29T15:51:28.071Z",
};
response = client.customer_wallet_ops.create_adjustment(
customer_id="cust_473cr1y0ghbyc3m1yfbwvn3nxx",
body={
"transaction_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"account_name": "default",
"asset": "USD",
"amount": -20,
"description": "Technical failure",
"reason": "external_refund",
"expires_at": "2024-07-29T15:51:28.071Z",
},
)
SDK response object
response = {
"id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"created_at": "2024-07-29T15:51:28.071Z",
}
Best Practices
- Always send refunds as a negative adjustment with
reason: "external_refund". - Use a unique identifier for
transaction_idthat ties the refund to the original payment. The Adjustments API supports metadata, which you can use to attach identifiers or other relevant information to make reconciliation and traceability easier. - Keep refund amounts and currencies consistent with the original payment to avoid reconciliation issues.