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; }