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

# Create Payment

> Initiates a payment for an existing booking. Supports Moyasar (card-direct) and Stripe (redirect).

For **Moyasar** with `type: creditcard`, card details are submitted directly and the response
includes a `transaction_url` for 3DS if required.

For **Stripe**, the response includes a `transaction_url` to redirect the user to Stripe Checkout.




## OpenAPI

````yaml POST /create-payment
openapi: 3.0.3
info:
  title: Seyaha Affiliate API
  description: >
    API for affiliates who list and book Seyaha activities on behalf of their
    users.

    All endpoints require a JWT bearer token issued by Seyaha in the
    `Authorization` header.
  version: 1.0.0
servers:
  - url: /api/v1/affiliates
    description: Affiliate API base URL
security:
  - bearerAuth: []
tags:
  - name: Activities
    description: Browse the activity catalog
  - name: Bookings
    description: Create and manage bookings
  - name: Payments
    description: Process payments for bookings
paths:
  /create-payment:
    post:
      tags:
        - Payments
      summary: Create payment
      description: >
        Initiates a payment for an existing booking. Supports Moyasar
        (card-direct) and Stripe (redirect).


        For **Moyasar** with `type: creditcard`, card details are submitted
        directly and the response

        includes a `transaction_url` for 3DS if required.


        For **Stripe**, the response includes a `transaction_url` to redirect
        the user to Stripe Checkout.
      operationId: createPayment
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreatePaymentRequest'
            examples:
              moyasar:
                summary: Moyasar credit card
                value:
                  callback_url: https://yourapp.com/payment/callback
                  method: Moyasar
                  source:
                    type: creditcard
                    name: Jane Smith
                    number: '4111111111111111'
                    cvc: '123'
                    month: '07'
                    year: '28'
                  meta_data:
                    booking_id: 67c896a6639e6ff76dd2f882
              stripe:
                summary: Stripe redirect
                value:
                  callback_url: https://yourapp.com/payment/callback
                  method: Stripe
                  meta_data:
                    booking_id: 67c896a6639e6ff76dd2f882
      responses:
        '200':
          description: Payment initiated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PaymentResponse'
        '400':
          $ref: '#/components/responses/ValidationError'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '429':
          $ref: '#/components/responses/RateLimitExceeded'
        '500':
          $ref: '#/components/responses/ServerError'
      security:
        - bearerAuth: []
components:
  schemas:
    CreatePaymentRequest:
      type: object
      required:
        - callback_url
        - method
        - meta_data
      properties:
        callback_url:
          type: string
          format: uri
          example: https://yourapp.com/payment/callback
        method:
          type: string
          enum:
            - Moyasar
            - Stripe
          example: Moyasar
        source:
          type: object
          description: Required for Moyasar credit card payments
          properties:
            type:
              type: string
              enum:
                - creditcard
              example: creditcard
            name:
              type: string
              example: Jane Smith
            number:
              type: string
              example: '4111111111111111'
            cvc:
              type: string
              example: '123'
            month:
              type: string
              example: '07'
            year:
              type: string
              description: 2-digit expiry year
              example: '28'
        meta_data:
          type: object
          required:
            - booking_id
          properties:
            booking_id:
              type: string
              example: 67c896a6639e6ff76dd2f882
    PaymentResponse:
      type: object
      properties:
        success:
          type: integer
          example: 1
        data:
          type: object
          properties:
            success:
              type: boolean
            status:
              type: string
              example: initiated
            id:
              type: string
              description: Payment gateway transaction ID
            source:
              type: object
              properties:
                transaction_url:
                  type: string
                  description: Redirect URL for 3DS or Stripe Checkout
                  example: https://checkout.stripe.com/pay/cs_live_...
            paymentMethod:
              type: string
              example: Stripe
    Error:
      type: object
      properties:
        success:
          type: integer
          enum:
            - 0
          example: 0
        error:
          type: array
          items:
            type: string
          example:
            - error detail
        message:
          type: string
          example: Error description
        code:
          type: integer
          example: 400
  responses:
    ValidationError:
      description: Request body failed validation
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            success: 0
            error:
              - 'booking_date: Required'
            message: Validation Error
            code: 400
    Unauthorized:
      description: Missing or invalid JWT
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            success: 0
            error:
              - unauthorized access
            message: unauthorized access
            code: 401
    RateLimitExceeded:
      description: Rate limit exceeded
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            success: 0
            error:
              - rate limit exceeded
            message: rate limit exceeded
            code: 429
    ServerError:
      description: Internal server error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: 'JWT issued by Seyaha — include as `Authorization: Bearer <token>`'

````