Creates a new refund request.
|invoiceId||The BitPay invoice Id having the associated refund to be created.|
|amount||Amount to be refunded in the currency indicated.|
|currency||Reference currency used for the refund, usually the same as the currency used.|
|preview||Whether to create the refund request as a preview (which will not be acted on until status is updated)|
|immediate||Whether funds should be removed from merchant ledger immediately on submission or at time of processing|
|buyerPaysRefundFee||Whether the buyer should pay the refund fee (default is merchant)|
$date = new \DateTime(); $today = $date->format("Y-m-d"); $dateBefore = $date->modify('-30 day'); $sevenDaysAgo = $dateBefore->format("Y-m-d"); $invoices = $bitpay->getInvoices($sevenDaysAgo, $today, InvoiceStatus::Complete); $firstInvoice = $invoices; $invoice = $bitpay->getInvoice($firstInvoice->getId()); $refunded = $bitpay->createRefund($invoice->getId(), 10.0, Currency::USD, true, false, false);