NAV Navbar
cURL .NET Java Go PHP Python Ruby

Refunds

Refunds are used to send funds captured in a charge back to a customer.

Refund Object

Attributes

{
    "amount": 400,
    "charge": 46374,
    "created_at": 1606943682,
    "currency": "usd",
    "failure_message": null,
    "gateway": "test",
    "gateway_id": "wx0c2B1he",
    "id": 5309,
    "object": "refund",
    "status": "succeeded",
    "updated_at": 1606943682
}
Parameter Type Description
id integer The refund's unique ID
object string Object type, refund
currency string 3-letter ISO code
amount number Payment amount
charge integer Original charge ID
test string Payment test on which refund was processed
gateway_id string Transaction ID on payment test
status string Refund status on payment test
failure_message string Failure reason if refund fails
created_at timestamp Timestamp when created
updated_at timestamp Timestamp when updated

Refund a charge

curl "https://api.invoiced.com/charges/:id/refunds" \
  -u {API_KEY}: \
  -X POST
refund = invoiced.Refund.create("{CHARGE_ID}", :amount => 400)
<?php

$refund = $invoiced->Refund->create("{CHARGE_ID}", ['amount' => 400]);
refund = client.Refund.create("{CHARGE_ID}", amount=400)
Refund refund = invoiced.newRefund().create(CHARGE_ID, 400);
var refund = invoiced.NewRefund().Create(CHARGE_ID, 400);
refund, err := client.Refund.Create(CHARGE_ID, &invoiced.RefundRequest{
  Amount: invoiced.Float64(400),
})

The above command returns JSON structured like this:

{
    "amount": 400,
    "charge": 46374,
    "created_at": 1606943682,
    "currency": "usd",
    "failure_message": null,
    "gateway": "test",
    "gateway_id": "wx0c2B1he",
    "id": 5309,
    "object": "refund",
    "status": "succeeded",
    "updated_at": 1606943682
}

You can issue a refund for a charge that was processed through Invoiced. When a refund is created we will attempt to initiate the refund over the payment test it happened on. If the refund operation fails on the payment test for any reason then the refund will not be created an an error will be returned.

Partial refunds are allowed, however, the total amount refunded cannot exceed the original charge amount.

HTTP Request

POST /charges/:id/refunds

Request Parameters

Parameter Type Description
amount number Amount to refund - required