芝麻web文件管理V1.00
编辑当前文件:/home/qrafawbu/reginaeigbe.com/folder/admin/tmp/app/Services/PaymentGateway/Paypal.php
client = new PayPalHttpClient($environment); } /** * Make initialize payment request * * @param array $body * @return array|object|string * @throws HttpException * @throws IOException */ public function initializePayment(array $body): array|object|string { $request = new OrdersCreateRequest(); $request->prefer('return=representation'); $request->body = $body; try { $response = $this->client->execute($request); return $response->result; } catch (\Exception $exception){ throw new \Exception($exception->getMessage()); } } /** * Verify payment * * @param string $token * @return array|object|string * @throws HttpException * @throws IOException */ public function verifyPayment(string $token): array|object|string { $ordersCaptureRequest = new OrdersCaptureRequest($token); $ordersCaptureRequest->prefer('return=representation'); try { $response = $this->client->execute($ordersCaptureRequest); return $response->result; } catch (\Exception $exception){ throw new \Exception($exception->getMessage()); } } }