> ## Documentation Index
> Fetch the complete documentation index at: https://docs.mattildapayments.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Create payment method

> Store a new payment method.

This endpoint requires the `payment-methods.write` scope.


## OpenAPI

````yaml /openapi.speakeasy.json POST /payment-methods
openapi: 3.1.0
info:
  title: mattilda Pay
  description: The mattilda Pay API.
  version: 1.0.0
servers:
  - url: https://api.sandbox.mattildapayments.com
    x-speakeasy-server-id: sandbox
  - url: https://api.mattildapayments.com
    x-speakeasy-server-id: production
security:
  - bearerAuth: []
tags:
  - name: Account updater
    description: Schedule stored cards for an account update.
  - name: Audit logs
    description: Query user activity.
  - name: Buyers
    description: Manage buyers.
  - name: Buyers - Payment methods
    description: Query payment methods for buyers.
  - name: Buyers - Shipping details
    description: Manage shipping details for buyers.
  - name: Card scheme definitions
    description: List definitions for card schemes.
  - name: Checkout sessions
    description: Manage checkout sessions.
  - name: Digital wallets - Sessions
    description: Create sessions for digital wallets like Apple Pay and Google Pay.
  - name: Digital wallets - Setup
    description: Manage digital wallets like Apple Pay and Google Pay.
  - name: Merchant accounts
    description: Manage merchant accounts in an instance.
  - name: Payment links
    description: Manage payment links.
  - name: Payment methods
    description: Manage stored payment methods.
  - name: Payment methods - Network tokens
    description: Manage network tokens for stored payment methods.
  - name: Payment methods - Payment service tokens
    description: Manage payment service tokens for stored payment methods.
  - name: Payment options
    description: Fetch a list of payment options to display at checkout.
  - name: Payment service definitions
    description: Fetch info about the definition of each payment service.
  - name: Payment services
    description: Manage configured payment services.
  - name: Payouts
    description: Payout API.
  - name: Refunds
    description: Manage transaction refunds.
  - name: Reports
    description: Manage one-off and scheduled reports.
  - name: Reports - Executions
    description: Manage executions of reports.
  - name: Transactions
    description: Manage transaction.
paths:
  /payment-methods:
    post:
      tags:
        - Payment methods
      summary: Create payment method
      description: Store a new payment method.
      operationId: create_payment_method
      parameters:
        - name: x-gr4vy-merchant-account-id
          in: header
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            description: The ID of the merchant account to use for this request.
            examples:
              - default
            title: X-Gr4Vy-Merchant-Account-Id
          description: The ID of the merchant account to use for this request.
          x-speakeasy-name-override: merchantAccountId
      requestBody:
        required: true
        content:
          application/json:
            schema:
              anyOf:
                - $ref: '#/components/schemas/CardPaymentMethodCreate'
                - $ref: '#/components/schemas/RedirectPaymentMethodCreate'
                - $ref: '#/components/schemas/CheckoutSessionPaymentMethodCreate'
              title: Body
      responses:
        '201':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PaymentMethod'
        '400':
          description: The request was invalid.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error400'
        '401':
          description: The request was unauthorized.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error401'
        '403':
          description: >-
            The credentials were invalid or the caller did not have permission
            to act on the resource.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error403'
        '404':
          description: The resource was not found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error404'
        '405':
          description: The request method was not allowed.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error405'
        '409':
          description: A duplicate record was found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error409'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
        '425':
          description: The request was too early.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error425'
        '429':
          description: Too many requests were made.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error429'
        '500':
          description: The server encountered an error.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error500'
        '502':
          description: The server encountered an error.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error502'
        '504':
          description: The server encountered an error.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error504'
      x-codeSamples:
        - lang: csharp
          label: C#
          source: >-
            using Gr4vy;

            using Gr4vy.Models.Components;


            var sdk = new Gr4vySDK(
                id: "mattilda",
                server: SDKConfig.Server.Sandbox,
                bearerAuthSource: Auth.WithToken(privateKey),
                merchantAccountId: "default"
            );


            var res = await sdk.PaymentMethods.CreateAsync(requestBody:
            Body.CreateCheckoutSessionPaymentMethodCreate(
                new CheckoutSessionPaymentMethodCreate() {
                    Id = "4137b1cf-39ac-42a8-bad6-1c680d5dab6b",
                }
            ));


            // handle response
        - lang: typescript
          label: Typescript
          source: |-
            import { Gr4vy } from "@gr4vy/sdk";

            const gr4vy = new Gr4vy({
                server: "sandbox",
                id: "mattilda",
                bearerAuth: withToken({
                  privateKey: fs.readFileSync("private_key.pem", "utf8"),
                }),
            });

            async function run() {
              const result = await gr4vy.paymentMethods.create({
                id: "4137b1cf-39ac-42a8-bad6-1c680d5dab6b",
              });

              console.log(result);
            }

            run();
        - lang: python
          label: Python
          source: |-
            from gr4vy import Gr4vy, auth
            import os


            with Gr4vy(
                id="mattilda",
                server="production",
                merchant_account_id="default",
                bearer_auth=auth.with_token(open("./private_key.pem").read())
            ) as g_client:

                res = g_client.payment_methods.create(request_body={
                    "method": "checkout-session",
                    "id": "4137b1cf-39ac-42a8-bad6-1c680d5dab6b",
                })

                # Handle response
                print(res)
        - lang: go
          label: Go
          source: "package main\n\nimport(\n\t\"context\"\n\tgr4vygo \"github.com/gr4vy/gr4vy-go\"\n\t\"os\"\n\t\"github.com/gr4vy/gr4vy-go/models/components\"\n\t\"github.com/gr4vy/gr4vy-go/models/operations\"\n\t\"log\"\n)\n\nfunc main() {\n    ctx := context.Background()\n\n    privateKey := \"....\"\n\twithToken := gr4vy.WithToken(privateKey, []JWTScope{ReadAll, WriteAll}, 60)\n\n\ts := gr4vy.New(\n\t\tgr4vy.WithID(\"mattilda\"),\n\t\tgr4vy.WithServer(gr4vy.ServerSandbox),\n\t\tgr4vy.WithSecuritySource(withToken),\n\t\tgr4vy.WithMerchantAccountID(\"default\"),\n\t)\n\n    res, err := s.PaymentMethods.Create(ctx, operations.CreateBodyCheckoutSessionPaymentMethodCreate(\n        components.CheckoutSessionPaymentMethodCreate{\n            ID: \"4137b1cf-39ac-42a8-bad6-1c680d5dab6b\",\n        },\n    ))\n    if err != nil {\n        log.Fatal(err)\n    }\n    if res != nil {\n        // handle response\n    }\n}"
        - lang: php
          label: PHP
          source: |-
            declare(strict_types=1);

            require 'vendor/autoload.php';

            use Gr4vy;
            use Gr4vy\Auth;

             
            $privateKey = "..."; 

            $sdk = Gr4vy\SDK::builder()
                -\u003esetId('mattilda')
                -\u003esetServer('sandbox')
                -\u003esetSecuritySource(Auth::withToken($privateKey))
                -\u003esetMerchantAccountId('default')
                -\u003ebuild();



            $response = $sdk->paymentMethods->create(
                requestBody: new Gr4vy\CheckoutSessionPaymentMethodCreate(
                    id: '4137b1cf-39ac-42a8-bad6-1c680d5dab6b',
                )
            );

            if ($response->paymentMethod !== null) {
                // handle response
            }
        - lang: java
          label: Java
          source: >-
            package hello.world;


            import java.lang.Exception;

            import com.gr4vy.sdk.BearerSecuritySource;

            import com.gr4vy.sdk.Gr4vy;

            import com.gr4vy.sdk.Gr4vy.AvailableServers;

            import
            org.openapis.openapi.models.components.CheckoutSessionPaymentMethodCreate;

            import org.openapis.openapi.models.errors.*;

            import org.openapis.openapi.models.operations.Body;

            import
            org.openapis.openapi.models.operations.CreatePaymentMethodResponse;


            public class Application {

                public static void main(String[] args) throws Exception {

                    Gr4vy sdk = Gr4vy.builder()
                            .id("mattilda")
                            .server(AvailableServers.SANDBOX)
                            .merchantAccountId("default")
                            .securitySource(new BearerSecuritySource.Builder(privateKey).build())
                        .build();

                    CreatePaymentMethodResponse res = sdk.paymentMethods().create()
                            .requestBody(Body.of(CheckoutSessionPaymentMethodCreate.builder()
                                .id("4137b1cf-39ac-42a8-bad6-1c680d5dab6b")
                                .build()))
                            .call();

                    if (res.paymentMethod().isPresent()) {
                        // handle response
                    }
                }
            }
components:
  schemas:
    CardPaymentMethodCreate:
      properties:
        expiration_date:
          type: string
          maxLength: 5
          minLength: 5
          pattern: ^\d{2}/\d{2}$
          title: Expiration Date
          description: The expiration date of the card, formatted `MM/YY`.
          examples:
            - 12/30
        number:
          type: string
          maxLength: 19
          minLength: 13
          pattern: ^\d+$
          title: Number
          description: The 13-19 digit number for this card.
          examples:
            - '4111111111111111'
        buyer_external_identifier:
          anyOf:
            - type: string
              maxLength: 200
              minLength: 1
            - type: 'null'
          title: Buyer External Identifier
          description: The external identifier of the buyer to attach the method to.
          examples:
            - buyer-12345
        buyer_id:
          anyOf:
            - type: string
              format: uuid
            - type: 'null'
          title: Buyer Id
          description: The ID of the buyer to attach the method to.
          examples:
            - fe26475d-ec3e-4884-9553-f7356683f7f9
        external_identifier:
          anyOf:
            - type: string
              maxLength: 200
              minLength: 1
            - type: 'null'
          title: External Identifier
          description: The merchant reference for this payment method.
          examples:
            - payment-method-12345
        card_type:
          anyOf:
            - type: string
            - type: 'null'
          title: Card Type
          description: The type of the card used
          examples:
            - credit
        method:
          type: string
          const: card
          title: Method
          description: Always `card`
          default: card
          examples:
            - card
        security_code:
          anyOf:
            - type: string
              maxLength: 4
              minLength: 3
              pattern: ^\d+$
            - type: 'null'
          title: Security Code
          description: >-
            The 3 or 4 digit security code often found on the card. This often
            referred to as the CVV or CVD.
          examples:
            - '123'
      additionalProperties: false
      type: object
      required:
        - expiration_date
        - number
      title: CardPaymentMethodCreate
    RedirectPaymentMethodCreate:
      properties:
        method:
          type: string
          enum:
            - oxxo
            - spei
            - pse
            - tapi
            - tapifintechs
          title: Method
          description: >-
            The method to use, this can be any of the methods that support
            redirect requests.
          examples:
            - oxxo
            - spei
          x-speakeasy-unknown-values: allow
          overlay: 1.0.0
        buyer_id:
          anyOf:
            - type: string
              format: uuid
            - type: 'null'
          title: Buyer Id
          description: >-
            The `id` of a stored buyer to use Use this instead of the
            `buyer_external_identifier`.
          examples:
            - fe26475d-ec3e-4884-9553-f7356683f7f9
        buyer_external_identifier:
          anyOf:
            - type: string
              maxLength: 200
              minLength: 1
            - type: 'null'
          title: Buyer External Identifier
          description: >-
            The `external_identifier` of a stored buyer to use. Use this instead
            of the `buyer_id`.
          examples:
            - buyer-12345
        country:
          type: string
          pattern: ^[A-Z]{2}$
          title: Country
          description: >-
            The 2-letter ISO code of the country to use this payment method for.
            This is used to select the payment service to use.
          examples:
            - DE
            - GB
            - US
        currency:
          type: string
          pattern: ^[A-Z]{3}$
          title: Currency
          description: >-
            The ISO-4217 currency code to use this payment method for. This is
            used to select the payment service to use.
          examples:
            - EUR
            - GBP
            - MXN
        redirect_url:
          anyOf:
            - type: string
            - type: string
              pattern: ^data:application/json;base64,.*$
              examples:
                - >-
                  data:application/json;base64,eyJ0YXJnZXQiOiAib3BlbmVyIiwgImNoYW5uZWwiOiAiY2hhbm5lbCIsICJvcmlnaW5fdXJsIjogImh0dHBzOi8vZ3I0dnkuYXBwIn0=
          title: Redirect Url
          description: >-
            The redirect URL to redirect a buyer to after they have authorized
            the payment method.
          examples:
            - https://example.com/callback
        external_identifier:
          anyOf:
            - type: string
              maxLength: 200
              minLength: 1
            - type: 'null'
          title: External Identifier
          description: The merchant identifier for this payment method.
          examples:
            - payment-method-12345
      additionalProperties: false
      type: object
      required:
        - method
        - country
        - currency
        - redirect_url
      title: RedirectPaymentMethodCreate
      description: Create a transaction for an APM/LPM that requires a redirect.
    CheckoutSessionPaymentMethodCreate:
      properties:
        method:
          type: string
          const: checkout-session
          title: Method
          description: Always `checkout-session`
          default: checkout-session
          examples:
            - checkout-session
        id:
          type: string
          format: uuid
          title: Id
          description: The ID for the checkout session.
          examples:
            - 4137b1cf-39ac-42a8-bad6-1c680d5dab6b
        external_identifier:
          anyOf:
            - type: string
              maxLength: 200
              minLength: 1
            - type: 'null'
          title: External Identifier
          description: >-
            The merchant reference that can be used to match the payment method
            against your own records.
          examples:
            - card-12345
        buyer_id:
          anyOf:
            - type: string
              format: uuid
            - type: 'null'
          title: Buyer Id
          description: >-
            The `id` of a stored buyer to use Use this instead of the
            `buyer_external_identifier`.
          examples:
            - fe26475d-ec3e-4884-9553-f7356683f7f9
        buyer_external_identifier:
          anyOf:
            - type: string
              maxLength: 200
              minLength: 1
            - type: 'null'
          title: Buyer External Identifier
          description: >-
            The `external_identifier` of a stored buyer to use. Use this instead
            of the `buyer_id`.
          examples:
            - buyer-12345
      additionalProperties: false
      type: object
      required:
        - id
      title: CheckoutSessionPaymentMethodCreate
    PaymentMethod:
      properties:
        type:
          type: string
          const: payment-method
          title: Type
          description: Always `payment-method`.
          default: payment-method
          examples:
            - payment-method
        approval_url:
          anyOf:
            - type: string
            - type: 'null'
          title: Approval Url
          description: >-
            The optional URL that the buyer needs to be redirected to to further
            authorize their payment.
          examples:
            - https://gr4vy.app/redirect/12345
        country:
          anyOf:
            - type: string
              pattern: ^[A-Z]{2}$
              examples:
                - DE
                - GB
                - US
            - type: 'null'
          title: Country
          description: >-
            The 2-letter ISO code of the country this payment method can be used
            for. If this value is null the payment method may be used in
            multiple countries.
          examples:
            - US
        currency:
          anyOf:
            - type: string
              pattern: ^[A-Z]{3}$
              examples:
                - EUR
                - GBP
                - MXN
            - type: 'null'
          title: Currency
          description: >-
            The ISO-4217 currency code that this payment method can be used for.
            If this value is null the payment method may be used for multiple
            currencies.
          examples:
            - MXN
        details:
          anyOf:
            - $ref: '#/components/schemas/PaymentMethodDetailsCard'
            - type: 'null'
          description: Details for credit or debit card payment method.
        expiration_date:
          anyOf:
            - type: string
              maxLength: 5
              minLength: 5
              pattern: ^\d{2}/\d{2}$
            - type: 'null'
          title: Expiration Date
          description: The expiration date for the payment method.
          examples:
            - 12/30
        fingerprint:
          anyOf:
            - type: string
            - type: 'null'
          title: Fingerprint
          description: >-
            The unique hash derived from the payment method identifier (e.g.
            card number).
          examples:
            - a50b85c200ee0795d6fd33a5c66f37a4564f554355c5b46a756aac485dd168a4
        label:
          anyOf:
            - type: string
              maxLength: 320
              minLength: 0
            - type: 'null'
          title: Label
          description: >-
            A label for the card or the account. For a card it is the last 4
            digits of the card.
          examples:
            - '1234'
        last_replaced_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Last Replaced At
          description: >-
            The date and time when this card was last replaced by the account
            updater.
          examples:
            - '2013-07-16T19:23:00.000+00:00'
        method:
          $ref: '#/components/schemas/Method'
          description: The type of this payment method.
          examples:
            - card
        mode:
          anyOf:
            - $ref: '#/components/schemas/Mode'
            - type: 'null'
          description: The mode to use with this payment method.
          examples:
            - card
        scheme:
          anyOf:
            - $ref: '#/components/schemas/CardScheme'
            - type: 'null'
          description: The scheme of the card. Only applies to card payments.
          examples:
            - visa
        id:
          type: string
          format: uuid
          title: Id
          description: The ID for the payment method.
          examples:
            - ef9496d8-53a5-4aad-8ca2-00eb68334389
        merchant_account_id:
          type: string
          title: Merchant Account Id
          description: The ID of the merchant account this buyer belongs to.
          examples:
            - default
        additional_schemes:
          anyOf:
            - items:
                $ref: '#/components/schemas/CardScheme'
              type: array
            - type: 'null'
          title: Additional Schemes
          description: >-
            Additional schemes of the card besides the primary scheme. Only
            applies to card payment methods.
          examples:
            - - eftpos-australia
        cit_last_used_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Cit Last Used At
          description: >-
            The timestamp when this payment method was last used in a
            transaction for client initiated transactions.
          examples:
            - '2013-07-16T19:23:00.000+00:00'
        cit_usage_count:
          type: integer
          title: Cit Usage Count
          description: >-
            The number of times this payment method has been used in
            transactions for client initiated transactions.
          examples:
            - 50
        has_replacement:
          type: boolean
          title: Has Replacement
          description: >-
            Whether this card has a pending replacement that hasn't been applied
            yet.
          examples:
            - false
        last_used_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Last Used At
          description: >-
            The timestamp when this payment method was last used in a
            transaction.
          examples:
            - '2013-07-16T19:23:00.000+00:00'
        usage_count:
          type: integer
          title: Usage Count
          description: >-
            The number of times this payment method has been used in
            transactions.
          examples:
            - 100
        buyer:
          anyOf:
            - $ref: '#/components/schemas/Buyer'
            - type: 'null'
          description: The optional buyer for which this payment method has been stored.
        external_identifier:
          anyOf:
            - type: string
              maxLength: 200
              minLength: 1
            - type: 'null'
          title: External Identifier
          description: >-
            The merchant reference that can be used to match the payment method
            against your own records.
          examples:
            - card-12345
        status:
          $ref: '#/components/schemas/PaymentMethodStatus'
          description: The state of the payment method.
          examples:
            - succeeded
        created_at:
          type: string
          format: date-time
          title: Created At
          description: >-
            The date and time when this payment method was first created in our
            system.
          examples:
            - '2013-07-16T19:23:00.000+00:00'
        updated_at:
          type: string
          format: date-time
          title: Updated At
          description: >-
            The date and time when this payment method was last updated in our
            system.
          examples:
            - '2013-07-16T19:23:00.000+00:00'
      additionalProperties: false
      type: object
      required:
        - method
        - id
        - merchant_account_id
        - cit_usage_count
        - has_replacement
        - usage_count
        - status
        - created_at
        - updated_at
      title: PaymentMethod
      description: |-
        Payment Method

        A stored payment method.
    Error400:
      properties:
        type:
          type: string
          const: error
          title: Type
          description: Always `error`.
          default: error
          examples:
            - error
        code:
          type: string
          title: Code
          description: Always `bad_request`
          default: bad_request
          examples:
            - bad_request
        status:
          type: integer
          title: Status
          description: Always `400`.
          default: 400
          examples:
            - 400
        message:
          type: string
          title: Message
          description: A human readable message that provides more context to the error.
          default: Generic error
          examples:
            - Request failed validation
        details:
          items:
            $ref: '#/components/schemas/ErrorDetail'
          type: array
          title: Details
          description: A list of details that further ellaborate on the error.
          default: []
      additionalProperties: false
      type: object
      title: Error400
    Error401:
      properties:
        type:
          type: string
          const: error
          title: Type
          description: Always `error`.
          default: error
          examples:
            - error
        code:
          type: string
          title: Code
          description: Always `unauthorized`
          default: unauthorized
          examples:
            - unauthorized
        status:
          type: integer
          title: Status
          description: Always `401`.
          default: 401
          examples:
            - 401
        message:
          type: string
          title: Message
          description: A human readable message that provides more context to the error.
          default: No valid API authentication found
          examples:
            - No valid API authentication found
        details:
          items:
            $ref: '#/components/schemas/ErrorDetail'
          type: array
          title: Details
          description: A list of details that further ellaborate on the error.
          default: []
      additionalProperties: false
      type: object
      title: Error401
    Error403:
      properties:
        type:
          type: string
          const: error
          title: Type
          description: Always `error`.
          default: error
          examples:
            - error
        code:
          type: string
          title: Code
          description: Always `forbidden`
          default: forbidden
          examples:
            - forbidden
        status:
          type: integer
          title: Status
          description: Always `403`.
          default: 403
          examples:
            - 403
        message:
          type: string
          title: Message
          description: A human readable message that provides more context to the error.
          default: Generic error
          examples:
            - Request failed validation
        details:
          items:
            $ref: '#/components/schemas/ErrorDetail'
          type: array
          title: Details
          description: A list of details that further ellaborate on the error.
          default: []
      additionalProperties: false
      type: object
      title: Error403
    Error404:
      properties:
        type:
          type: string
          const: error
          title: Type
          description: Always `error`.
          default: error
          examples:
            - error
        code:
          type: string
          title: Code
          description: Always `not_found`
          default: not_found
          examples:
            - not_found
        status:
          type: integer
          title: Status
          description: Always `404`.
          default: 404
          examples:
            - 404
        message:
          type: string
          title: Message
          description: A human readable message that provides more context to the error.
          default: The resource could not be found
          examples:
            - The resource could not be found
        details:
          items:
            $ref: '#/components/schemas/ErrorDetail'
          type: array
          title: Details
          description: A list of details that further ellaborate on the error.
          default: []
      additionalProperties: false
      type: object
      title: Error404
    Error405:
      properties:
        type:
          type: string
          const: error
          title: Type
          description: Always `error`.
          default: error
          examples:
            - error
        code:
          type: string
          title: Code
          description: Always `method_not_allowed`
          default: method_not_allowed
          examples:
            - method_not_allowed
        status:
          type: integer
          title: Status
          description: Always `405`.
          default: 405
          examples:
            - 405
        message:
          type: string
          title: Message
          description: A human readable message that provides more context to the error.
          default: Method Not Allowed
          examples:
            - Method Not Allowed
        details:
          items:
            $ref: '#/components/schemas/ErrorDetail'
          type: array
          title: Details
          description: A list of details that further ellaborate on the error.
          default: []
      additionalProperties: false
      type: object
      title: Error405
    Error409:
      properties:
        type:
          type: string
          const: error
          title: Type
          description: Always `error`.
          default: error
          examples:
            - error
        code:
          type: string
          title: Code
          description: Always `duplicate_record`
          default: duplicate_record
          examples:
            - duplicate_record
        status:
          type: integer
          title: Status
          description: Always `409`.
          default: 409
          examples:
            - 409
        message:
          type: string
          title: Message
          description: A human readable message that provides more context to the error.
          default: Generic error
          examples:
            - Request failed validation
        details:
          items:
            $ref: '#/components/schemas/ErrorDetail'
          type: array
          title: Details
          description: A list of details that further ellaborate on the error.
          default: []
      additionalProperties: false
      type: object
      title: Error409
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    Error425:
      properties:
        type:
          type: string
          const: error
          title: Type
          description: Always `error`.
          default: error
          examples:
            - error
        code:
          type: string
          title: Code
          description: Always `too_early`
          default: too_early
          examples:
            - too_early
        status:
          type: integer
          title: Status
          description: Always `425`.
          default: 425
          examples:
            - 425
        message:
          type: string
          title: Message
          description: A human readable message that provides more context to the error.
          default: Generic error
          examples:
            - Request failed validation
        details:
          items:
            $ref: '#/components/schemas/ErrorDetail'
          type: array
          title: Details
          description: A list of details that further ellaborate on the error.
          default: []
      additionalProperties: false
      type: object
      title: Error425
    Error429:
      properties:
        type:
          type: string
          const: error
          title: Type
          description: Always `error`.
          default: error
          examples:
            - error
        code:
          type: string
          title: Code
          description: Always `too_many_requests`
          default: too_many_requests
          examples:
            - too_many_requests
        status:
          type: integer
          title: Status
          description: Always `429`.
          default: 429
          examples:
            - 429
        message:
          type: string
          title: Message
          description: A human readable message that provides more context to the error.
          default: Generic error
          examples:
            - Request failed validation
        details:
          items:
            $ref: '#/components/schemas/ErrorDetail'
          type: array
          title: Details
          description: A list of details that further ellaborate on the error.
          default: []
      additionalProperties: false
      type: object
      title: Error429
    Error500:
      properties:
        type:
          type: string
          const: error
          title: Type
          description: Always `error`.
          default: error
          examples:
            - error
        code:
          type: string
          title: Code
          description: Always `server_error`
          default: server_error
          examples:
            - server_error
        status:
          type: integer
          title: Status
          description: Always `500`.
          default: 500
          examples:
            - 500
        message:
          type: string
          title: Message
          description: A human readable message that provides more context to the error.
          default: Request could not be processed
          examples:
            - Request could not be processed
        details:
          items:
            $ref: '#/components/schemas/ErrorDetail'
          type: array
          title: Details
          description: A list of details that further ellaborate on the error.
          default: []
      additionalProperties: false
      type: object
      title: Error500
    Error502:
      properties:
        type:
          type: string
          const: error
          title: Type
          description: Always `error`.
          default: error
          examples:
            - error
        code:
          type: string
          title: Code
          description: Always `bad_gateway`
          default: bad_gateway
          examples:
            - bad_gateway
        status:
          type: integer
          title: Status
          description: Always `502`.
          default: 502
          examples:
            - 502
        message:
          type: string
          title: Message
          description: A human readable message that provides more context to the error.
          default: Request could not be processed
          examples:
            - Request could not be processed
        details:
          items:
            $ref: '#/components/schemas/ErrorDetail'
          type: array
          title: Details
          description: A list of details that further ellaborate on the error.
          default: []
      additionalProperties: false
      type: object
      title: Error502
    Error504:
      properties:
        type:
          type: string
          const: error
          title: Type
          description: Always `error`.
          default: error
          examples:
            - error
        code:
          type: string
          title: Code
          description: Always `gateway_timeout`
          default: gateway_timeout
          examples:
            - gateway_timeout
        status:
          type: integer
          title: Status
          default: 504
        message:
          type: string
          title: Message
          description: A human readable message that provides more context to the error.
          default: Request could not be processed
          examples:
            - Request could not be processed
        details:
          items:
            $ref: '#/components/schemas/ErrorDetail'
          type: array
          title: Details
          description: A list of details that further ellaborate on the error.
          default: []
      additionalProperties: false
      type: object
      title: Error504
    PaymentMethodDetailsCard:
      properties:
        bin:
          anyOf:
            - type: string
              maxLength: 8
              minLength: 6
              pattern: ^\d+$
            - type: 'null'
          title: Bin
        card_type:
          anyOf:
            - $ref: '#/components/schemas/CardType'
            - type: 'null'
        card_issuer_name:
          anyOf:
            - type: string
            - type: 'null'
          title: Card Issuer Name
      additionalProperties: false
      type: object
      title: PaymentMethodDetailsCard
    Method:
      type: string
      enum:
        - card
        - oxxo
        - spei
        - pse
        - tapi
        - tapifintechs
      title: Method
      x-speakeasy-unknown-values: allow
      overlay: 1.0.0
    Mode:
      type: string
      enum:
        - card
        - redirect
        - applepay
        - googlepay
        - checkout-session
        - click-to-pay
        - gift-card
      title: Mode
      x-speakeasy-unknown-values: allow
      overlay: 1.0.0
    CardScheme:
      type: string
      enum:
        - accel
        - amex
        - bancontact
        - carte-bancaire
        - cirrus
        - culiance
        - dankort
        - diners-club
        - discover
        - eftpos-australia
        - elo
        - hipercard
        - jcb
        - maestro
        - mastercard
        - mir
        - nyce
        - other
        - pulse
        - rupay
        - star
        - uatp
        - unionpay
        - visa
      title: CardScheme
      x-speakeasy-unknown-values: allow
      overlay: 1.0.0
    Buyer:
      properties:
        type:
          type: string
          const: buyer
          title: Type
          description: Always `buyer`.
          default: buyer
          examples:
            - buyer
        id:
          anyOf:
            - type: string
              format: uuid
            - type: 'null'
          title: Id
          description: The ID for the buyer.
          examples:
            - fe26475d-ec3e-4884-9553-f7356683f7f9
        merchant_account_id:
          type: string
          title: Merchant Account Id
          description: The ID of the merchant account this buyer belongs to.
          examples:
            - default
        display_name:
          anyOf:
            - type: string
              maxLength: 200
              minLength: 1
            - type: 'null'
          title: Display Name
          description: The display name for the buyer.
          examples:
            - John Doe
        external_identifier:
          anyOf:
            - type: string
              maxLength: 200
              minLength: 1
            - type: 'null'
          title: External Identifier
          description: The merchant identifier for this buyer.
          examples:
            - buyer-12345
        billing_details:
          anyOf:
            - $ref: '#/components/schemas/BillingDetails-Output'
            - type: 'null'
          description: The billing name, address, email, and other fields for this buyer.
        account_number:
          anyOf:
            - type: string
              maxLength: 200
              minLength: 1
            - type: 'null'
          title: Account Number
          description: The buyer account number
        created_at:
          type: string
          format: date-time
          title: Created At
          description: The date this buyer was created at.
          examples:
            - '2013-07-16T19:23:00.000+00:00'
        updated_at:
          type: string
          format: date-time
          title: Updated At
          description: The date this buyer was last updated at.
          examples:
            - '2013-07-16T19:23:00.000+00:00'
      additionalProperties: false
      type: object
      required:
        - merchant_account_id
        - created_at
        - updated_at
      title: Buyer
    PaymentMethodStatus:
      type: string
      enum:
        - processing
        - buyer_approval_required
        - succeeded
        - failed
        - paused
      title: PaymentMethodStatus
      x-speakeasy-unknown-values: allow
      overlay: 1.0.0
    ErrorDetail:
      properties:
        location:
          $ref: '#/components/schemas/ErrorLocation'
          description: >-
            The part of the request where the property can be found that caused
            the error.
          examples:
            - body
        pointer:
          anyOf:
            - type: string
              format: json-pointer
            - type: string
          title: Pointer
          description: A JSON pointer for the particular property that caused the error.
          examples:
            - /currency
        message:
          type: string
          title: Message
          description: A human-readdable explanation of the error.
          examples:
            - 'Unknown ISO 4217 currency code: USX'
        type:
          type: string
          title: Type
          description: The type of error that was raised for this property.
          examples:
            - value_error
      additionalProperties: false
      type: object
      required:
        - location
        - pointer
        - message
        - type
      title: ErrorDetail
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
    CardType:
      type: string
      enum:
        - credit
        - debit
        - prepaid
      title: CardType
      x-speakeasy-unknown-values: allow
      overlay: 1.0.0
    BillingDetails-Output:
      properties:
        first_name:
          anyOf:
            - type: string
              maxLength: 255
              minLength: 1
            - type: 'null'
          title: First Name
          description: The first name(s) or given name for the buyer.
          examples:
            - John
        last_name:
          anyOf:
            - type: string
              maxLength: 255
              minLength: 1
            - type: 'null'
          title: Last Name
          description: The last name, or family name, of the buyer.
          examples:
            - Doe
        email_address:
          anyOf:
            - type: string
              maxLength: 320
              minLength: 1
            - type: 'null'
          title: Email Address
          description: The email address for the buyer.
          examples:
            - john@example.com
        phone_number:
          anyOf:
            - type: string
              pattern: ^\+[1-9]\d{1,14}$
              examples:
                - '+14155552671'
                - '+442071838750'
            - type: 'null'
          title: Phone Number
          description: >-
            The phone number for the buyer which should be formatted according
            to the E164 number standard.
          examples:
            - '+1234567890'
        address:
          anyOf:
            - $ref: '#/components/schemas/Address'
            - type: 'null'
          description: The billing address for the buyer.
        tax_id:
          anyOf:
            - $ref: '#/components/schemas/TaxId'
            - type: 'null'
          description: The tax ID information associated with the billing details.
      additionalProperties: false
      type: object
      title: BillingDetails
    ErrorLocation:
      type: string
      enum:
        - query
        - body
        - path
        - header
        - unknown
      title: ErrorLocation
      x-speakeasy-unknown-values: allow
      overlay: 1.0.0
    Address:
      properties:
        city:
          anyOf:
            - type: string
              maxLength: 100
              minLength: 1
            - type: 'null'
          title: City
          description: The city for the address.
          examples:
            - San Jose
        country:
          anyOf:
            - type: string
              pattern: ^[A-Z]{2}$
              examples:
                - DE
                - GB
                - US
            - type: 'null'
          title: Country
          description: The country for the address in ISO 3166 format.
          examples:
            - US
        postal_code:
          anyOf:
            - type: string
              maxLength: 50
              minLength: 1
            - type: 'null'
          title: Postal Code
          description: The postal code or zip code for the address.
          examples:
            - '94560'
        state:
          anyOf:
            - type: string
              maxLength: 255
              minLength: 1
            - type: 'null'
          title: State
          description: The state, county, or province for the address.
          examples:
            - California
        state_code:
          anyOf:
            - type: string
              pattern: ^[A-Z]{2}-[A-Z0-9]{1,3}$
              examples:
                - GB-LND
                - US-CA
            - type: 'null'
          title: State Code
          description: >-
            The code of state, county, or province for the address in ISO 3166-2
            format.
          examples:
            - US-CA
        house_number_or_name:
          anyOf:
            - type: string
              maxLength: 255
              minLength: 1
            - type: 'null'
          title: House Number Or Name
          description: >-
            The house number or name for the address. Not all payment services
            use this field but some do.
          examples:
            - '10'
        line1:
          anyOf:
            - type: string
              maxLength: 255
              minLength: 1
            - type: 'null'
          title: Line1
          description: The first line of the address.
          examples:
            - Stafford Appartments
        line2:
          anyOf:
            - type: string
              maxLength: 255
              minLength: 1
            - type: 'null'
          title: Line2
          description: The second line of the address.
          examples:
            - 29th Street
        organization:
          anyOf:
            - type: string
              maxLength: 255
              minLength: 1
            - type: 'null'
          title: Organization
          description: >-
            The optional name of the company or organisation to add to the
            address.
          examples:
            - Gr4vy
      additionalProperties: false
      type: object
      title: Address
    TaxId:
      properties:
        value:
          type: string
          maxLength: 50
          minLength: 1
          title: Value
          description: The tax ID for the buyer.
          examples:
            - '12345678931'
        kind:
          $ref: '#/components/schemas/TaxIdKind'
          description: The kind of tax ID
          examples:
            - mx.rfc
      additionalProperties: false
      type: object
      required:
        - value
        - kind
      title: TaxId
    TaxIdKind:
      type: string
      enum:
        - co.itin
        - co.nit
        - mx.curp
        - mx.rfc
        - pe.ruc
      title: TaxIdKind
      x-speakeasy-unknown-values: allow
      overlay: 1.0.0
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````