php-sdk
php-sdk copied to clipboard
How to update the allowed payment methods of a created transaction
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
);