Repository navigation
feat(payments): add merchant payment providers, payment intent commands and AWS Billing connectors - #2961
Conversation
Package TarballHow to installgh 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 |
|
Claude Security Review: no high-confidence findings. (run) |
Codecov Report❌ Patch coverage is 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. 🚀 New features to boost your workflow:
|
…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.
16a2e40 to
fb40e48
Compare
|
Claude Security Review: no high-confidence findings. (run) |
tejaskash
left a comment
There was a problem hiding this comment.
Requesting changes for items 1 to 5. Items 6 to 10 are smaller and can follow.
Must fix
-
Deploy creates the merchant credential provider before it checks that the installed
@aws/agentcore-cdksupports the vendor.cdkFeaturesForinsrc/core/project/backends/cdk/compatibility.ts:80-90knows onlyContainerLocalandRuntime containerUri. A project with a Stripe, PayPal, AmazonPay or AwsBilling connector passesassertCdkFeatures(cdk.ts:431), creates the provider and records it (cdk.ts:467-480), and then fails synth because the pinned 1.3.0 schema acceptsCoinbaseCDP | StripePrivyonly (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. -
docs/payments.md:73-76describes rollback behaviour the code does not have. The paragraph says a rejected create "leaves that provider name alone".credentials.ts:393records the provider increatedbefore the write, and rollback deletes every entry increated. 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. -
The new reference suffixes turn off
.env.localencryption for some existing credentials.src/projectSchemas/credential.ts:193-197adds_PUBLISHABLE_KEY,_MERCHANT_ID,_STORE_ID,_ENVIRONMENTand_AMAZON_PAY_REGION.isSensitiveKey(src/secrets/sensitiveKeys.ts:8) returns false for any key with a reference suffix before it looks at theAGENTCORE_CREDENTIAL_prefix. An existing API key credential namedprod-environmentstores its key inAGENTCORE_CREDENTIAL_PROD_ENVIRONMENT, which is no longer encrypted on the next write. The name guard inadd/credentials/shared.tsonly refuses new names. The same lists also meanagentcore add credentialsnow refuses names such asstripe-restricted-keyfor every credential type. -
src/core/payment.contract.test.tsandsrc/core/payment.lifecycle.contract.test.tscover no CLI code. Both import only the two AWS SDK clients and assert the SDK's own serializer output. They stay green withsrc/core/payment.tsxand every handler deleted. Please replace them withPaymentClienttests against a fakedsend, or remove them.docs/payments.md:197-198points readers at one of them. -
--client-tokenis not validated.capturerequires 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 cap1fails withCapturePaymentIntent failed (ValidationException)and nothing in the message or help states the format.lifecycle.test.tsx:144-151asserts that a token with surrounding spaces is sent unchanged. Please validate the format locally and state it in help.
Smaller items
intent getdeclares its own flags (get/index.tsx:13-24) instead of the shared scope andintentIdFlag. It does not trim--manager-idor--intent-idand it accepts--agent-name '', unlike the other six commands.--parent-origin(create-buyer-approval-url/index.tsx:21-28) rejectshttps://shop.example/,https://Shop.exampleandhttps://shop.example:443because the raw string must equalURL.origin. Normalize instead of comparing.- Two
AwsBillingconnectors on one manager pass the schema (src/projectSchemas/payment.ts:121-131checks names only). The second one fails at deploy time. credentials.test.ts:1408-1427does not assert the PayPal client ID and environment or the Amazon Pay merchant ID, store ID and environment. Swapping those mappings incredentials.ts:747-774leaves the tests green.- Error messages lose the useful part: an inline merchant secret prints
Invalid payment configuration: secret(providers.ts:79-84), and every--checkout-detailsmistake (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
|
Claude Security Review: no high-confidence findings. (run) |
Description
Adds CLI support for AgentCore Payments merchant checkout.
What customers get
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.localplaceholders. Amazon Pay supports theNAandEUmerchant regions, and checkout supports USD and EUR. Deploy reconciliation keepsownership of credentials that the project manages and leaves externally referenced secrets
alone. The existing
coinbase-cdpandstripe-privyflows, including the flat--providerform and the interactive screens, are unchanged.agentcore payment intent create | get | create-buyer-approval-url | initiate | authorize | capture | cancelcover all seven payment intent operations. Amountsstay decimal strings, pending statuses and structured partner data are passed through
unchanged, and
capturerequires a caller-supplied idempotency token.agentcore runtime invokeandagentcore invoke --runtime(including
--local) accept--payment-user-id,--payment-intent-id,--payment-instrument-idand--payment-session-id, which are merged into a JSON--payload. Conflicting or ambiguous values are rejected. Without these flags the payloadbytes are unchanged.
agentcore add payment-connector --aws-billingconfigures aconnector that needs no credentials.
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.03.1181.0 is the first release with the payment intent operations and the Stripe, PayPal and
Amazon Pay credential provider types.
bun.lockwas regenerated withbun install.Deploying the new connector types (Stripe, PayPal, Amazon Pay, AWS Billing) also needs a
vended
@aws/agentcore-cdkthat supports them. That pin bump is not part of this PR; the vendedpin stays at
1.3.0.This change ports the already-reviewed payments branch onto
v1.x. No generated models,fixtures or
command.mdare 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
Testing
bun test: 5508 pass, 6 skip, 0 fail (5514 tests across 335 files)bun run test:e2e, or explained why they are notapplicable. The new read-only payment e2e suite
(
bunx vitest run --config vitest.payment-e2e.config.ts) needs pre-existing sandboxintents and was not run for this PR. The default e2e config excludes it.
bun run typecheckagainst the published 3.1181.0 clientsbun run lint:checkbun run format:checkbun run audit(no vulnerabilities)bun run secrets:checkbun run buildsrc/assets/, I updated affected snapshots: N/A,src/assets/is unchangedexplained by this PR: N/A, nothing was re-recorded
command.md(the release workflow regenerates it)src/core/payment.contract.test.tsandsrc/core/payment.lifecycle.contract.test.tsexercisereal serialization and deserialization through the published clients, including Amazon Pay
NA/EU and EUR pending captures.
Checklist
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the
terms of your choice.