# Update an account credit

Source: https://developers.swell.is/backend-api/account-credits/update-an-account-credit

Update an existing account credit using the ID that was returned when created.

## Arguments

- `id` (objectId, required): Unique identifier for the credit.
- `amount` (currency, required): Credit amount denominated in currency. Minimum of 0.01.
- `parent_id` (objectId, required): The ID of the parent customer.
- `currency` (string): Three-letter ISO currency code in uppercase. Defaults to the store's base currency.
- `credit_id` (objectId): ID of the credit applied to the customer's account.
- `number` (string, auto): Unique incremental number assigned automatically each time an account credit is created.

## Example request

`PUT /accounts:credits/:id`

**cURL**

```sh
$ curl https://api.swell.store/accounts:credits/62c8933c5f4ffe00136039f2 \
  -u store-id:secret-key \
  -d amount=25 \
  -X PUT
```

**Node**

```javascript
const { swell } = require('swell-node');
swell.init('store-id', 'secret-key');

await swell.put('/accounts:credits/{id}', {
  id: '62c8933c5f4ffe00136039f2',
  amount: 25
});
```

**PHP**

```php
<?php $swell = new \Swell\Client('store-id', 'secret-key');

$swell->put('/accounts:credits/{id}', [
  'id' => '62c8933c5f4ffe00136039f2',
  'amount' => 25
]);
```

## Example response

```json
{
  "parent_id": "621e53a6213eaf013d1fa6b2",
  "amount": 25,
  "reason": "refund",
  "currency": "USD",
  "date_created": "2022-07-08T20:27:40.199Z",
  "number": "100003",
  "date_updated": "2022-07-12T16:02:14.965Z",
  "id": "62c8933c5f4ffe00136039f2"
}
```
