Amazon Bedrock AgentCore

2026/11/19 - Amazon Bedrock AgentCore - 1 updated api methods

Changes  Adds the AWS Billing x402 payment type to ProcessPayment. Agents can purchase x402-enabled AWS Marketplace products and have the charges billed to the AWS account, without a wallet. Requests use the service-managed payment instrument ID aws.agentcorepayments.awsbilling.v1.

ProcessPayment (updated) Link ΒΆ
Changes (request, response)
Request
{'paymentInput': {'awsBillingX402': {'options': {'dpopJwk': {'crv': 'P-256 | '
                                                                    'P-384 | '
                                                                    'P-521',
                                                             'kty': 'EC',
                                                             'x': 'string',
                                                             'y': 'string'}},
                                     'payload': {},
                                     'version': 'string'}},
 'paymentType': {'AWS_BILLING_X402'}}
Response
{'paymentOutput': {'awsBillingX402': {'paymentToken': 'string',
                                      'version': 'string'}},
 'paymentType': {'AWS_BILLING_X402'}}

Processes a payment using a payment instrument within a payment session.

See also: AWS API Documentation

Request Syntax

client.process_payment(
    userId='string',
    agentName='string',
    paymentManagerArn='string',
    paymentSessionId='string',
    paymentInstrumentId='string',
    paymentType='CRYPTO_X402'|'MPP'|'AWS_BILLING_X402',
    paymentInput={
        'cryptoX402': {
            'version': 'string',
            'payload': {...}|[...]|123|123.4|'string'|True|None,
            'permit2AllowanceLimit': 'string'
        },
        'mpp': {
            'version': 'string',
            'wwwAuthenticateHeaders': [
                'string',
            ],
            'buyerPaysGasFees': True|False
        },
        'awsBillingX402': {
            'version': 'string',
            'payload': {...}|[...]|123|123.4|'string'|True|None,
            'options': {
                'dpopJwk': {
                    'kty': 'EC',
                    'crv': 'P-256'|'P-384'|'P-521',
                    'x': 'string',
                    'y': 'string'
                }
            }
        }
    },
    clientToken='string'
)
type userId:

string

param userId:

The user ID associated with this payment.

type agentName:

string

param agentName:

The agent name associated with this request, used for observability.

type paymentManagerArn:

string

param paymentManagerArn:

[REQUIRED]

The ARN of the payment manager.

type paymentSessionId:

string

param paymentSessionId:

[REQUIRED]

The ID of the payment session.

type paymentInstrumentId:

string

param paymentInstrumentId:

[REQUIRED]

The ID of the payment instrument to use. For the CRYPTO_X402 and MPP payment types, specify the ID of a payment instrument that you created. For the AWS_BILLING_X402 payment type, specify the service-managed instrument ID aws.agentcorepayments.awsbilling.v1. You don't create this instrument; it's available for any payment manager that has an AWS Billing payment connector.

type paymentType:

string

param paymentType:

[REQUIRED]

The type of payment to process.

type paymentInput:

dict

param paymentInput:

[REQUIRED]

The payment input details specific to the payment type.

  • cryptoX402 (dict) --

    Input for a crypto X402 payment.

    • version (string) -- [REQUIRED]

      The version of the X402 protocol.

    • payload (:ref:`document<document>`) -- [REQUIRED]

      The X402 payment payload.

    • permit2AllowanceLimit (string) --

      The maximum on-chain Permit2 allowance to grant before signing the payment authorization, in the asset's smallest denomination. This field is valid only for the upto (metered) scheme; supplying it for the exact scheme returns a validation error.

      When set, the service approves an ERC-20 allowance for this amount before processing the payment. The approval sets, rather than adds to, the wallet's allowance. Set this field only when the wallet needs approving, for example on its first upto payment, to avoid a redundant on-chain transaction. Omit the field to skip allowance handling. This is the default, and the only behavior for the exact scheme.

  • mpp (dict) --

    Contains the payment challenge from a 402 Payment Required response. Forward the raw WWW-Authenticate: Payment header value verbatim. In response, you receive a payment credential that satisfies the challenge. Provide exactly one challenge per request.

    • version (string) -- [REQUIRED]

      The MPP protocol version, for example "1" or "2".

    • wwwAuthenticateHeaders (list) -- [REQUIRED]

      The raw WWW-Authenticate: Payment header value from the 402 response, passed verbatim. Provide exactly one entry. The service uses this value to generate the payment credential.

      • (string) --

        A raw WWW-Authenticate: Payment header value from a 402 response, containing RFC 9110 auth-params such as id, realm, method, intent, and request. Pass this value in the request body, not as an HTTP header.

    • buyerPaysGasFees (boolean) --

      Authorizes the service to sign a payment whose blockchain network (gas) fees are charged to your wallet, on top of the payment amount.

      The challenge indicates who sponsors the network fees. When the challenge does not sponsor them, the service signs the payment only if this field is true. Otherwise it returns a validation error, so you can decide whether to pay the fees or obtain a challenge that sponsors them.

      Optional. When omitted or false, you decline to pay network fees. This field has no effect on challenges that already sponsor the fees.

  • awsBillingX402 (dict) --

    Input for an AWS Billing x402 payment, which pays an AWS Marketplace seller's quote and charges it to the AWS account that owns the payment manager.

    • version (string) -- [REQUIRED]

      The x402 protocol version of the seller's HTTP 402 response, from its x402Version field. For example, 2.

    • payload (:ref:`document<document>`) -- [REQUIRED]

      The seller's x402 payment requirement for AWS Billing, passed unchanged as a JSON object. The service reads the seller-signed quote token from extra.quoteToken and returns a ValidationException if it is missing or invalid. Any change to the quote token invalidates its signature.

    • options (dict) --

      Optional settings for the AWS Billing payment.

      • dpopJwk (dict) --

        The agent's public key for Demonstrating Proof of Possession (DPoP), as described in RFC 9449. If you specify a key, the payment token is bound to it, and the seller can verify that the token is presented by the holder of the matching private key. If you don't specify a key, the payment token isn't bound to a key.

        • kty (string) -- [REQUIRED]

          The key type. The only valid value is EC.

        • crv (string) -- [REQUIRED]

          The elliptic curve of the key.

        • x (string) -- [REQUIRED]

          The x-coordinate of the elliptic curve point, base64url-encoded.

        • y (string) -- [REQUIRED]

          The y-coordinate of the elliptic curve point, base64url-encoded.

type clientToken:

string

param clientToken:

A unique, case-sensitive identifier that you provide to ensure the idempotency of the request.

This field is autopopulated if not provided.

rtype:

dict

returns:

Response Syntax

{
    'processPaymentId': 'string',
    'paymentManagerArn': 'string',
    'paymentSessionId': 'string',
    'paymentInstrumentId': 'string',
    'paymentType': 'CRYPTO_X402'|'MPP'|'AWS_BILLING_X402',
    'status': 'PROOF_GENERATED',
    'paymentOutput': {
        'cryptoX402': {
            'version': 'string',
            'payload': {...}|[...]|123|123.4|'string'|True|None
        },
        'mpp': {
            'version': 'string',
            'selectedPaymentId': 'string',
            'paymentCredential': 'string'
        },
        'awsBillingX402': {
            'version': 'string',
            'paymentToken': 'string'
        }
    },
    'createdAt': datetime(2015, 1, 1),
    'updatedAt': datetime(2015, 1, 1)
}

Response Structure

  • (dict) --

    Response structure for processing a payment.

    • processPaymentId (string) --

      The unique identifier of the processed payment.

    • paymentManagerArn (string) --

      The ARN of the payment manager.

    • paymentSessionId (string) --

      The ID of the payment session used.

    • paymentInstrumentId (string) --

      The ID of the payment instrument used. For the AWS_BILLING_X402 payment type, this is the service-managed instrument ID aws.agentcorepayments.awsbilling.v1.

    • paymentType (string) --

      The type of payment processed.

    • status (string) --

      The status of the payment.

    • paymentOutput (dict) --

      The payment output details specific to the payment type.

      • cryptoX402 (dict) --

        Output from a crypto X402 payment.

        • version (string) --

          The version of the X402 protocol.

        • payload (:ref:`document<document>`) --

          The X402 payment response payload.

      • mpp (dict) --

        Contains the payment credential, ready to retry the request.

        • version (string) --

          The MPP protocol version, for example "1" or "2".

        • selectedPaymentId (string) --

          The id of the challenge that was paid, echoed from the input challenge so you can correlate the result without decoding the credential.

        • paymentCredential (string) --

          Ready-to-send value for the Authorization header, in the form "Payment <base64url-token>". Attach this header and retry the original request. To inspect the full credential, base64url-decode the token.

      • awsBillingX402 (dict) --

        Output from an AWS Billing x402 payment.

        • version (string) --

          The x402 protocol version. This is the same value as the version in the request.

        • paymentToken (string) --

          The payment token, a signed JSON Web Token (JWT). Include it when you retry your request to the seller. Treat the payment token as a credential: don't log or share it.

    • createdAt (datetime) --

      The timestamp when the payment was created.

    • updatedAt (datetime) --

      The timestamp when the payment was last updated.