Split payment POC: prerequisites and environment setup

Complete every step in this tutorial before you run any of the build prompts. Missing a single step is the most common reason the flow breaks mid-tutorial.

1. Adobe Commerce requirements

  • Adobe Commerce 2.4.5 or later (on-premises or Commerce Cloud)
  • Git access to the Commerce project (you add a module under app/code/)
  • Access to Commerce Admin

Commerce Cloud only: enable I/O eventing

Add the following to .magento.env.yaml and deploy before you add the module:

stage:
  global:
    ENABLE_EVENTING: true

Warning: This deploy must finish successfully before the I/O Event module dependency can resolve.

2. Commerce Admin configuration

Do these steps before anything else. The checkout JavaScript depends on exact string matches.

2a. Enable Cash on Delivery with the exact title

Stores > Configuration > Sales > Payment Methods > Cash On Delivery Payment

  • Enabled: Yes
  • Title: Cash (this exact string is what the checkout JavaScript matches)

Note: If your store uses a different cash-on-delivery (COD) implementation or title, adjust payment-method-helper.js in the Commerce module.

2b. Enable store credit

Stores > Configuration > Customers > Customer Configuration > Store Credit Options

  • Enable Store Credit Functionality: Yes

2c. Add store credit to your test customer

Customers > All Customers > [your test customer] > Store Credit > Update Balance

Add at least $50 in store credit. You will test with an order under $100 total.

2d. Create the Commerce integration

System > Integrations > Add New Integration

  • Name: Split Payment App Builder (or any name you prefer)

  • On the API tab, grant at minimum:

    • Magento_Sales::actions (required for the cash-received endpoint)
    • Magento_Sales::cancel (required for the cash-decline endpoint)
    • Quote or cart management (full or a relevant subset)
    • Customer balance (full or a relevant subset)

Select Save, then Activate.

Copy all four values; they are only shown once:

Value
Environment variable
Consumer Key
COMMERCE_CONSUMER_KEY
Consumer Secret
COMMERCE_CONSUMER_SECRET
Access Token
COMMERCE_ACCESS_TOKEN
Access Token Secret
COMMERCE_ACCESS_TOKEN_SECRET

Store these values securely. You need them in every App Builder .env file.

3. Adobe Developer Console and App Builder

  • Access to an Adobe Developer Console organization
  • An App Builder project (new or one you reuse)
  • A workspace configured; the prompts assume Stage
  • Adobe I/O Events added as a service to the workspace
  • Commerce connected as an event provider for the workspace

The event code used in the proof of concept is: com.adobe.commerce.observer.sales_order_place_before

If you have not connected Commerce as an event provider, see Configure Commerce to emit events to Adobe I/O in the Commerce Extensibility guide.

4. Local development environment

# Required versions
node --version    # 18.x or later
npm --version     # any recent version

# Adobe I/O CLI
npm install -g @adobe/aio-cli

# Authenticate
aio login

# Select your project and workspace
aio app use
# Confirm the org, project, and workspace shown are correct

5. Two project directories to know

This tutorial uses two separate directory roots. Keep them separate.

Commerce project root (your Magento git repository):

<commerce-root>/
└── app/code/Client/SplitPayment/   ← Module goes here

App Builder project root (the split-payment-orchestrator folder from the source package, or a new project you create):

split-payment-orchestrator/
├── app.config.yaml
├── package.json
├── .env                            ← Copy from .env.example, then fill in
└── actions/

6. entity_id compared to increment_id

Always use entity_id (the numeric database ID), not increment_id (for example 000000042), in REST calls.

Find entity_id from the Commerce Admin order URL:

/admin/sales/order/view/order_id/42/   →   entity_id = 42

Or from the simulation script:

node scripts/simulate-split-payment.mjs show 42

7. The $100 threshold

The split payment UI and threshold guard target orders $100.00 or less. The flow behaves as follows:

  • At or below $100: the split payment UI appears; the customer can set a cash plus store credit split
  • Above $100: CheckoutPlugin throws an error at the payment step

To test, build a cart whose subtotal, shipping, and tax are less than or equal to $100 (for example, a product under $90 so shipping and tax still fit under the cap).

The threshold is stored in:

  • Commerce config: split_payment/general/threshold (default 100 in etc/config.xml)
  • App Builder environment: PAYMENT_THRESHOLD=100 (must match Commerce)

8. Fastly (Commerce Cloud only)

App Builder actions call Commerce over REST (/rest/V1/split-payment/orders/...). If your Commerce Cloud project uses Fastly with IP allowlisting, the App Builder runtime egress IP addresses must be allowlisted.

How to check: Run the simulation script first (direct curl with OAuth signing). If that works but the App Builder action returns 403, Fastly is likely blocking the request.

Use Adobe’s current documentation for App Builder egress IP ranges and add them to your Fastly configuration as needed.

Verification checklist

Before you start the build prompts, confirm the following:

  • [ ] Commerce version is 2.4.5 or later
  • [ ] I/O eventing is enabled (Commerce Cloud) and deployed
  • [ ] Cash on delivery is enabled with the title set exactly to Cash
  • [ ] Store credit is enabled
  • [ ] The test customer has at least $50 store credit
  • [ ] The Commerce integration is created and activated, and all four OAuth values are saved
  • [ ] The App Builder project has the I/O Events service and the Commerce event provider configured
  • [ ] aio login is complete and the correct workspace is selected with aio app use
  • [ ] Node.js 18 or later is installed and the aio CLI is installed
  • [ ] .env files are prepared per Split payment POC: environment variables reference (and your source package, if you use one)

All resources in this series

Reference resources

recommendation-more-help
commerce-learn-help-home