Zwroty płatności
Merchant może zainicjować zwrot całości lub części płatności za zamówienie klienta. Środki zostaną zwrócone tą samą metodą płatności, której użył klient.
OpenApp przyjmie zlecenie zwrotu od merchanta nawet jeśli wartość zlecenia przekracza aktualne saldo konta OA merchanta. W takim przypadku realizacja zwrotu będzie oczekiwać na dostępność odpowiednich środków na koncie.
Zlecenia zwrotu wymagają unikalnego caseId, który musi być unikalny dla danego zamówienia (różne zamówienia mogą mieć takie samo caseId). Jeśli dany caseId był już użyty dla tego zamówienia, OpenApp odrzuci zlecenie jako duplikat.
Żądanie
Zlecenie zwrotu jest wykonywane przez żądanie POST na następujący endpoint:
POST {{OpenAppUrl}}/merchant/v1/orders/refund
Treść żądania zawiera informacje o zamówieniu, kwotę oraz opcjonalnie konkretne produkty, dla których wykonywany jest zwrot:
- Żądanie
- Schemat
{
"oaOrderId": "OA12345678901234",
"shopOrderId": "WS1213ASDZXC231A",
"currency": "PLN",
"amount": 1999,
"reason": "RETURNED",
"caseId": "RET-123434",
"notes": "Returned without charger cables.",
"products": [
{
"id": "id123",
"refundedQuantity": 1,
"amount": 1999
}
]
}
oaOrderIdstringWymaganeThe OpenApp order ID.
shopOrderIdstringWymaganeThe unique ID of the order.
maxLength: 36
currencystringWymaganeamountintegerWymaganeThe refunded amount. Price is expressed as the number (integer) of 1/100s of the price.
minimum: 0
caseIdstringWymaganeReference ID of the claim made by the user or the refund ID. Must be unique for the order.
maxLength: 36
reasonenumWymaganeReason for the refund
Możliwe wartości: OTHERRETURNEDWARRANTY
notesstringOpcjonalneOptional explanation of the refund
maxLength: 500
productstablica typu RefundProductOpcjonalneOptional list of products that were refunded.
Pokaż parametry podrzędneUkryj parametry podrzędne4
idstringWymaganeThe unique ID of the product.
maxLength: 36
refundedQuantitynumberWymaganeThe number of refunded products.
minimum: 0
amountintegerWymaganeThe refunded amount for this product. Price is expressed as the number (integer) of 1/100s of the price.
minimum: 0
notesstringOpcjonalneOptional explanation of the refund
maxLength: 500
Surowy schemat JSON
{
"additionalProperties": false,
"type": "object",
"properties": {
"oaOrderId": {
"description": "The OpenApp order ID.",
"type": "string",
"title": "oaOrderId"
},
"shopOrderId": {
"description": "The unique ID of the order.",
"maxLength": 36,
"type": "string",
"title": "shopOrderId"
},
"currency": {
"type": "string",
"title": "currency"
},
"amount": {
"description": "The refunded amount. Price is expressed as the number (integer) of 1/100s of the price.",
"minimum": 0,
"type": "integer",
"title": "amount"
},
"caseId": {
"description": "Reference ID of the claim made by the user or the refund ID. Must be unique for the order.",
"maxLength": 36,
"type": "string",
"title": "caseId"
},
"reason": {
"description": "Reason for the refund",
"enum": [
"OTHER",
"RETURNED",
"WARRANTY"
],
"type": "string",
"title": "reason"
},
"notes": {
"description": "Optional explanation of the refund",
"maxLength": 500,
"type": "string",
"title": "notes"
},
"products": {
"description": "Optional list of products that were refunded.",
"type": "array",
"items": {
"$ref": "#/definitions/RefundProduct"
},
"title": "products"
}
},
"required": [
"amount",
"caseId",
"currency",
"oaOrderId",
"reason",
"shopOrderId"
],
"definitions": {
"RefundProduct": {
"title": "RefundProduct",
"type": "object",
"properties": {
"id": {
"description": "The unique ID of the product.",
"maxLength": 36,
"type": "string",
"title": "id"
},
"refundedQuantity": {
"description": "The number of refunded products.",
"minimum": 0,
"type": "number",
"title": "refundedQuantity"
},
"amount": {
"description": "The refunded amount for this product. Price is expressed as the number (integer) of 1/100s of the price.",
"minimum": 0,
"type": "integer",
"title": "amount"
},
"notes": {
"description": "Optional explanation of the refund",
"maxLength": 500,
"type": "string",
"title": "notes"
}
},
"required": [
"amount",
"id",
"refundedQuantity"
]
}
},
"$schema": "http://json-schema.org/draft-07/schema#"
}
Odpowiedź
W odpowiedzi OpenApp potwierdza przyjęcie zlecenia zwrotu. Realizacja zwrotu do klienta będzie widoczna w raporcie rozliczeniowym sklepu.
Błędy
| Nazwa błędu | Kod |
|---|---|
OrderNotFoundException | 404 |
MerchantOrderOwnershipException | 404 |
RefundExistsException | 409 |
RefundTooMuchException | 400 |
MerchantWalletNotFoundException | 404 |
UserNotFoundException | 404 |