Set up Stripe
With a Stripe payment connector, your agent can accept the payment methods that you turn on in your Stripe Dashboard, including card payments, through your own Stripe account. AgentCore payments calls Stripe with a restricted API key that you create in the Stripe Dashboard. For INSTANT and FUTURE payments, the buyer confirms the payment in the Stripe Payment ElementSETUP, the buyer saves a payment method on a Stripe-hosted Checkout page.
Get your Stripe keys
Before you begin, make sure that you have the following:
-
A Stripe account. To test, use test mode.
-
A Payment Manager. For more information, see Create a Payment Manager and Connector.
-
A web page that shows the Stripe Payment Element.
Collect the following values from your Stripe account:
- Restricted key
-
A restricted API key that starts with
rk_live_orrk_test_. The key prefix sets live or test mode. When you create the key in the Stripe Dashboard, set the following permissions on these Stripe resources:-
Write: Customers, PaymentIntents, SetupIntents, and Checkout Sessions.
-
Read: Charges and PaymentMethods.
-
Write on PaymentMethods, only if you cancel
SETUPpayment intents after the buyer saves a payment method.These are Stripe resources, not AgentCore payments resources. AgentCore payments rejects a secret key (
sk_) or a publishable key (pk_). For more information, see Restricted API keysin the Stripe documentation.
-
- Publishable key (optional)
-
The key that your web page uses for the Payment Element, starting with
pk_live_orpk_test_. Its mode must match the restricted key:pk_test_withrk_test_, andpk_live_withrk_live_. If you add it,InitiatePaymentIntentreturns it inpartnerIntentData, and your backend can pass it to your page.
Create a Stripe payment credential provider
A payment credential provider stores your Stripe credentials in AgentCore Identity. Set credentialProviderVendor to Stripe and supply a stripeConfiguration block with the following fields:
-
The restricted key, in one of the following ways. The two ways are mutually exclusive.
-
restrictedKey: the key value. AgentCore Identity stores it in a service-managed secret. You can omitrestrictedKeySource, or set it toMANAGED. -
restrictedKeyConfig: a reference to a secret that you own in AWS Secrets Manager, withsecretIdandjsonKey. SetrestrictedKeySourcetoEXTERNAL.
-
-
publishableKey(optional): your publishable key. Stripe publishable keys are public, so AgentCore Identity stores it as a plain attribute, not as a secret.
We recommend the Secrets Manager reference. The key then stays in one secret that you own, instead of a second copy in a service-managed secret. Passing the key inline suits quick setup, such as in the console.
Example
The response returns credentialProviderArn and a stripeConfiguration output. The output includes restrictedKeyArn, the ARN of the secret that holds the key, and publishableKey if you supplied one. It never includes the restricted key value.
Create a Stripe payment connector
Create a connector of type Stripe in your Payment Manager, and reference the credential provider ARN.
Example
When the connector status is READY, your agent can accept payments using Stripe. Don’t create payment intents with the connector before then.
Next, create a payment intent.
Rotate or replace your Stripe credentials
AgentCore payments doesn’t require a rotation schedule. Rotate the restricted key on your organization’s schedule, and right away if the key might be exposed. To rotate the restricted key, do one of the following:
-
If you use
restrictedKeyConfig, store a new version of the secret in AWS Secrets Manager. -
If you passed the key inline, call
UpdatePaymentCredentialProviderwith the fullstripeConfigurationand the new key.
Rotate only to a key from the same Stripe account. AgentCore payments doesn’t check that a new key belongs to the same account. To connect a different Stripe account, create a new payment credential provider and a new connector.
To move from testing to live payments, we recommend a separate payment credential provider and connector with your live key (rk_live_). You can also replace a test key with a live key on the same connector, because both keys belong to the same Stripe account. Stripe keeps test mode and live mode objects apart, so payment intents and saved payment methods from test mode don’t work after the change. Finish or cancel your test payment intents before you replace the key.
Stripe considerations
-
AgentCore payments accepts only restricted keys. It rejects secret keys (
sk_) and publishable keys (pk_). -
More than one capture for a
FUTUREpayment requires Stripe multicapture. AgentCore payments requests multicapture for each FUTUREpayment. Multicapture is available to you based on Stripe’s eligibility criteria. If the payment doesn’t support it, a capture that isn’t the final capture returns aValidationException. In that case, capture the full remaining amount at once. -
AgentCore payments supports
USDandEUR. Your Stripe account must accept the currency of the payment intent. -
Use test mode keys (
rk_test_) with Stripe test cards. Live mode keys (rk_live_) charge real buyers. -
AgentCore payments offers the payment methods that you turn on in your Stripe Dashboard. Methods that redirect the buyer, such as Klarna, use your
return_url. Methods that settle later, such as ACH Direct Debit or SEPA Direct Debit, leave the captureCAPTURE_PENDINGafterAuthorizePaymentIntent. -
Stripe is the only payment service provider that supports
SETUP. For more information, see Save a payment method for later charges. -
FUTUREdoesn’t support ACH Direct Debit.SETUPsupports cards (including Apple Pay and Google Pay), Link, and ACH Direct Debit.