Provides SyncAPI and AsyncAPI schema files and the needed code to be used in a Payment Service Provider App.
composer require spryker/app-payment
config/Shared/config_default.php
use Spryker\Shared\AppPayment\AppConstants;
$config[AppConstants::APP_IDENTIFIER] = getenv('APP_IDENTIFIER') ?: 'hello-world';
You can test the AppPayment as usual with Codeception. Before that you need to run some commands:
composer setup
With these commands you've set up the AppPayment and can start the tests
vendor/bin/codecept build
vendor/bin/codecept run
The following plugins can be used inside your Payment Service Provider App.
This plugin provides the routes for the AppPaymentBackendApi module.
- /private/initialize-payment - Used from the Tenant side to initialize a payment.
- \Spryker\Glue\AppPaymentBackendApi\Plugin\AppKernel\PaymentConfigurationValidatorPlugin
- \Spryker\Zed\AppPayment\Communication\Plugin\AppKernel\DeleteTenantPaymentsConfigurationAfterDeletePlugin
- \Spryker\Zed\AppPayment\Communication\Plugin\AppKernel\SendAddPaymentMethodMessageConfigurationAfterSavePlugin
- \Spryker\Zed\AppPayment\Communication\Plugin\AppKernel\SendDeletePaymentMethodMessageConfigurationAfterDeletePlugin
- \Spryker\Zed\AppPayment\Communication\Plugin\AppWebhook\PaymentWebhookHandlerPlugin
- \Spryker\Zed\AppPayment\Communication\Plugin\MessageBroker\CancelPaymentMessageHandlerPlugin
- \Spryker\Zed\AppPayment\Communication\Plugin\MessageBroker\CapturePaymentMessageHandlerPlugin
- \Spryker\Zed\AppPayment\Communication\Plugin\MessageBroker\RefundPaymentMessageHandlerPlugin
- \Spryker\Zed\AppPayment\Communication\Plugin\MessageBrokerAws\ConsumerIdHttpChannelMessageReceiverRequestExpanderPlugin
Add this to your project configuration:
$config[MessageBrokerConstants::MESSAGE_TO_CHANNEL_MAP] =
$config[MessageBrokerAwsConstants::MESSAGE_TO_CHANNEL_MAP] = [
PaymentAuthorizedTransfer::class => 'payment-events',
PaymentAuthorizationFailedTransfer::class => 'payment-events',
PaymentCapturedTransfer::class => 'payment-events',
PaymentCaptureFailedTransfer::class => 'payment-events',
PaymentRefundedTransfer::class => 'payment-events',
PaymentRefundFailedTransfer::class => 'payment-events',
PaymentCanceledTransfer::class => 'payment-events',
PaymentCancellationFailedTransfer::class => 'payment-events',
CancelPaymentTransfer::class => 'payment-commands',
CapturePaymentTransfer::class => 'payment-commands',
RefundPaymentTransfer::class => 'payment-commands',
AddPaymentMethodTransfer::class => 'payment-method-commands',
DeletePaymentMethodTransfer::class => 'payment-method-commands',
PaymentCreatedTransfer::class => 'payment-events',
// App event
AppConfigUpdatedTransfer::class => 'app-events',
];
$config[MessageBrokerConstants::CHANNEL_TO_TRANSPORT_MAP] = [
'app-events' => MessageBrokerAwsConfig::HTTP_TRANSPORT,
'payment-events' => MessageBrokerAwsConfig::HTTP_TRANSPORT,
'payment-method-commands' => MessageBrokerAwsConfig::HTTP_TRANSPORT,
'payment-commands' => MessageBrokerAwsConfig::SQS_TRANSPORT,
];
$config[MessageBrokerAwsConstants::CHANNEL_TO_SENDER_TRANSPORT_MAP] = [
'app-events' => MessageBrokerAwsConfig::HTTP_TRANSPORT,
'payment-events' => MessageBrokerAwsConfig::HTTP_TRANSPORT,
'payment-method-commands' => MessageBrokerAwsConfig::HTTP_TRANSPORT,
];
$config[MessageBrokerAwsConstants::CHANNEL_TO_RECEIVER_TRANSPORT_MAP] = [
'payment-commands' => MessageBrokerAwsConfig::SQS_TRANSPORT,
];