Navigation

Amazon Pay - Configuration

Please refer to config/Shared/config.dist.php for example of module configuration.

To setup the Amazon Pay initial configuration, use the credentials you received after registering as an Amazon seller:


$config[AmazonPayConstants::CLIENT_ID] = '';
$config[AmazonPayConstants::CLIENT_SECRET] = '';
$config[AmazonPayConstants::SELLER_ID] = '';
$config[AmazonPayConstants::ACCESS_KEY_ID] = '';
$config[AmazonPayConstants::SECRET_ACCESS_KEY] = '';

Next, specify your country and shop:


$config[AmazonPayConstants::REGION] = 'DE';
$config[AmazonPayConstants::STORE_NAME] = 'The Shop';
        

For development purposes sandbox mode must be enabled:

$config[AmazonPayConstants::SANDBOX] = true;

The ERROR_REPORT_LEVEL parameter is used for internal purposes and specifies the log verbosity level.

There are three options:

  1. Log all API responses.
  2. Log errors only.
  3. Disable logging.
$config[AmazonPayConstants::ERROR_REPORT_LEVEL] = 'ERRORS_ONLY';

In order to configure look-and-feel of Amazon Pay button, you may use following config values:


$config[AmazonPayConstants::WIDGET_BUTTON_TYPE] = AmazonPayConstants::WIDGET_BUTTON_TYPE_FULL;
$config[AmazonPayConstants::WIDGET_BUTTON_SIZE] = AmazonPayConstants::WIDGET_BUTTON_SIZE_MEDIUM;
$config[AmazonPayConstants::WIDGET_BUTTON_COLOR] = AmazonPayConstants::WIDGET_BUTTON_COLOR_DARK_GRAY;
        

According to Amazon Pay restrictions, a module can run either on a localhost domain or on SSL. If it is not possible to use localhost, then SSL should be installed and configured. For testing purposes, register a test account in the dashboard.

OMS Configuration

Please activate the following processes. If you plan to use only one, then drop the other one.


$config[OmsConstants::ACTIVE_PROCESSES][] = 'AmazonPayPaymentAsync01';
$config[OmsConstants::ACTIVE_PROCESSES][] = 'AmazonPayPaymentSync01';
        

Default implementation for commands and options should be added to Pyz/Zed/Oms/OmsDependencyProvider.php

  1. Commands:
    
    $container->extend(
        OmsDependencyProvider::COMMAND_PLUGINS,
        function (CommandCollectionInterface $commandCollection) {
            $commandCollection
                ->add(new CancelOrderCommandPlugin(), 'AmazonPay/CancelOrder')
                ->add(new CloseOrderCommandPlugin(), 'AmazonPay/CloseOrder')
                ->add(new RefundOrderCommandPlugin(), 'AmazonPay/RefundOrder')
                ->add(new ReauthorizeExpiredOrderCommandPlugin(), 'AmazonPay/ReauthorizeExpiredOrder')
                ->add(new CaptureCommandPlugin(), 'AmazonPay/Capture')
                ->add(new UpdateSuspendedOrderCommandPlugin(), 'AmazonPay/UpdateSuspendedOrder')
                ->add(new UpdateNewOrderStatusCommandPlugin(), 'AmazonPay/UpdateNewOrderStatus')
                ->add(new UpdateAuthorizationStatusCommandPlugin(), 'AmazonPay/UpdateAuthorizationStatus')
                ->add(new UpdateCaptureStatusCommandPlugin(), 'AmazonPay/UpdateCaptureStatus')
                ->add(new UpdateRefundStatusCommandPlugin(), 'AmazonPay/UpdateRefundStatus');
    
            return $commandCollection;
        }
    );
                    
  2. Conditions:
    
    $container->extend(OmsDependencyProvider::CONDITION_PLUGINS, function (ConditionCollectionInterface $conditionCollection) {
        $conditionCollection
            ->add(new IsClosedConditionPlugin(), 'AmazonPay/IsClosed')
            ->add(new IsCloseAllowedConditionPlugin(), 'AmazonPay/IsCloseAllowed')
    
            ->add(new IsCancelledConditionPlugin(), 'AmazonPay/IsCancelled')
            ->add(new IsCancelNotAllowedConditionPlugin(), 'AmazonPay/IsCancelNotAllowed')
            ->add(new IsCancelledOrderConditionPlugin(), 'AmazonPay/IsOrderCancelled')
    
            ->add(new IsAuthOpenConditionPlugin(), 'AmazonPay/IsAuthOpen')
            ->add(new IsAuthDeclinedConditionPlugin(), 'AmazonPay/IsAuthDeclined')
            ->add(new IsAuthPendingConditionPlugin(), 'AmazonPay/IsAuthPending')
            ->add(new IsAuthSuspendedConditionPlugin(), 'AmazonPay/IsAuthSuspended')
            ->add(new IsAuthExpiredConditionPlugin(), 'AmazonPay/IsAuthExpired')
            ->add(new IsAuthClosedConditionPlugin(), 'AmazonPay/IsAuthClosed')
            ->add(new IsAuthTransactionTimedOutConditionPlugin(), 'AmazonPay/IsAuthTransactionTimedOut')
            ->add(new IsAuthSuspendedConditionPlugin(), 'AmazonPay/IsPaymentMethodChanged')
    
            ->add(new IsCaptureCompletedConditionPlugin(), 'AmazonPay/IsCaptureCompleted')
            ->add(new IsCaptureDeclinedConditionPlugin(), 'AmazonPay/IsCaptureDeclined')
            ->add(new IsCapturePendingConditionPlugin(), 'AmazonPay/IsCapturePending')
    
            ->add(new IsRefundCompletedConditionPlugin(), 'AmazonPay/IsRefundCompleted')
            ->add(new IsRefundDeclinedConditionPlugin(), 'AmazonPay/IsRefundDeclined')
            ->add(new IsRefundPendingConditionPlugin(), 'AmazonPay/IsRefundPending');
    
        return $conditionCollection;
    });
                    

All commands and conditions are in SprykerEco\Zed\AmazonPay\Communication\Plugin\Oms\ namespace.

IPN Configuration

In order to allow everyone to send push notifications, please extend config_default.XXX.php for desired environments:


$config[AclConstants::ACL_USER_RULE_WHITELIST][] = [
    'bundle' => 'amazonpay',
    'controller' => 'ipn',
    'action' => 'endpoint',
    'type' => 'allow',
];
        

Depending on your SSL configuration, you may have to extend as well:


$config[ApplicationConstants::ZED_SSL_EXCLUDED][] = 'amazonpay/ipn/endpoint';
$config[ApplicationConstants::YVES_SSL_EXCLUDED]['aie'] = '/amazonpay/ipn/endpoint';
        

 

See also:

 

Last review date: Nov. 13th, 2017