BedrockAgentCore / Client / create_payment_instrument

create_payment_instrument

BedrockAgentCore.Client.create_payment_instrument(**kwargs)

Create a new payment instrument for a connector.

See also: AWS API Documentation

Request Syntax

response = client.create_payment_instrument(
    userId='string',
    agentName='string',
    paymentManagerArn='string',
    paymentConnectorId='string',
    paymentInstrumentType='EMBEDDED_CRYPTO_WALLET',
    paymentInstrumentDetails={
        'embeddedCryptoWallet': {
            'network': 'ETHEREUM'|'SOLANA',
            'linkedAccounts': [
                {
                    'email': {
                        'emailAddress': 'string'
                    },
                    'sms': {
                        'phoneNumber': 'string'
                    },
                    'developerJwt': {
                        'kid': 'string',
                        'sub': 'string'
                    },
                    'oAuth2': {
                        'google': {
                            'sub': 'string',
                            'emailAddress': 'string',
                            'name': 'string',
                            'username': 'string'
                        },
                        'apple': {
                            'sub': 'string',
                            'emailAddress': 'string',
                            'name': 'string',
                            'username': 'string'
                        },
                        'x': {
                            'sub': 'string',
                            'emailAddress': 'string',
                            'name': 'string',
                            'username': 'string'
                        },
                        'telegram': {
                            'sub': 'string',
                            'emailAddress': 'string',
                            'name': 'string',
                            'username': 'string'
                        },
                        'github': {
                            'sub': 'string',
                            'emailAddress': 'string',
                            'name': 'string',
                            'username': 'string'
                        }
                    }
                },
            ],
            'walletAddress': 'string',
            'redirectUrl': 'string'
        }
    },
    clientToken='string'
)
Parameters:
  • userId (string) – The user ID associated with this payment instrument.

  • agentName (string) – The agent name associated with this request, used for observability.

  • paymentManagerArn (string) –

    [REQUIRED]

    The ARN of the payment manager that owns this payment instrument.

  • paymentConnectorId (string) –

    [REQUIRED]

    The ID of the payment connector to use for this instrument.

  • paymentInstrumentType (string) –

    [REQUIRED]

    The type of payment instrument being created.

  • paymentInstrumentDetails (dict) –

    [REQUIRED]

    The details of the payment instrument.

    Note

    This is a Tagged Union structure. Only one of the following top level keys can be set: embeddedCryptoWallet.

    • embeddedCryptoWallet (dict) –

      Embedded crypto wallet managed directly by end user.

      • network (string) – [REQUIRED]

        The blockchain network for this embedded crypto wallet. Supported networks: ETHEREUM, SOLANA.

      • linkedAccounts (list) – [REQUIRED]

        List of linked accounts linked to this wallet. Each represents a way the end user can authenticate to this wallet.

        • (dict) –

          Represents different linked accounts that can be linked to an embedded wallet. Supports email, SMS, JWT, and OAuth2 approaches.

          Note

          This is a Tagged Union structure. Only one of the following top level keys can be set: email, sms, developerJwt, oAuth2.

          • email (dict) –

            Email-based linked account.

            • emailAddress (string) – [REQUIRED]

              The email address used for the linked account. Must be a valid email format.

          • sms (dict) –

            SMS-based linked account using phone number.

            • phoneNumber (string) – [REQUIRED]

              The phone number in E.164 format (e.g., +1234567890).

          • developerJwt (dict) –

            Developer JWT linked account with key ID and subject.

            • kid (string) – [REQUIRED]

              The key ID (kid) from the JWT header. Identifies which key was used to sign the JWT.

            • sub (string) – [REQUIRED]

              The subject (sub) claim from the JWT payload. Identifies the principal that is the subject of the JWT.

          • oAuth2 (dict) –

            OAuth2 provider linked account (Google, Apple, X, Telegram, GitHub).

            Note

            This is a Tagged Union structure. Only one of the following top level keys can be set: google, apple, x, telegram, github.

            • google (dict) –

              Google OAuth2 authentication.

              • sub (string) – [REQUIRED]

                The subject (sub) claim from the OAuth2 provider. Uniquely identifies the user at the provider.

              • emailAddress (string) –

                The email address from the OAuth2 provider.

              • name (string) –

                The user’s name from the OAuth2 provider.

              • username (string) –

                The username from the OAuth2 provider.

            • apple (dict) –

              Apple OAuth2 authentication.

              • sub (string) – [REQUIRED]

                The subject (sub) claim from the OAuth2 provider. Uniquely identifies the user at the provider.

              • emailAddress (string) –

                The email address from the OAuth2 provider.

              • name (string) –

                The user’s name from the OAuth2 provider.

              • username (string) –

                The username from the OAuth2 provider.

            • x (dict) –

              X (formerly Twitter) OAuth2 authentication.

              • sub (string) – [REQUIRED]

                The subject (sub) claim from the OAuth2 provider. Uniquely identifies the user at the provider.

              • emailAddress (string) –

                The email address from the OAuth2 provider.

              • name (string) –

                The user’s name from the OAuth2 provider.

              • username (string) –

                The username from the OAuth2 provider.

            • telegram (dict) –

              Telegram OAuth2 authentication.

              • sub (string) – [REQUIRED]

                The subject (sub) claim from the OAuth2 provider. Uniquely identifies the user at the provider.

              • emailAddress (string) –

                The email address from the OAuth2 provider.

              • name (string) –

                The user’s name from the OAuth2 provider.

              • username (string) –

                The username from the OAuth2 provider.

            • github (dict) –

              GitHub OAuth2 authentication.

              • sub (string) – [REQUIRED]

                The subject (sub) claim from the OAuth2 provider. Uniquely identifies the user at the provider.

              • emailAddress (string) –

                The email address from the OAuth2 provider.

              • name (string) –

                The user’s name from the OAuth2 provider.

              • username (string) –

                The username from the OAuth2 provider.

      • walletAddress (string) –

        The wallet address on the specified blockchain network.

      • redirectUrl (string) –

        URL for the end user to complete a provider-specific action such as wallet linking or onboarding.

  • clientToken (string) –

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

    This field is autopopulated if not provided.

Return type:

dict

Returns:

Response Syntax

{
    'paymentInstrument': {
        'paymentInstrumentId': 'string',
        'paymentManagerArn': 'string',
        'paymentConnectorId': 'string',
        'userId': 'string',
        'paymentInstrumentType': 'EMBEDDED_CRYPTO_WALLET',
        'paymentInstrumentDetails': {
            'embeddedCryptoWallet': {
                'network': 'ETHEREUM'|'SOLANA',
                'linkedAccounts': [
                    {
                        'email': {
                            'emailAddress': 'string'
                        },
                        'sms': {
                            'phoneNumber': 'string'
                        },
                        'developerJwt': {
                            'kid': 'string',
                            'sub': 'string'
                        },
                        'oAuth2': {
                            'google': {
                                'sub': 'string',
                                'emailAddress': 'string',
                                'name': 'string',
                                'username': 'string'
                            },
                            'apple': {
                                'sub': 'string',
                                'emailAddress': 'string',
                                'name': 'string',
                                'username': 'string'
                            },
                            'x': {
                                'sub': 'string',
                                'emailAddress': 'string',
                                'name': 'string',
                                'username': 'string'
                            },
                            'telegram': {
                                'sub': 'string',
                                'emailAddress': 'string',
                                'name': 'string',
                                'username': 'string'
                            },
                            'github': {
                                'sub': 'string',
                                'emailAddress': 'string',
                                'name': 'string',
                                'username': 'string'
                            }
                        }
                    },
                ],
                'walletAddress': 'string',
                'redirectUrl': 'string'
            }
        },
        'createdAt': datetime(2015, 1, 1),
        'status': 'INITIATED'|'ACTIVE'|'FAILED'|'DELETED',
        'updatedAt': datetime(2015, 1, 1)
    }
}

Response Structure

  • (dict) –

    Response structure for creating a payment instrument.

    • paymentInstrument (dict) –

      The created payment instrument.

      • paymentInstrumentId (string) –

        The unique identifier for this payment instrument.

      • paymentManagerArn (string) –

        The ARN of the payment manager that owns this payment instrument.

      • paymentConnectorId (string) –

        The ID of the payment connector associated with this instrument.

      • userId (string) –

        The user ID associated with this payment instrument.

      • paymentInstrumentType (string) –

        The type of payment instrument (e.g., EMBEDDED_CRYPTO_WALLET).

      • paymentInstrumentDetails (dict) –

        The details specific to the payment instrument type.

        Note

        This is a Tagged Union structure. Only one of the following top level keys will be set: embeddedCryptoWallet. If a client receives an unknown member it will set SDK_UNKNOWN_MEMBER as the top level key, which maps to the name or tag of the unknown member. The structure of SDK_UNKNOWN_MEMBER is as follows:

        'SDK_UNKNOWN_MEMBER': {'name': 'UnknownMemberName'}
        
        • embeddedCryptoWallet (dict) –

          Embedded crypto wallet managed directly by end user.

          • network (string) –

            The blockchain network for this embedded crypto wallet. Supported networks: ETHEREUM, SOLANA.

          • linkedAccounts (list) –

            List of linked accounts linked to this wallet. Each represents a way the end user can authenticate to this wallet.

            • (dict) –

              Represents different linked accounts that can be linked to an embedded wallet. Supports email, SMS, JWT, and OAuth2 approaches.

              Note

              This is a Tagged Union structure. Only one of the following top level keys will be set: email, sms, developerJwt, oAuth2. If a client receives an unknown member it will set SDK_UNKNOWN_MEMBER as the top level key, which maps to the name or tag of the unknown member. The structure of SDK_UNKNOWN_MEMBER is as follows:

              'SDK_UNKNOWN_MEMBER': {'name': 'UnknownMemberName'}
              
              • email (dict) –

                Email-based linked account.

                • emailAddress (string) –

                  The email address used for the linked account. Must be a valid email format.

              • sms (dict) –

                SMS-based linked account using phone number.

                • phoneNumber (string) –

                  The phone number in E.164 format (e.g., +1234567890).

              • developerJwt (dict) –

                Developer JWT linked account with key ID and subject.

                • kid (string) –

                  The key ID (kid) from the JWT header. Identifies which key was used to sign the JWT.

                • sub (string) –

                  The subject (sub) claim from the JWT payload. Identifies the principal that is the subject of the JWT.

              • oAuth2 (dict) –

                OAuth2 provider linked account (Google, Apple, X, Telegram, GitHub).

                Note

                This is a Tagged Union structure. Only one of the following top level keys will be set: google, apple, x, telegram, github. If a client receives an unknown member it will set SDK_UNKNOWN_MEMBER as the top level key, which maps to the name or tag of the unknown member. The structure of SDK_UNKNOWN_MEMBER is as follows:

                'SDK_UNKNOWN_MEMBER': {'name': 'UnknownMemberName'}
                
                • google (dict) –

                  Google OAuth2 authentication.

                  • sub (string) –

                    The subject (sub) claim from the OAuth2 provider. Uniquely identifies the user at the provider.

                  • emailAddress (string) –

                    The email address from the OAuth2 provider.

                  • name (string) –

                    The user’s name from the OAuth2 provider.

                  • username (string) –

                    The username from the OAuth2 provider.

                • apple (dict) –

                  Apple OAuth2 authentication.

                  • sub (string) –

                    The subject (sub) claim from the OAuth2 provider. Uniquely identifies the user at the provider.

                  • emailAddress (string) –

                    The email address from the OAuth2 provider.

                  • name (string) –

                    The user’s name from the OAuth2 provider.

                  • username (string) –

                    The username from the OAuth2 provider.

                • x (dict) –

                  X (formerly Twitter) OAuth2 authentication.

                  • sub (string) –

                    The subject (sub) claim from the OAuth2 provider. Uniquely identifies the user at the provider.

                  • emailAddress (string) –

                    The email address from the OAuth2 provider.

                  • name (string) –

                    The user’s name from the OAuth2 provider.

                  • username (string) –

                    The username from the OAuth2 provider.

                • telegram (dict) –

                  Telegram OAuth2 authentication.

                  • sub (string) –

                    The subject (sub) claim from the OAuth2 provider. Uniquely identifies the user at the provider.

                  • emailAddress (string) –

                    The email address from the OAuth2 provider.

                  • name (string) –

                    The user’s name from the OAuth2 provider.

                  • username (string) –

                    The username from the OAuth2 provider.

                • github (dict) –

                  GitHub OAuth2 authentication.

                  • sub (string) –

                    The subject (sub) claim from the OAuth2 provider. Uniquely identifies the user at the provider.

                  • emailAddress (string) –

                    The email address from the OAuth2 provider.

                  • name (string) –

                    The user’s name from the OAuth2 provider.

                  • username (string) –

                    The username from the OAuth2 provider.

          • walletAddress (string) –

            The wallet address on the specified blockchain network.

          • redirectUrl (string) –

            URL for the end user to complete a provider-specific action such as wallet linking or onboarding.

      • createdAt (datetime) –

        The timestamp when this payment instrument was created.

      • status (string) –

        The current status of this payment instrument.

      • updatedAt (datetime) –

        The timestamp when this payment instrument was last updated.

Exceptions

  • BedrockAgentCore.Client.exceptions.ServiceQuotaExceededException

  • BedrockAgentCore.Client.exceptions.AccessDeniedException

  • BedrockAgentCore.Client.exceptions.ConflictException

  • BedrockAgentCore.Client.exceptions.ValidationException

  • BedrockAgentCore.Client.exceptions.ThrottlingException

  • BedrockAgentCore.Client.exceptions.InternalServerException