Menu

## RefundClient
in package

RefundClient.php : 32

Handles interactions with the refund endpoints.

##### Tags

author

  BitPay Integrations integrations@bitpay.com

license

  http://www.opensource.org/licenses/mit-license.php MIT

### Table of Contents

#### Properties

$instance : self|null
$restCli : RESTcli
$tokenCache : Tokens

#### Methods

cancel() : Refund
  Cancel a previously submitted refund request on a BitPay invoice.
cancelByGuid() : Refund
  Cancel a previously submitted refund request on a BitPay invoice.
create() : Refund
  Create a refund for a BitPay invoice.
get() : Refund
  Retrieve a previously made refund request on a BitPay invoice.
getByGuid() : Refund
  Retrieve a previously made refund request on a BitPay invoice by guid.
getInstance() : static
  Factory method for Bill Client.
getRefunds() : array<string|int, Refund>
  Retrieve all refund requests on a BitPay invoice.
sendNotification() : bool
  Send a refund notification.
update() : Refund
  Update the status of a BitPay invoice.
updateByGuid() : Refund
  Update the status of a BitPay invoice.
__construct() : mixed

### Properties

#### $instance

RefundClient.php : 34
`private static self|null $instance = null`

#### $restCli

RefundClient.php : 36
`private RESTcli $restCli`

#### $tokenCache

RefundClient.php : 35
`private Tokens $tokenCache`

### Methods

#### cancel()

RefundClient.php : 398

Cancel a previously submitted refund request on a BitPay invoice.

`public cancel(string $refundId) : Refund`

##### Parameters

$refundId : string

  The refund Id for the refund to be canceled.

##### Tags

throws
  RefundCancellationException
throws
  BitPayException
throws
  Exception

##### Return values

Refund —

$refund Cancelled refund Object.

#### cancelByGuid()

RefundClient.php : 441

Cancel a previously submitted refund request on a BitPay invoice.

`public cancelByGuid(string $guid) : Refund`

##### Parameters

$guid : string

  The refund Guid for the refund to be canceled.

##### Tags

throws
  RefundCancellationException
throws
  BitPayException
throws
  Exception
since
  7.2.0

##### Return values

Refund —

$refund Cancelled refund Object.

#### create()

RefundClient.php : 80

Create a refund for a BitPay invoice.

`public create(string $invoiceId, float $amount, string $currency[, bool $preview = false ][, bool $immediate = false ][, bool $buyerPaysRefundFee = false ][, string|null $guid = null ]) : Refund`

##### Parameters

$invoiceId : string

  The BitPay invoice Id having the associated refund to be created.

$amount : float

  Amount to be refunded in the currency indicated.

$currency : string

  Reference currency used for the refund, usually the same as the currency used to create the invoice.

$preview : bool = false

  Whether to create the refund request as a preview (which will not be acted on until status is updated)

$immediate : bool = false

  Whether funds should be removed from merchant ledger immediately on submission or at time of processing

$buyerPaysRefundFee : bool = false

  Whether the buyer should pay the refund fee (default is merchant)

$guid : string|null = null

  Variable provided by the merchant and designed to be used by the merchant to correlate the refund with a refund ID in their system

##### Tags

throws
  RefundCreationException

  RefundCreationException class

throws
  BitPayException

  BitPayException class*@throws Exception

throws
  Exception
since
  7.2.0)

##### Return values

Refund —

$refund An updated Refund Object

#### get()

RefundClient.php : 274

Retrieve a previously made refund request on a BitPay invoice.

`public get(string $refundId) : Refund`

##### Parameters

$refundId : string

  The BitPay refund ID.

##### Tags

throws
  RefundQueryException
throws
  BitPayException
throws
  Exception

##### Return values

Refund —

$refund BitPay Refund object with the associated Refund object.

#### getByGuid()

RefundClient.php : 318

Retrieve a previously made refund request on a BitPay invoice by guid.

`public getByGuid(string $guid) : Refund`

##### Parameters

$guid : string

  The BitPay refund Guid.

##### Tags

throws
  RefundQueryException
throws
  BitPayException
throws
  Exception
since
  7.2.0

##### Return values

Refund —

$refund BitPay Refund object with the associated Refund object.

#### getInstance()

RefundClient.php : 51

Factory method for Bill Client.

`public static getInstance(Tokens $tokenCache, RESTcli $restCli) : static`

##### Parameters

$tokenCache : Tokens
$restCli : RESTcli

##### Return values

static

#### getRefunds()

RefundClient.php : 229

Retrieve all refund requests on a BitPay invoice.

`public getRefunds(string $invoiceId) : array<string|int, Refund>`

##### Parameters

$invoiceId : string

  The BitPay invoice object having the associated refunds.

##### Tags

throws
  RefundQueryException
throws
  BitPayException
throws
  Exception

##### Return values

array<string|int, Refund>

#### sendNotification()

RefundClient.php : 359

Send a refund notification.

`public sendNotification(string $refundId) : bool`

##### Parameters

$refundId : string

  A BitPay refund ID.

##### Tags

throws
  BitPayException
throws
  Exception

##### Return values

bool —

$result An updated Refund Object

#### update()

RefundClient.php : 137

Update the status of a BitPay invoice.

`public update(string $refundId, string $status) : Refund`

##### Parameters

$refundId : string

  BitPay refund ID.

$status : string

  The new status for the refund to be updated.

##### Tags

throws
  RefundUpdateException
throws
  BitPayException
throws
  Exception

##### Return values

Refund —

$refund Refund A BitPay generated Refund object.

#### updateByGuid()

RefundClient.php : 184

Update the status of a BitPay invoice.

`public updateByGuid(string $guid, string $status) : Refund`

##### Parameters

$guid : string

  BitPay refund Guid.

$status : string

  The new status for the refund to be updated.

##### Tags

throws
  RefundUpdateException
throws
  BitPayException
throws
  Exception
since
  7.2.0

##### Return values

Refund —

$refund Refund A BitPay generated Refund object.

#### __construct()

RefundClient.php : 38
`private __construct(Tokens $tokenCache, RESTcli $restCli) : mixed`

##### Parameters

$tokenCache : Tokens
$restCli : RESTcli

## Search results