Broadleaf Microservices
  • v1.0.0-latest-prod

APS Environment Setup

Prerequisites

Adding the Amazon Payment Services Dependency

Once you have registered a merchant account with Amazon Pay Services, add the Broadleaf Amazon Pay Services Maven dependency to your PaymentTransactionServices project.

<dependency>
    <groupId>com.broadleafcommerce.microservices</groupId>
    <artifactId>broadleaf-amazonpaymentservices</artifactId>
</dependency>
Note
The dependency’s version will be pulled from the Broadleaf release train pom.xml.

Configuring Amazon Payment Services

Via the Amazon Payment Services dashboard, the following configurations should be set: 1. Return Url Type: POST 2. Response Type: JSON 3. Downgrade CVC: NO

Webhooks are used as a secondary means of gathering transaction results, in case they’re unable to be communicated synchronously when the transaction is requested. Additionally, APS will occasionally communicate that transaction results are "pending" and they’ll notify us of the result via their Notification Feedback URL.

Via the Amazon Payment Services dashboard add Direct Transaction Feedback and Notification URLs:

{your_url_to_payment_transaction_services}/webhooks/AMAZON_PAYMENT_SERVICES?tenantId={your_tenant_id}

Other Amazon Payment Services configurations to consider: 1. Origin IP - Used to restrict ability to call APS servers 2. Origin URL - Used to restrict ability to call APS servers

Configuring Your Integration

Next, you will need to gather the following configuration properties from your merchant account on Amazon Pay Services and add them to your application via system properties.

  1. Merchant ID

  2. Access Code

  3. Signature Request SHA Phrase

  4. Signature Response SHA Phrase

  5. Signature Algorithm

broadleaf.amazonpaymentservices.merchant-id={Your merchant id}
broadleaf.amazonpaymentservices.access-code={Your access code}
broadleaf.amazonpaymentservices.default-language={Your application's default language} (Default used if not provided in payment request)
broadleaf.amazonpaymentservices.default-return-url={Your application's default return URL} (Default used if not provided in payment request)
broadleaf.amazonpaymentservices.signature.request-sha-phrase={Your request sha phrase}
broadleaf.amazonpaymentservices.signature.response-sha-phrase={Your response sha phrase}
broadleaf.amazonpaymentservices.signature.algorithm={Your signature algorithm} (Defaulted to SHA-512. Possible values are [HmacSHA256, HmacSHA512, SHA-256, SHA-512].)

Cart Operation Service Configuration

Add the following properties to declare the AMAZON_PAYMENT_SERVICES gateway as an available payment method.

broadleaf:
  cartoperation:
    service:
      checkout:
        checkout-payment-method-options:
          - payment-method-type: CREDIT_CARD
            payment-method-gateway-type: AMAZON_PAYMENT_SERVICES

AMAZON_PAYMENT_SERVICES should be added to the following property to declare when transactions for this gateway should be executed, relative to other gateways, during checkout processing.

broadleaf:
  cartoperation:
    service:
      checkout:
        payment-gateway-priorities:
          - ...
          - AMAZON_PAYMENT_SERVICES
          - ...

By default, Authorize transactions are executed by CartOps during checkout. If you wish to execute AuthorizeAndCapture transactions instead, define the following property:

broadleaf:
  cartoperation:
    service:
      checkout:
        checkout-transaction-types:
          AMAZON_PAYMENT_SERVICES: AUTHORIZE_AND_CAPTURE
Note

This property is application-discriminated, allowing different values to be provided on a per-tenant or per-application basis using the following property paths:

  • broadleaf.cartoperation.service.checkout.tenant.mytenant.checkout-transaction-types.AMAZON_PAYMENT_SERVICES=AUTHORIZE_AND_CAPTURE

  • broadleaf.cartoperation.service.checkout.application.myapplication.checkout-transaction-types.AMAZON_PAYMENT_SERVICES=AUTHORIZE_AND_CAPTURE

"mytenant" & "myapplication" being the Broadleaf Tenant and Application ids.

Configuration for OrderOperationServices

AMAZON_PAYMENT_SERVICES should be added to the following property to declare when ReverseAuthorize or Refund transactions for this gateway should be executed, relative to other gateways, when cancelling a fulfillment.

broadleaf:
  orderoperation:
    service:
      payment:
        cancel-payment-gateway-priorities:
          - ...
          - AMAZON_PAYMENT_SERVICES
          - ...

AMAZON_PAYMENT_SERVICES should be added to the following property to declare when Capture transactions for this gateway should be executed, relative to other gateways, when capturing payment for a fulfillment.

broadleaf:
  orderoperation:
    service:
      payment:
        capture-payment-gateway-priorities:
          - ...
          - AMAZON_PAYMENT_SERVICES
          - ...

AMAZON_PAYMENT_SERVICES should be added to the following property to declare when Refund transactions for this gateway should be executed, relative to other gateways, when refunding payment for a fulfillment return.

broadleaf:
  orderoperation:
    service:
      payment:
        refund-payment-gateway-priorities:
          - ...
          - AMAZON_PAYMENT_SERVICES
          - ...