← All changes
|
app/Modules/PaymentMethods/PayPalGateway/API/API.php
+3
-1
1.6.0
→
1.6.5
View file →
| @@ -128,9 +128,11 @@ | ||
| 128 | 128 | |
| 129 | 129 | $response = wp_remote_post($paypal_api_url, [ |
| 130 | 130 | 'headers' => $headers, |
| 131 | 131 | 'method' => $method, |
| 132 | - 'body' => json_encode($args) | |
| 132 | + // An empty array encodes to a literal [], which PayPal rejects | |
| 133 | + // with MALFORMED_REQUEST_JSON — it requires a {} body. | |
| 134 | + 'body' => json_encode($args ?: new \stdClass()) | |
| 133 | 135 | ]); |
| 134 | 136 | |
| 135 | 137 | if (is_wp_error($response)) { |
| 136 | 138 | return new \WP_Error('general_error', $response->get_error_message(), $response); |