Payments

WALTA's payment system enables autonomous agents to process secure payments between customers and vendors. This page covers how to initiate payments, handle transactions, and manage payment metadata.

The payment model

The payment model contains all the information about transactions processed through the WALTA ecosystem, including payment details, transaction status, and associated metadata.

Properties

  • Name
    paymentIntent
    Type
    object
    Description

    The Stripe payment intent object containing payment details.

  • Name
    amount
    Type
    number
    Description

    The total payment amount.

  • Name
    status
    Type
    string
    Description

    The status of the transaction (e.g., "success").

  • Name
    metadata
    Type
    object
    Description

    Additional transaction information including product details.

  • Name
    from_user_id
    Type
    string
    Description

    The ID of the user making the payment.

  • Name
    to_user_id
    Type
    string
    Description

    The ID of the vendor receiving the payment.

  • Name
    from_agent_id
    Type
    string
    Description

    The ID of the agent initiating the payment.


POST/v1/sendPayment

Send Payment

This endpoint allows you to process a payment for a product. The system will automatically handle payment processing through Stripe and record the transaction.

Required headers

  • Name
    x-api-key
    Type
    string
    Description

    Your WALTA API key for authentication.

Required attributes

  • Name
    productId
    Type
    string
    Description

    The ID of the product being purchased.

  • Name
    quantity
    Type
    integer
    Description

    The quantity of the product being purchased.

Optional attributes

  • Name
    metadata
    Type
    object
    Description

    Additional metadata to include with the payment.

Request

POST
/v1/sendPayment
curl -X POST https://api.walta.ai/v1/sendPayment \
  -H "x-api-key: {api_key}" \
  -H "Content-Type: application/json" \
  -d '{
    "productId": "prod_123",
    "quantity": 2,
    "metadata": {
      "order_id": "order_456"
    }
  }'

Response

{
  "paymentIntent": {
    "id": "pi_123456789",
    "amount": 200,
    "currency": "usd",
    "status": "succeeded",
    "metadata": {
      "productId": "prod_123",
      "productName": "Premium Service",
      "productDescription": "Premium service package",
      "productPrice": 100,
      "productQuantity": 2,
      "order_id": "order_456"
    }
  }
}

Best Practices

  1. Payment Processing

    • Always validate product availability before initiating payment
    • Handle payment failures gracefully
    • Implement proper error handling
    • Use appropriate metadata for transaction tracking
  2. Security

    • Keep your API keys secure
    • Never expose sensitive payment information
    • Validate all input data
    • Use HTTPS for all API calls
  3. Transaction Management

    • Track transaction status
    • Maintain proper records
    • Implement reconciliation processes
    • Monitor for failed transactions
  4. Error Handling

    • Handle API errors appropriately
    • Implement retry logic for failed payments
    • Log payment failures
    • Provide clear error messages

Common Errors

  • Name
    401 Unauthorized
    Type
    string
    Description

    API key is missing or invalid.

  • Name
    400 Bad Request
    Type
    string
    Description

    Required parameters are missing or invalid.

  • Name
    404 Not Found
    Type
    string
    Description

    Product or vendor not found.

  • Name
    500 Internal Server Error
    Type
    string
    Description

    Payment processing failed.

Was this page helpful?