# GraphQL creditAndRefundInvoice mutation \[Beta\]

**URL:** <https://devcommunity.firmhouse.com/t/graphql-creditandrefundinvoice-mutation-beta/40>\
**Category:** General\
**Created:** [August 18, 2023, 2:29pm UTC](https://devcommunity.firmhouse.com/t/graphql-creditandrefundinvoice-mutation-beta/40 "2023-08-18T14:29:37Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![denisa](https://avatars.discourse-cdn.com/v4/letter/d/b487fb/32.png) [@denisa](https://devcommunity.firmhouse.com/u/denisa)\
**Post date:** [August 18, 2023, 2:29pm UTC](https://devcommunity.firmhouse.com/t/graphql-creditandrefundinvoice-mutation-beta/40/1 "2023-08-18T14:29:37Z")

</div>

# creditAndRefundInvoice

Creates a credit invoice and attempts a refund at the payment provider.

## Arguments

| Argument | Description |
| --- | --- |
| invoiceId (ID) | ID of the invoice to be refunded. |
| refundReason (string) | The reason for the refund; will be added to the refund notes by the payment provider. |

_Example:_  
_Refund the invoice with ID 63, using the reason “Example refund reason”, return validation errors (if any) and retrieve the refund record and credit invoice._

```auto
mutation {
	creditAndRefundInvoice(input: {
		invoiceId: "63",
		refundReason: "Example refund reason"
	}) {
		invoice {
			id
		}
		creditInvoice {
			id
		}
		refund {
			id
		}
		refundErrors {
			attribute
			message
		}
	}
}

```
