Skip to content

feat(payments): add merchant payment providers, payment intent commands and AWS Billing connectors - #2961

Merged
jariy17 merged 3 commits into
v1.xfrom
feat/payments-psp-intents
Nov 30, 2026
Merged

jariy17 merged 3 commits into
v1.xfrom
feat/payments-psp-intents

Conversation

@jariy17

@jariy17 jariy17 commented Nov 30, 2026

Copy link
Copy Markdown
Contributor

Description

Adds CLI support for AgentCore Payments merchant checkout.

What customers get

  • Merchant payment providers. New headless subcommands
    agentcore add credentials payment stripe | paypal | amazon-pay, with typed flags per provider.
    Secrets are read from file://<path> or stdin (-), or referenced in Secrets Manager with
    --*-secret-reference '{"secretId":"...","jsonKey":"..."}'; raw secret literals are rejected.
    Missing deploy-time fields become .env.local placeholders. Amazon Pay supports the NA and
    EU merchant regions, and checkout supports USD and EUR. Deploy reconciliation keeps
    ownership of credentials that the project manages and leaves externally referenced secrets
    alone. The existing coinbase-cdp and stripe-privy flows, including the flat
    --provider form and the interactive screens, are unchanged.
  • Payment intent commands. agentcore payment intent create | get | create-buyer-approval-url | initiate | authorize | capture | cancel cover all seven payment intent operations. Amounts
    stay decimal strings, pending statuses and structured partner data are passed through
    unchanged, and capture requires a caller-supplied idempotency token.
  • Payment context on invoke. agentcore runtime invoke and agentcore invoke --runtime
    (including --local) accept --payment-user-id, --payment-intent-id,
    --payment-instrument-id and --payment-session-id, which are merged into a JSON
    --payload. Conflicting or ambiguous values are rejected. Without these flags the payload
    bytes are unchanged.
  • AWS Billing connectors. agentcore add payment-connector --aws-billing configures a
    connector that needs no credentials.
  • Docs: docs/payments.md, docs/aws-billing.md, plus README links.

Dependency bumps

  • @aws-sdk/client-bedrock-agentcore ^3.1171.0 -> ^3.1181.0
  • @aws-sdk/client-bedrock-agentcore-control ^3.1171.0 -> ^3.1181.0

3.1181.0 is the first release with the payment intent operations and the Stripe, PayPal and
Amazon Pay credential provider types. bun.lock was regenerated with bun install.

Deploying the new connector types (Stripe, PayPal, Amazon Pay, AWS Billing) also needs a
vended @aws/agentcore-cdk that supports them. That pin bump is not part of this PR; the vended
pin stays at 1.3.0.

This change ports the already-reviewed payments branch onto v1.x. No generated models,
fixtures or command.md are changed.

Related Issue

None.

Documentation PR

Documentation is included in this PR (docs/payments.md, docs/aws-billing.md, README.md,
e2eTest/README.md).

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation update
  • Other (please describe):

Testing

  • I ran bun test: 5508 pass, 6 skip, 0 fail (5514 tests across 335 files)
  • I ran the relevant end-to-end tests with bun run test:e2e, or explained why they are not
    applicable. The new read-only payment e2e suite
    (bunx vitest run --config vitest.payment-e2e.config.ts) needs pre-existing sandbox
    intents and was not run for this PR. The default e2e config excludes it.
  • I ran bun run typecheck against the published 3.1181.0 clients
  • I ran bun run lint:check
  • I ran bun run format:check
  • I ran bun run audit (no vulnerabilities)
  • I ran bun run secrets:check
  • I ran bun run build
  • If I modified src/assets/, I updated affected snapshots: N/A, src/assets/ is unchanged
  • If I re-recorded fixtures or golden files, every change beyond account identifiers is
    explained by this PR: N/A, nothing was re-recorded
  • This PR does not change command.md (the release workflow regenerates it)

src/core/payment.contract.test.ts and src/core/payment.lifecycle.contract.test.ts exercise
real serialization and deserialization through the published clients, including Amazon Pay
NA/EU and EUR pending captures.

Checklist

  • I have read the CONTRIBUTING document
  • I have added any necessary tests that prove my fix is effective or my feature works
  • I have updated the documentation accordingly
  • I have added an appropriate example to the documentation to outline the feature, or no new docs are needed
  • My changes generate no new warnings
  • Any dependent changes have been merged and published

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the
terms of your choice.

@github-actions github-actions Bot added the size/xl PR size: XL label Nov 30, 2026
@agentcore-devx-automation agentcore-devx-automation Bot added claude-security-reviewing Claude Code /security-review in progress agentcore-harness-reviewing AgentCore Harness review in progress labels Nov 30, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Package Tarball

aws-agentcore-1.3.0.tgz

How to install

gh release download pr-2961-tarball --repo aws/agentcore-cli --pattern "*.tgz" --dir /tmp/pr-tarball
npm install -g /tmp/pr-tarball/aws-agentcore-1.3.0.tgz

@agentcore-devx-automation

Copy link
Copy Markdown
Contributor

Claude Security Review: no high-confidence findings. (run)

@agentcore-devx-automation agentcore-devx-automation Bot removed the claude-security-reviewing Claude Code /security-review in progress label Nov 30, 2026
@codecov-commenter

codecov-commenter commented Nov 30, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 99.22360% with 10 lines in your changes missing coverage. Please review.
✅ Project coverage is 96.73%. Comparing base (f54e68c) to head (69604d1).
⚠️ Report is 2 commits behind head on v1.x.

Files with missing lines Patch % Lines
...dlers/project/add/credentials/payment/providers.ts 96.74% 4 Missing ⚠️
src/core/project/backends/cdk/credentials.ts 97.61% 3 Missing ⚠️
src/router/router.tsx 96.77% 2 Missing ⚠️
...payment/intent/create-buyer-approval-url/index.tsx 97.43% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             v1.x    #2961      +/-   ##
==========================================
+ Coverage   96.68%   96.73%   +0.04%     
==========================================
  Files         735      747      +12     
  Lines       61626    62845    +1219     
==========================================
+ Hits        59583    60793    +1210     
- Misses       2043     2052       +9     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

jariy17 added 2 commits November 30, 2026 16:00
…nt intent commands

Add typed provider subcommands under `add credentials payment` for Stripe,
PayPal and Amazon Pay with shared secret value/reference handling and deploy
reconciliation, the seven payment intent operations under `payment intent`,
payment-context flags for runtime and project invocation, and AWS Billing
connector configuration.
3.1181.0 is the first release carrying the payment intent operations and the
Stripe, PayPal and Amazon Pay credential provider types.
@agentcore-devx-automation agentcore-devx-automation Bot removed the agentcore-harness-reviewing AgentCore Harness review in progress label Nov 30, 2026
@jariy17
jariy17 force-pushed the feat/payments-psp-intents branch from 16a2e40 to fb40e48 Compare November 30, 2026 16:08
@github-actions github-actions Bot added size/xl PR size: XL and removed size/xl PR size: XL labels Nov 30, 2026
@agentcore-devx-automation agentcore-devx-automation Bot added the claude-security-reviewing Claude Code /security-review in progress label Nov 30, 2026
@agentcore-devx-automation

Copy link
Copy Markdown
Contributor

Claude Security Review: no high-confidence findings. (run)

@agentcore-devx-automation agentcore-devx-automation Bot removed the claude-security-reviewing Claude Code /security-review in progress label Nov 30, 2026
@jariy17
jariy17 marked this pull request as ready for review November 30, 2026 17:24
@jariy17
jariy17 requested review from a team and tejaskash November 30, 2026 17:24

@tejaskash tejaskash left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Requesting changes for items 1 to 5. Items 6 to 10 are smaller and can follow.

Must fix

  1. Deploy creates the merchant credential provider before it checks that the installed @aws/agentcore-cdk supports the vendor. cdkFeaturesFor in src/core/project/backends/cdk/compatibility.ts:80-90 knows only ContainerLocal and Runtime containerUri. A project with a Stripe, PayPal, AmazonPay or AwsBilling connector passes assertCdkFeatures (cdk.ts:431), creates the provider and records it (cdk.ts:467-480), and then fails synth because the pinned 1.3.0 schema accepts CoinbaseCDP | StripePrivy only (src/assets/cdk/package.json:19). The provider that holds the merchant key stays in AWS and in deployed state. Please add the payment provider types to the feature check so deploy refuses before any Identity write, with a test that asserts zero provider writes. With that in place this PR is safe to merge ahead of the pin bump.

  2. docs/payments.md:73-76 describes rollback behaviour the code does not have. The paragraph says a rejected create "leaves that provider name alone". credentials.ts:393 records the provider in created before the write, and rollback deletes every entry in created. If two deploys target the same provider name, the one whose create is rejected with a conflict deletes the provider the other one created. The rollback code predates this PR, the paragraph is new. Either record after a fulfilled create or correct the paragraph.

  3. The new reference suffixes turn off .env.local encryption for some existing credentials. src/projectSchemas/credential.ts:193-197 adds _PUBLISHABLE_KEY, _MERCHANT_ID, _STORE_ID, _ENVIRONMENT and _AMAZON_PAY_REGION. isSensitiveKey (src/secrets/sensitiveKeys.ts:8) returns false for any key with a reference suffix before it looks at the AGENTCORE_CREDENTIAL_ prefix. An existing API key credential named prod-environment stores its key in AGENTCORE_CREDENTIAL_PROD_ENVIRONMENT, which is no longer encrypted on the next write. The name guard in add/credentials/shared.ts only refuses new names. The same lists also mean agentcore add credentials now refuses names such as stripe-restricted-key for every credential type.

  4. src/core/payment.contract.test.ts and src/core/payment.lifecycle.contract.test.ts cover no CLI code. Both import only the two AWS SDK clients and assert the SDK's own serializer output. They stay green with src/core/payment.tsx and every handler deleted. Please replace them with PaymentClient tests against a faked send, or remove them. docs/payments.md:197-198 points readers at one of them.

  5. --client-token is not validated. capture requires it (capture/index.tsx:27-32) and the shared optional flag (intent/input.ts:27-35) checks only that it is not blank. The model requires 33 to 256 characters of letters, digits and hyphens. capture --client-token cap1 fails with CapturePaymentIntent failed (ValidationException) and nothing in the message or help states the format. lifecycle.test.tsx:144-151 asserts that a token with surrounding spaces is sent unchanged. Please validate the format locally and state it in help.

Smaller items

  1. intent get declares its own flags (get/index.tsx:13-24) instead of the shared scope and intentIdFlag. It does not trim --manager-id or --intent-id and it accepts --agent-name '', unlike the other six commands.
  2. --parent-origin (create-buyer-approval-url/index.tsx:21-28) rejects https://shop.example/, https://Shop.example and https://shop.example:443 because the raw string must equal URL.origin. Normalize instead of comparing.
  3. Two AwsBilling connectors on one manager pass the schema (src/projectSchemas/payment.ts:121-131 checks names only). The second one fails at deploy time.
  4. credentials.test.ts:1408-1427 does not assert the PayPal client ID and environment or the Amazon Pay merchant ID, store ID and environment. Swapping those mappings in credentials.ts:747-774 leaves the tests green.
  5. Error messages lose the useful part: an inline merchant secret prints Invalid payment configuration: secret (providers.ts:79-84), and every --checkout-details mistake (missing file, bad JSON, unknown key) prints one message (intent/input.ts:77-89). Reporting the Zod issue path keeps values out of the output.

Also worth a line in docs/payments.md:94-95: every intent command calls GetPaymentManager, so a role scoped to the data plane actions cannot run them.

The @aws-sdk/client-bedrock-agentcore* bump to ^3.1181.0 is good, typecheck and the payment unit tests pass against it.

- check @aws/agentcore-cdk supports merchant payment credentials and
  AwsBilling connectors before deploy writes any Identity provider
- restore the v1.x credential suffix lists so existing variables such as
  AGENTCORE_CREDENTIAL_PROD_ENVIRONMENT stay encrypted
- validate --client-token locally (33-256 letters, digits or hyphens)
- remove contract tests that exercised only the AWS SDK
- correct the rollback description in docs/payments.md
@github-actions github-actions Bot added size/xl PR size: XL and removed size/xl PR size: XL labels Nov 30, 2026
@agentcore-devx-automation agentcore-devx-automation Bot added the claude-security-reviewing Claude Code /security-review in progress label Nov 30, 2026
@agentcore-devx-automation

Copy link
Copy Markdown
Contributor

Claude Security Review: no high-confidence findings. (run)

@agentcore-devx-automation agentcore-devx-automation Bot removed the claude-security-reviewing Claude Code /security-review in progress label Nov 30, 2026
@jariy17
jariy17 merged commit eb75202 into v1.x Nov 30, 2026
21 checks passed
@jariy17
jariy17 deleted the feat/payments-psp-intents branch November 30, 2026 19:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/xl PR size: XL

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants