From 3f06ffc9463b7c66e7ad412519ff07de74fb6cfe Mon Sep 17 00:00:00 2001 From: Damien TUPINIER Date: Tue, 16 Jul 2024 12:33:33 +0200 Subject: [PATCH] Change to Checkout creation: replace pay_to_email with the use of merchant_code --- src/SumUp/Services/Checkouts.php | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/SumUp/Services/Checkouts.php b/src/SumUp/Services/Checkouts.php index 3c63dd9..da0906c 100644 --- a/src/SumUp/Services/Checkouts.php +++ b/src/SumUp/Services/Checkouts.php @@ -61,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, $redirectURL = null) + public function create($amount, $currency, $checkoutRef, $merchantCode, $description = '', $payFromEmail = null, $returnURL = null, $redirectURL = null) { if (empty($amount) || !is_numeric($amount)) { throw new SumUpArgumentException(ExceptionMessages::getMissingParamMsg('amount')); @@ -72,16 +72,15 @@ public function create($amount, $currency, $checkoutRef, $payToEmail, $descripti if (empty($checkoutRef)) { throw new SumUpArgumentException(ExceptionMessages::getMissingParamMsg('checkout reference id')); } - if (empty($payToEmail)) { - throw new SumUpArgumentException(ExceptionMessages::getMissingParamMsg('pay to email')); - } + $payload = [ 'amount' => $amount, 'currency' => $currency, + 'merchant_code' => $merchantCode, 'checkout_reference' => $checkoutRef, - 'pay_to_email' => $payToEmail, 'description' => $description ]; + if (isset($payFromEmail)) { $payload['pay_from_email'] = $payFromEmail; }