php-sdk icon indicating copy to clipboard operation
php-sdk copied to clipboard

How to update the allowed payment methods of a created transaction

Open JainJayan opened this issue 2 years ago • 1 comments

If I want to exclude TWINT from a created transaction. I am not sure how to convert the updated transaction ($transactionCreate->setAllowedPaymentMethodConfigurations($methods);) to a pending transaction that I can pass to the update() function.

$configurations = $apiClient->getTransactionService()->fetchPaymentMethods($spaceId(), $transaction->getId(), "lightbox");
$methods = [];

foreach ($configurations as $configuration) {
    if ($configuration->getName() !== "TWINT") {
        $methods[] = $configuration->getId();
    }
}

$transactionCreate->setAllowedPaymentMethodConfigurations($methods);
$transaction = $apiClient->getTransactionService()->update(
    $spaceId,
    $transaction
);

JainJayan avatar Aug 24 '23 14:08 JainJayan