Skip to content

Commit

Permalink
Introduces a possibility to set redirect_url parameter within a checkout
Browse files Browse the repository at this point in the history
  • Loading branch information
avoitovych committed Dec 19, 2023
1 parent 0d9aa0d commit 3771915
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": [
Expand Down
6 changes: 5 additions & 1 deletion src/SumUp/Services/Checkouts.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
*
Expand All @@ -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'));
Expand All @@ -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);
Expand Down

0 comments on commit 3771915

Please sign in to comment.