sumup / sumup-ecom-php-sdk

SumUp eCom PHP SDK
Other
41 stars 18 forks source link

Missing support of create checkout with merchant_code #28

Open ptrovatelli opened 3 years ago

ptrovatelli commented 3 years ago

Hello, According to the SDK documentation (https://developer.sumup.com/docs/php-sdk/), the checkout needs creating with :

$checkoutResponse = $checkoutService->create($amount, $currency, $checkoutRef, $payToEmail);

However, according to the rest API, using the payToEmail field is discouraged and the mandatory merchant_code field should be used instead when creating checkouts: see https://developer.sumup.com/rest-api/#tag/Checkouts/paths/~1checkouts/post

pay_to_email | string <email>  Email address of the registered user (merchant) to whom the payment is made. It is highly recommended to use merchant_code instead of pay_to_email.

Looking at the SDK source code, there's no way to use merchant_code. See https://github.com/sumup/sumup-ecom-php-sdk/blob/master/src/SumUp/Services/Checkouts.php

public function create($amount, $currency, $checkoutRef, $payToEmail, $description = '', $payFromEmail = null, $returnURL = null)
    {

How bad is it to use payToEmail? Shouldn't the sdk evolve to take into account the API specifications? Thanks!

multikitty commented 1 year ago

You can use $customService->request($method, $relativePath, $payload); instead of $checkoutService->create($amount, $currency, $checkoutRef, $payToEmail);