27 KiB
YooKassa API SDK
Class: \YooKassa\Request\Refunds\CreateRefundRequestBuilder
Namespace: \YooKassa\Request\Refunds
Summary:
Класс, представляющий модель CreateRefundRequestBuilder.
Description:
Класс билдера запросов к API на создание возврата средств.
Examples
Пример использования билдера
try {
$refundBuilder = \YooKassa\Request\Refunds\CreateRefundRequest::builder();
$refundBuilder
->setPaymentId('24b94598-000f-5000-9000-1b68e7b15f3f')
->setAmount(3500.00)
->setCurrency(\YooKassa\Model\CurrencyCode::RUB)
->setDescription('Не подошел цвет')
->setReceiptItems([
(new \YooKassa\Model\Receipt\ReceiptItem)
->setDescription('Платок Gucci Новый')
->setQuantity(1)
->setVatCode(2)
->setPrice(new \YooKassa\Model\Receipt\ReceiptItemAmount(3500.00))
->setPaymentSubject(\YooKassa\Model\Receipt\PaymentSubject::COMMODITY)
->setPaymentMode(\YooKassa\Model\Receipt\PaymentMode::FULL_PAYMENT)
])
->setReceiptEmail('john.doe@merchant.com')
->setTaxSystemCode(1)
;
// Создаем объект запроса
$request = $refundBuilder->build();
// Можно изменить данные, если нужно
$request->setDescription('Не подошел цвет и размер');
$idempotenceKey = uniqid('', true);
$response = $client->createRefund($request, $idempotenceKey);
} catch (Exception $e) {
$response = $e;
}
var_dump($response);
Constants
- No constants found
Properties
| Visibility | Name | Flag | Summary |
|---|---|---|---|
| protected | $amount | Сумма | |
| protected | $currentObject | Собираемый объект запроса к API. | |
| protected | $receipt | Объект с информацией о чеке |
Methods
| Visibility | Name | Flag | Summary |
|---|---|---|---|
| public | __construct() | Конструктор, инициализирует пустой запрос, который в будущем начнём собирать. | |
| public | addReceiptItem() | Добавляет в чек товар | |
| public | addReceiptShipping() | Добавляет в чек доставку товара. | |
| public | addSource() | Добавляет источник возврата. | |
| public | addTransfer() | Добавляет трансфер. | |
| public | build() | Строит объект запроса к API. | |
| public | setAmount() | Устанавливает сумму. | |
| public | setCurrency() | Устанавливает валюту в которой будет происходить подтверждение оплаты заказа. | |
| public | setDeal() | Устанавливает сделку. | |
| public | setDescription() | Устанавливает комментарий к возврату. | |
| public | setOptions() | Устанавливает свойства запроса из массива. | |
| public | setPaymentId() | Устанавливает айди платежа для которого создаётся возврат | |
| public | setReceipt() | Устанавливает чек. | |
| public | setReceiptEmail() | Устанавливает адрес электронной почты получателя чека. | |
| public | setReceiptItems() | Устанавливает список товаров для создания чека. | |
| public | setReceiptPhone() | Устанавливает телефон получателя чека. | |
| public | setRefundMethodData() | Устанавливает метод возврата. | |
| public | setSources() | Устанавливает источники возврата. | |
| public | setTaxSystemCode() | Устанавливает код системы налогообложения. | |
| public | setTransfers() | Устанавливает трансферы. | |
| protected | initCurrentObject() | Возвращает новый объект для сборки. |
Details
-
Package: YooKassa\Request
-
Class Hierarchy:
- \YooKassa\Common\AbstractRequestBuilder
- \YooKassa\Request\Payments\AbstractPaymentRequestBuilder
- \YooKassa\Request\Refunds\CreateRefundRequestBuilder
-
See Also:
Tags
| Tag | Version | Description |
|---|---|---|
| category | Class | |
| author | cms@yoomoney.ru |
Properties
protected $amount : ?\YooKassa\Model\MonetaryAmount
Summary
Сумма
Type: MonetaryAmount
Details:
- Inherited From: \YooKassa\Request\Payments\AbstractPaymentRequestBuilder
protected $currentObject : ?\YooKassa\Common\AbstractRequestInterface
Summary
Собираемый объект запроса к API.
Type: AbstractRequestInterface
Details:
protected $receipt : ?\YooKassa\Model\Receipt\Receipt
Summary
Объект с информацией о чеке
Type: Receipt
Details:
- Inherited From: \YooKassa\Request\Payments\AbstractPaymentRequestBuilder
Methods
public __construct() : mixed
public __construct() : mixed
Summary
Конструктор, инициализирует пустой запрос, который в будущем начнём собирать.
Details:
- Inherited From: \YooKassa\Common\AbstractRequestBuilder
Returns: mixed -
public addReceiptItem() : self
public addReceiptItem(string $title, string $price, float $quantity, int $vatCode, null|string $paymentMode = null, null|string $paymentSubject = null, null|mixed $productCode = null, null|mixed $countryOfOriginCode = null, null|mixed $customsDeclarationNumber = null, null|mixed $excise = null) : self
Summary
Добавляет в чек товар
Details:
- Inherited From: \YooKassa\Request\Payments\AbstractPaymentRequestBuilder
- See Also:
Parameters:
| Type | Name | Description |
|---|---|---|
string |
title | Название или описание товара |
string |
price | Цена товара в валюте, заданной в заказе |
float |
quantity | Количество товара |
int |
vatCode | Ставка НДС |
null OR string |
paymentMode | значение перечисления PaymentMode |
null OR string |
paymentSubject | значение перечисления PaymentSubject |
null OR mixed |
productCode | |
null OR mixed |
countryOfOriginCode | |
null OR mixed |
customsDeclarationNumber | |
null OR mixed |
excise |
Returns: self - Инстанс билдера запросов
public addReceiptShipping() : self
public addReceiptShipping(string $title, string $price, int $vatCode, null|string $paymentMode = null, null|string $paymentSubject = null) : self
Summary
Добавляет в чек доставку товара.
Details:
- Inherited From: \YooKassa\Request\Payments\AbstractPaymentRequestBuilder
- See Also:
Parameters:
| Type | Name | Description |
|---|---|---|
string |
title | Название доставки в чеке |
string |
price | Стоимость доставки |
int |
vatCode | Ставка НДС |
null OR string |
paymentMode | значение перечисления PaymentMode |
null OR string |
paymentSubject | значение перечисления PaymentSubject |
Returns: self - Инстанс билдера запросов
public addSource() : self
public addSource(array|\YooKassa\Model\Refund\SourceInterface $value) : self
Summary
Добавляет источник возврата.
Details:
- Inherited From: \YooKassa\Request\Refunds\CreateRefundRequestBuilder
Parameters:
| Type | Name | Description |
|---|---|---|
array OR \YooKassa\Model\Refund\SourceInterface |
value | Источник возврата |
Returns: self - Инстанс билдера запросов
public addTransfer() : self
public addTransfer(array|\YooKassa\Request\Payments\TransferDataInterface $value) : self
Summary
Добавляет трансфер.
Details:
- Inherited From: \YooKassa\Request\Payments\AbstractPaymentRequestBuilder
Parameters:
| Type | Name | Description |
|---|---|---|
array OR \YooKassa\Request\Payments\TransferDataInterface |
value | Трансфер |
Returns: self - Инстанс билдера запросов
public build() : \YooKassa\Request\Refunds\CreateRefundRequest|\YooKassa\Common\AbstractRequestInterface
public build(null|array $options = null) : \YooKassa\Request\Refunds\CreateRefundRequest|\YooKassa\Common\AbstractRequestInterface
Summary
Строит объект запроса к API.
Details:
- Inherited From: \YooKassa\Request\Refunds\CreateRefundRequestBuilder
Parameters:
| Type | Name | Description |
|---|---|---|
null OR array |
options | Устанавливаемые параметры запроса |
Returns: \YooKassa\Request\Refunds\CreateRefundRequest|\YooKassa\Common\AbstractRequestInterface - Инстанс сгенерированного объекта запроса к API
public setAmount() : self
public setAmount(\YooKassa\Model\AmountInterface|array|\YooKassa\Request\Payments\numeric $value, string|null $currency = null) : self
Summary
Устанавливает сумму.
Details:
- Inherited From: \YooKassa\Request\Payments\AbstractPaymentRequestBuilder
Parameters:
| Type | Name | Description |
|---|---|---|
\YooKassa\Model\AmountInterface OR array OR \YooKassa\Request\Payments\numeric |
value | Сумма оплаты |
string OR null |
currency | Валюта |
Returns: self - Инстанс билдера запросов
public setCurrency() : self
public setCurrency(string $value) : self
Summary
Устанавливает валюту в которой будет происходить подтверждение оплаты заказа.
Details:
- Inherited From: \YooKassa\Request\Payments\AbstractPaymentRequestBuilder
Parameters:
| Type | Name | Description |
|---|---|---|
string |
value | Валюта в которой подтверждается оплата |
Returns: self - Инстанс билдера запросов
public setDeal() : \YooKassa\Request\Refunds\CreateRefundRequestBuilder
public setDeal(null|array|\YooKassa\Model\Deal\RefundDealData $value) : \YooKassa\Request\Refunds\CreateRefundRequestBuilder
Summary
Устанавливает сделку.
Details:
- Inherited From: \YooKassa\Request\Refunds\CreateRefundRequestBuilder
Parameters:
| Type | Name | Description |
|---|---|---|
null OR array OR \YooKassa\Model\Deal\RefundDealData |
value | Данные о сделке, в составе которой проходит возврат |
Throws:
| Type | Description |
|---|---|
| \YooKassa\Common\Exceptions\InvalidPropertyValueTypeException |
Returns: \YooKassa\Request\Refunds\CreateRefundRequestBuilder - Инстанс билдера запросов
public setDescription() : \YooKassa\Request\Refunds\CreateRefundRequestBuilder
public setDescription(string|null $value) : \YooKassa\Request\Refunds\CreateRefundRequestBuilder
Summary
Устанавливает комментарий к возврату.
Details:
- Inherited From: \YooKassa\Request\Refunds\CreateRefundRequestBuilder
Parameters:
| Type | Name | Description |
|---|---|---|
string OR null |
value | Комментарий к возврату |
Throws:
| Type | Description |
|---|---|
| \YooKassa\Common\Exceptions\InvalidPropertyValueTypeException | Выбрасывается если была передана не строка |
Returns: \YooKassa\Request\Refunds\CreateRefundRequestBuilder - Инстанс текущего билдера
public setOptions() : \YooKassa\Common\AbstractRequestBuilder
public setOptions(iterable|null $options) : \YooKassa\Common\AbstractRequestBuilder
Summary
Устанавливает свойства запроса из массива.
Details:
- Inherited From: \YooKassa\Common\AbstractRequestBuilder
Parameters:
| Type | Name | Description |
|---|---|---|
iterable OR null |
options | Массив свойств запроса |
Throws:
| Type | Description |
|---|---|
| \InvalidArgumentException | Выбрасывается если аргумент не массив и не итерируемый объект |
| \YooKassa\Common\Exceptions\InvalidPropertyException | Выбрасывается если не удалось установить один из параметров, переданных в массиве настроек |
Returns: \YooKassa\Common\AbstractRequestBuilder - Инстанс текущего билдера запросов
public setPaymentId() : \YooKassa\Request\Refunds\CreateRefundRequestBuilder
public setPaymentId(string|null $value) : \YooKassa\Request\Refunds\CreateRefundRequestBuilder
Summary
Устанавливает айди платежа для которого создаётся возврат
Details:
- Inherited From: \YooKassa\Request\Refunds\CreateRefundRequestBuilder
Parameters:
| Type | Name | Description |
|---|---|---|
string OR null |
value | Айди платежа |
Throws:
| Type | Description |
|---|---|
| \YooKassa\Common\Exceptions\EmptyPropertyValueException | Выбрасывается если передано пустое значение айди платежа |
| \YooKassa\Common\Exceptions\InvalidPropertyValueException | Выбрасывается если переданное значение является строкой, но не является валидным значением айди платежа |
| \YooKassa\Common\Exceptions\InvalidPropertyValueTypeException | Выбрасывается если передано значение не валидного типа |
Returns: \YooKassa\Request\Refunds\CreateRefundRequestBuilder - Инстанс текущего билдера
public setReceipt() : self
public setReceipt(array|\YooKassa\Model\Receipt\ReceiptInterface $value) : self
Summary
Устанавливает чек.
Details:
- Inherited From: \YooKassa\Request\Payments\AbstractPaymentRequestBuilder
Parameters:
| Type | Name | Description |
|---|---|---|
array OR \YooKassa\Model\Receipt\ReceiptInterface |
value | Инстанс чека или ассоциативный массив с данными чека |
Throws:
| Type | Description |
|---|---|
| \YooKassa\Common\Exceptions\InvalidPropertyValueTypeException | Генерируется если было передано значение невалидного типа |
Returns: self - Инстанс билдера запросов
public setReceiptEmail() : self
public setReceiptEmail(string|null $value) : self
Summary
Устанавливает адрес электронной почты получателя чека.
Details:
- Inherited From: \YooKassa\Request\Payments\AbstractPaymentRequestBuilder
Parameters:
| Type | Name | Description |
|---|---|---|
string OR null |
value | Email получателя чека |
Returns: self - Инстанс билдера запросов
public setReceiptItems() : self
public setReceiptItems(array $value = []) : self
Summary
Устанавливает список товаров для создания чека.
Details:
- Inherited From: \YooKassa\Request\Payments\AbstractPaymentRequestBuilder
Parameters:
| Type | Name | Description |
|---|---|---|
array |
value | Массив товаров в заказе |
Throws:
| Type | Description |
|---|---|
| \YooKassa\Common\Exceptions\InvalidPropertyValueException | Выбрасывается если хотя бы один из товаров имеет неверную структуру |
Returns: self - Инстанс билдера запросов
public setReceiptPhone() : self
public setReceiptPhone(string|null $value) : self
Summary
Устанавливает телефон получателя чека.
Details:
- Inherited From: \YooKassa\Request\Payments\AbstractPaymentRequestBuilder
Parameters:
| Type | Name | Description |
|---|---|---|
string OR null |
value | Телефон получателя чека |
Returns: self - Инстанс билдера запросов
public setRefundMethodData() : self
public setRefundMethodData(\YooKassa\Request\Refunds\RefundMethodData\AbstractRefundMethodData|array|null $value = null) : self
Summary
Устанавливает метод возврата.
Details:
- Inherited From: \YooKassa\Request\Refunds\CreateRefundRequestBuilder
Parameters:
| Type | Name | Description |
|---|---|---|
\YooKassa\Request\Refunds\RefundMethodData\AbstractRefundMethodData OR array OR null |
value |
Returns: self -
public setSources() : self
public setSources(array|\YooKassa\Model\Refund\SourceInterface[]|\YooKassa\Common\ListObjectInterface $value) : self
Summary
Устанавливает источники возврата.
Details:
- Inherited From: \YooKassa\Request\Refunds\CreateRefundRequestBuilder
Parameters:
| Type | Name | Description |
|---|---|---|
array OR \YooKassa\Model\Refund\SourceInterface[] OR \YooKassa\Common\ListObjectInterface |
value | Массив трансферов |
Returns: self - Инстанс билдера запросов
public setTaxSystemCode() : self
public setTaxSystemCode(int|null $value) : self
Summary
Устанавливает код системы налогообложения.
Details:
- Inherited From: \YooKassa\Request\Payments\AbstractPaymentRequestBuilder
Parameters:
| Type | Name | Description |
|---|---|---|
int OR null |
value | Код системы налогообложения. Число 1-6. |
Returns: self - Инстанс билдера запросов
public setTransfers() : self
public setTransfers(array|\YooKassa\Request\Payments\TransferDataInterface[]|\YooKassa\Common\ListObjectInterface $value) : self
Summary
Устанавливает трансферы.
Details:
- Inherited From: \YooKassa\Request\Payments\AbstractPaymentRequestBuilder
Parameters:
| Type | Name | Description |
|---|---|---|
array OR \YooKassa\Request\Payments\TransferDataInterface[] OR \YooKassa\Common\ListObjectInterface |
value | Массив трансферов |
Returns: self - Инстанс билдера запросов
protected initCurrentObject() : \YooKassa\Request\Refunds\CreateRefundRequest
protected initCurrentObject() : \YooKassa\Request\Refunds\CreateRefundRequest
Summary
Возвращает новый объект для сборки.
Details:
- Inherited From: \YooKassa\Request\Refunds\CreateRefundRequestBuilder
Returns: \YooKassa\Request\Refunds\CreateRefundRequest - Собираемый объект запроса к API
Top Namespaces
Reports
This document was automatically generated from source code comments on 2025-07-01 using phpDocumentor
© 2025 YooMoney