PHP code example of spryker / app-payment
1. Go to this page and download the library: Download spryker/app-payment library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
spryker / app-payment example snippets
public function configurePaymentMethods(PaymentMethodConfigurationRequestTransfer $paymentMethodConfigurationRequestTransfer): PaymentMethodConfigurationResponseTransfer
{
$appConfigTransfer = $paymentMethodConfigurationRequestTransfer->getAppConfig();
// Contains ['bar'] which was the only one selected through the configuration page
$configuredPaymentMethods = $appConfigTransfer->getPaymentMethods();
// These are all methods you can provide which are configurable through the AppStore Catalogs App configuration page
$availablePaymentMethods = [
'foo',
'bar',
'baz',
];
$paymentMethodConfigurationResponseTransfer = new PaymentMethodConfigurationResponseTransfer();
foreeach ($availablePaymentMethods as $paymentMethodName) {
if (!isset($configuredPaymentMethods[$paymentMethodName])) {
continue;
}
$paymentMethodTransfer = new PaymentMethodTransfer();
$paymentMethodTransfer
->setName($paymentMethodName)
->setProviderName('PaymentProviderName');
$paymentMethodConfigurationResponseTransfer->addPaymentMethod($paymentMethodTransfer);
}
return $paymentMethodConfigurationResponseTransfer;
}