Skip to content

Commit 1d8a553

Browse files
committed
Fix examples for the order refund creation.
1 parent 590b2af commit 1d8a553

File tree

1 file changed

+59
-71
lines changed

1 file changed

+59
-71
lines changed

Diff for: source/includes/wp-api-v3/_order-refunds.md

+59-71
Original file line numberDiff line numberDiff line change
@@ -72,41 +72,35 @@ curl -X POST https://example.com/wp-json/wc/v3/orders/723/refunds \
7272
-u consumer_key:consumer_secret \
7373
-H "Content-Type: application/json" \
7474
-d '{
75-
"order_refund": {
76-
"amount": 30,
77-
"line_items": [
78-
{
79-
"id": "111",
80-
"refund_amount": 10,
81-
"refund_tax": [
82-
{
83-
"id" "222",
84-
"refund_amount": 20
85-
}
86-
]
87-
}
88-
]
89-
}
75+
"line_items": [
76+
{
77+
"id": "111",
78+
"refund_amount": 10,
79+
"refund_tax": [
80+
{
81+
"id" "222",
82+
"refund_amount": 20
83+
}
84+
]
85+
}
9086
}'
9187
```
9288

9389
```javascript
9490
const data = {
95-
"order_refund": {
96-
"amount": 30,
97-
"line_items": [
98-
{
99-
"id": "111",
100-
"refund_amount": 10,
101-
"refund_tax": [
102-
{
103-
"id" "222",
104-
"refund_amount": 20
105-
}
106-
]
107-
}
108-
]
109-
}
91+
amount: 30,
92+
line_items: [
93+
{
94+
id: "111",
95+
refund_amount: 10,
96+
refund_tax: [
97+
{
98+
id: "222",
99+
refund_amount: 20
100+
}
101+
]
102+
}
103+
]
110104
};
111105

112106
WooCommerce.post("orders/723/refunds", data)
@@ -121,21 +115,19 @@ WooCommerce.post("orders/723/refunds", data)
121115
```php
122116
<?php
123117
$data = [
124-
'order_refund' => [
125-
'amount' => 30,
126-
'line_items' => [
127-
[
128-
'id' => '111',
129-
'refund_amount' => 10,
130-
'refund_tax' => [
131-
[
132-
'id' => '222',
133-
'amount' => 20
134-
]
118+
'amount' => 30,
119+
'line_items' => [
120+
[
121+
'id' => '111',
122+
'refund_amount' => 10,
123+
'refund_tax' => [
124+
[
125+
'id' => '222',
126+
'amount' => 20
135127
]
136-
]
137-
]
138-
]
128+
]
129+
]
130+
]
139131
];
140132

141133
print_r($woocommerce->post('orders/723/refunds', $data));
@@ -144,43 +136,39 @@ print_r($woocommerce->post('orders/723/refunds', $data));
144136

145137
```python
146138
data = {
147-
"order_refund": {
148-
"amount": 30,
149-
"line_items": [
150-
{
151-
"id": "111",
152-
"refund_amount": 10,
153-
"refund_tax": [
154-
{
155-
"id" "222",
156-
"refund_amount": 20
157-
}
158-
]
159-
}
160-
]
161-
}
139+
"amount": 30,
140+
"line_items": [
141+
{
142+
"id": "111",
143+
"refund_amount": 10,
144+
"refund_tax": [
145+
{
146+
"id" "222",
147+
"refund_amount": 20
148+
}
149+
]
150+
}
151+
]
162152
}
163153

164154
print(wcapi.post("orders/723/refunds", data).json())
165155
```
166156

167157
```ruby
168158
data = {
169-
order_refund: {
170-
amount: 30,
171-
line_items: [
159+
amount: 30,
160+
line_items: [
161+
{
162+
id: "111",
163+
refund_amount: 10,
164+
refund_tax: [
172165
{
173-
id: "111",
174-
refund_amount: 10,
175-
refund_tax: [
176-
{
177-
id "222",
178-
refund_amount: 20
179-
}
180-
]
166+
id "222",
167+
refund_amount: 20
181168
}
182-
]
169+
]
183170
}
171+
]
184172
}
185173

186174
woocommerce.post("orders/723/refunds", data).parsed_response

0 commit comments

Comments
 (0)