From 37719156316316f839b7c1ad6d34f458a121de97 Mon Sep 17 00:00:00 2001 From: Anton Voitovych Date: Tue, 19 Dec 2023 09:45:41 +0100 Subject: [PATCH] Introduces a possibility to set redirect_url parameter within a checkout --- composer.json | 2 +- src/SumUp/Services/Checkouts.php | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index 0bd5385..73079a6 100644 --- a/composer.json +++ b/composer.json @@ -3,7 +3,7 @@ "description": "SumUp eCom SDK for PHP", "type": "library", "license": "proprietary", - "version": "1.1.0", + "version": "1.2.0", "keywords": ["sumup", "sdk", "payment processing", "ecommerce", "payment", "checkout"], "homepage": "https://developer.sumup.com", "authors": [ diff --git a/src/SumUp/Services/Checkouts.php b/src/SumUp/Services/Checkouts.php index 9492ccc..3c63dd9 100644 --- a/src/SumUp/Services/Checkouts.php +++ b/src/SumUp/Services/Checkouts.php @@ -51,6 +51,7 @@ public function __construct(SumUpHttpClientInterface $client, AccessToken $acces * @param string $description * @param null $payFromEmail * @param null $returnURL + * @param null $redirectURL * * @return \SumUp\HttpClients\Response * @@ -60,7 +61,7 @@ public function __construct(SumUpHttpClientInterface $client, AccessToken $acces * @throws \SumUp\Exceptions\SumUpAuthenticationException * @throws \SumUp\Exceptions\SumUpSDKException */ - public function create($amount, $currency, $checkoutRef, $payToEmail, $description = '', $payFromEmail = null, $returnURL = null) + public function create($amount, $currency, $checkoutRef, $payToEmail, $description = '', $payFromEmail = null, $returnURL = null, $redirectURL = null) { if (empty($amount) || !is_numeric($amount)) { throw new SumUpArgumentException(ExceptionMessages::getMissingParamMsg('amount')); @@ -87,6 +88,9 @@ public function create($amount, $currency, $checkoutRef, $payToEmail, $descripti if (isset($returnURL)) { $payload['return_url'] = $returnURL; } + if (isset($redirectURL)) { + $payload['redirect_url'] = $redirectURL; + } $path = '/v0.1/checkouts'; $headers = array_merge(Headers::getStandardHeaders(), Headers::getAuth($this->accessToken)); return $this->client->send( 'POST', $path, $payload, $headers);