swagger: "2.0"
schemes:
  - https
host: www.beanstream.com
basePath: /api/v1
info:
  description: https://www.beanstream.com/api/v1
  title: Beanstream Payments
  version: 1.0.1
  x-apisguru-categories:
    - payment
    - financial
    - ecommerce
  x-logo:
    url: https://twitter.com/bambora_na/profile_image?size=original
  x-origin:
    - format: swagger
      url: http://support.beanstream.com/restapi/swagger.json
      version: "2.0"
  x-providerName: beanstream.com
  x-tags:
    - payments
    - bank-neutral
    - omni-channel reporting
produces:
  - application/json
paths:
  /payments:
    post:
      description: Make a payment using credit card, cash, cheque, profile, or token. Each payment type has its own json definition passed in the body. For all payments you have the standard Billing, Shipping, Comments, etc. fields that are optional. Only the amount is required along with the payment data for card, cash, cheque, profile, and token. You must change the payment_method for each payment type. Credit Card - "card", Payment Profile - "payment_profile", Legato Token - "token", Cash - "cash", Cheque - "cheque", Interac - "interac"
      parameters:
        - in: body
          name: payment_request
          schema:
            $ref: "#/definitions/PaymentRequest"
      responses:
        "200":
          description: Payment response containing the payment details as well as if the payment was approved or declined.
          schema:
            $ref: "#/definitions/PaymentResponse"
        "400":
          description: Bad Request
          schema:
            $ref: "#/definitions/BeanstreamException"
        "401":
          description: Authentication Failure
          schema:
            $ref: "#/definitions/BeanstreamException"
        "402":
          description: Business Rule Violation or Decline
          schema:
            $ref: "#/definitions/BeanstreamException"
        "403":
          description: Authorization Failure
          schema:
            $ref: "#/definitions/BeanstreamException"
        "405":
          description: Invalid Request Method
          schema:
            $ref: "#/definitions/BeanstreamException"
        "500":
          description: Internal Server Error
          schema:
            $ref: "#/definitions/BeanstreamException"
      summary: Make Payment
      tags:
        - Payments
  "/payments/{transId}":
    get:
      description: Get a previous payment (transaction).
      parameters:
        - description: The transaction id.
          format: integer
          in: path
          name: transId
          required: true
          type: number
      responses:
        "200":
          description: A transaction object.
          schema:
            $ref: "#/definitions/Transaction"
        "400":
          description: Bad Request
          schema:
            $ref: "#/definitions/BeanstreamException"
        "401":
          description: Authentication Failure
          schema:
            $ref: "#/definitions/BeanstreamException"
        "402":
          description: Business Rule Violation or Decline
          schema:
            $ref: "#/definitions/BeanstreamException"
        "403":
          description: Authorization Failure
          schema:
            $ref: "#/definitions/BeanstreamException"
        "405":
          description: Invalid Request Method
          schema:
            $ref: "#/definitions/BeanstreamException"
        "500":
          description: Internal Server Error
          schema:
            $ref: "#/definitions/BeanstreamException"
      summary: Get payment
      tags:
        - Payments
  "/payments/{transId}/completions":
    post:
      description: Complete a pre-authorized payment. The amount of the transaction to complete must be less than or equal to the original pre-auth amount. Complete must be set to true.
      parameters:
        - description: The transaction id.
          format: double
          in: path
          name: transId
          required: true
          type: number
        - in: body
          name: payment_request
          schema:
            $ref: "#/definitions/PaymentRequest"
      responses:
        "200":
          description: Payment response containing the payment details as well as if the transaction was approved or declined.
          schema:
            $ref: "#/definitions/PaymentResponse"
        "400":
          description: Bad Request
          schema:
            $ref: "#/definitions/BeanstreamException"
        "401":
          description: Authentication Failure
          schema:
            $ref: "#/definitions/BeanstreamException"
        "402":
          description: Business Rule Violation or Decline
          schema:
            $ref: "#/definitions/BeanstreamException"
        "403":
          description: Authorization Failure
          schema:
            $ref: "#/definitions/BeanstreamException"
        "405":
          description: Invalid Request Method
          schema:
            $ref: "#/definitions/BeanstreamException"
        "500":
          description: Internal Server Error
          schema:
            $ref: "#/definitions/BeanstreamException"
      summary: Complete pre-auth
      tags:
        - Payments
  "/payments/{transId}/returns":
    post:
      description: Return payment.
      parameters:
        - description: The transaction id.
          format: double
          in: path
          name: transId
          required: true
          type: number
        - in: body
          name: return
          required: true
          schema:
            $ref: "#/definitions/Return"
      responses:
        "200":
          description: Payment response containing the payment details as well as if the transaction was approved or declined.
          schema:
            $ref: "#/definitions/PaymentResponse"
        "400":
          description: Bad Request
          schema:
            $ref: "#/definitions/BeanstreamException"
        "401":
          description: Authentication Failure
          schema:
            $ref: "#/definitions/BeanstreamException"
        "402":
          description: Business Rule Violation or Decline
          schema:
            $ref: "#/definitions/BeanstreamException"
        "403":
          description: Authorization Failure
          schema:
            $ref: "#/definitions/BeanstreamException"
        "405":
          description: Invalid Request Method
          schema:
            $ref: "#/definitions/BeanstreamException"
        "500":
          description: Internal Server Error
          schema:
            $ref: "#/definitions/BeanstreamException"
      summary: Return payment
      tags:
        - Payments
  "/payments/{transId}/void":
    post:
      description: Void a transaction. You can void payments, returns, pre-auths, and completions. It will cancel that transaction.
      parameters:
        - description: The transaction id to void.
          format: double
          in: path
          name: transId
          required: true
          type: number
        - in: body
          name: void
          required: true
          schema:
            $ref: "#/definitions/Void"
      responses:
        "200":
          description: Payment response containing the payment details as well as if the transaction was approved or declined.
          schema:
            $ref: "#/definitions/PaymentResponse"
        "400":
          description: Bad Request
          schema:
            $ref: "#/definitions/BeanstreamException"
        "401":
          description: Authentication Failure
          schema:
            $ref: "#/definitions/BeanstreamException"
        "402":
          description: Business Rule Violation or Decline
          schema:
            $ref: "#/definitions/BeanstreamException"
        "403":
          description: Authorization Failure
          schema:
            $ref: "#/definitions/BeanstreamException"
        "405":
          description: Invalid Request Method
          schema:
            $ref: "#/definitions/BeanstreamException"
        "500":
          description: Internal Server Error
          schema:
            $ref: "#/definitions/BeanstreamException"
      summary: Void Transaction
      tags:
        - Payments
  /profiles:
    post:
      description: Create a new Payment Profile using either a card or a Legato token. You must supply one of them.
      parameters:
        - in: body
          name: createProfileBody
          required: true
          schema:
            $ref: "#/definitions/CreateProfileBody"
      responses:
        "200":
          description: The Profile.
          schema:
            $ref: "#/definitions/ProfileResponse"
        "400":
          description: Bad Request
          schema:
            $ref: "#/definitions/BeanstreamException"
        "401":
          description: Authentication Failure
          schema:
            $ref: "#/definitions/BeanstreamException"
        "402":
          description: Business Rule Violation or Decline
          schema:
            $ref: "#/definitions/BeanstreamException"
        "403":
          description: Authorization Failure
          schema:
            $ref: "#/definitions/BeanstreamException"
        "405":
          description: Invalid Request Method
          schema:
            $ref: "#/definitions/BeanstreamException"
        "500":
          description: Internal Server Error
          schema:
            $ref: "#/definitions/BeanstreamException"
      summary: Create Profile
      tags:
        - Profiles
  "/profiles/{profileId}":
    delete:
      description: Delete a Payment Profile using the profile ID, also known as the Customer Code.
      parameters:
        - description: The profile id. (aka CustomerCode)
          in: path
          name: profileId
          required: true
          type: string
      responses:
        "200":
          description: The Profile.
          schema:
            $ref: "#/definitions/ProfileResponse"
        "400":
          description: Bad Request
          schema:
            $ref: "#/definitions/BeanstreamException"
        "401":
          description: Authentication Failure
          schema:
            $ref: "#/definitions/BeanstreamException"
        "402":
          description: Business Rule Violation or Decline
          schema:
            $ref: "#/definitions/BeanstreamException"
        "403":
          description: Authorization Failure
          schema:
            $ref: "#/definitions/BeanstreamException"
        "405":
          description: Invalid Request Method
          schema:
            $ref: "#/definitions/BeanstreamException"
        "500":
          description: Internal Server Error
          schema:
            $ref: "#/definitions/BeanstreamException"
      summary: Delete profile
      tags:
        - Profiles
    get:
      description: Get a Payment Profile using the profile ID, also known as the Customer Code.
      parameters:
        - description: The profile id. (aka CustomerCode)
          in: path
          name: profileId
          required: true
          type: string
      responses:
        "200":
          description: The Profile.
          schema:
            $ref: "#/definitions/PaymentProfile"
        "400":
          description: Bad Request
          schema:
            $ref: "#/definitions/BeanstreamException"
        "401":
          description: Authentication Failure
          schema:
            $ref: "#/definitions/BeanstreamException"
        "402":
          description: Business Rule Violation or Decline
          schema:
            $ref: "#/definitions/BeanstreamException"
        "403":
          description: Authorization Failure
          schema:
            $ref: "#/definitions/BeanstreamException"
        "405":
          description: Invalid Request Method
          schema:
            $ref: "#/definitions/BeanstreamException"
        "500":
          description: Internal Server Error
          schema:
            $ref: "#/definitions/BeanstreamException"
      summary: Get profile
      tags:
        - Profiles
    put:
      description: Create a new Payment Profile using either a card or a Legato token. You must supply one of them.
      parameters:
        - description: The profile id. (aka CustomerCode)
          in: path
          name: profileId
          required: true
          type: string
        - in: body
          name: updateProfileBody
          required: true
          schema:
            $ref: "#/definitions/UpdateProfileBody"
      responses:
        "200":
          description: The Profile.
          schema:
            $ref: "#/definitions/ProfileResponse"
        "400":
          description: Bad Request
          schema:
            $ref: "#/definitions/BeanstreamException"
        "401":
          description: Authentication Failure
          schema:
            $ref: "#/definitions/BeanstreamException"
        "402":
          description: Business Rule Violation or Decline
          schema:
            $ref: "#/definitions/BeanstreamException"
        "403":
          description: Authorization Failure
          schema:
            $ref: "#/definitions/BeanstreamException"
        "405":
          description: Invalid Request Method
          schema:
            $ref: "#/definitions/BeanstreamException"
        "500":
          description: Internal Server Error
          schema:
            $ref: "#/definitions/BeanstreamException"
      summary: Update Profile
      tags:
        - Profiles
  "/profiles/{profileId}/cards":
    get:
      description: Get all of the cards on the profile.
      parameters:
        - description: The profile id. (aka CustomerCode)
          in: path
          name: profileId
          required: true
          type: string
      responses:
        "200":
          description: The Profile.
          schema:
            $ref: "#/definitions/ProfileGetCards"
        "400":
          description: Bad Request
          schema:
            $ref: "#/definitions/BeanstreamException"
        "401":
          description: Authentication Failure
          schema:
            $ref: "#/definitions/BeanstreamException"
        "402":
          description: Business Rule Violation or Decline
          schema:
            $ref: "#/definitions/BeanstreamException"
        "403":
          description: Authorization Failure
          schema:
            $ref: "#/definitions/BeanstreamException"
        "405":
          description: Invalid Request Method
          schema:
            $ref: "#/definitions/BeanstreamException"
        "500":
          description: Internal Server Error
          schema:
            $ref: "#/definitions/BeanstreamException"
      summary: Get cards
      tags:
        - Profiles
    post:
      description: Add a card to the profile. Note that there is a default limit of 1 card per profile. You can change this in your Profiles settings in the back office.
      parameters:
        - description: The profile id. (aka CustomerCode)
          in: path
          name: profileId
          required: true
          type: string
        - description: The card that will be added to the profile.
          in: body
          name: card
          required: true
          schema:
            $ref: "#/definitions/ProfileCard"
      responses:
        "200":
          description: The Profile.
          schema:
            $ref: "#/definitions/ProfileResponse"
        "400":
          description: Bad Request
          schema:
            $ref: "#/definitions/BeanstreamException"
        "401":
          description: Authentication Failure
          schema:
            $ref: "#/definitions/BeanstreamException"
        "402":
          description: Business Rule Violation or Decline
          schema:
            $ref: "#/definitions/BeanstreamException"
        "403":
          description: Authorization Failure
          schema:
            $ref: "#/definitions/BeanstreamException"
        "405":
          description: Invalid Request Method
          schema:
            $ref: "#/definitions/BeanstreamException"
        "500":
          description: Internal Server Error
          schema:
            $ref: "#/definitions/BeanstreamException"
      summary: Add card
      tags:
        - Profiles
  "/profiles/{profileId}/cards/{cardId}":
    delete:
      description: Delete a card on the profile.
      parameters:
        - description: The profile id. (aka CustomerCode)
          in: path
          name: profileId
          required: true
          type: string
        - description: The card id.
          format: integer
          in: path
          name: cardId
          required: true
          type: number
      responses:
        "200":
          description: The Profile.
          schema:
            $ref: "#/definitions/ProfileResponse"
        "400":
          description: Bad Request
          schema:
            $ref: "#/definitions/BeanstreamException"
        "401":
          description: Authentication Failure
          schema:
            $ref: "#/definitions/BeanstreamException"
        "402":
          description: Business Rule Violation or Decline
          schema:
            $ref: "#/definitions/BeanstreamException"
        "403":
          description: Authorization Failure
          schema:
            $ref: "#/definitions/BeanstreamException"
        "405":
          description: Invalid Request Method
          schema:
            $ref: "#/definitions/BeanstreamException"
        "500":
          description: Internal Server Error
          schema:
            $ref: "#/definitions/BeanstreamException"
      summary: Delete card
      tags:
        - Profiles
    put:
      description: Update the details of a card on the profile.
      parameters:
        - description: The profile id. (aka CustomerCode)
          in: path
          name: profileId
          required: true
          type: string
        - description: The card id.
          format: integer
          in: path
          name: cardId
          required: true
          type: number
        - description: The card that will be updated on the profile.
          in: body
          name: card
          required: true
          schema:
            $ref: "#/definitions/ProfileCard"
      responses:
        "200":
          description: The Profile.
          schema:
            $ref: "#/definitions/ProfileResponse"
        "400":
          description: Bad Request
          schema:
            $ref: "#/definitions/BeanstreamException"
        "401":
          description: Authentication Failure
          schema:
            $ref: "#/definitions/BeanstreamException"
        "402":
          description: Business Rule Violation or Decline
          schema:
            $ref: "#/definitions/BeanstreamException"
        "403":
          description: Authorization Failure
          schema:
            $ref: "#/definitions/BeanstreamException"
        "405":
          description: Invalid Request Method
          schema:
            $ref: "#/definitions/BeanstreamException"
        "500":
          description: Internal Server Error
          schema:
            $ref: "#/definitions/BeanstreamException"
      summary: Update card
      tags:
        - Profiles
  /reports:
    post:
      description: Query for transactions using a date range and optional search criteria. This method allows you to page your search results if you are expecting a lot of results to be returned. The page start value begins at 1. If no records are found the API will return a 404 error message. For details on the parameters and allowed values for Criteria please visit the documentation http://developer.beanstream.com/documentation/analyze-payments/search-specific-criteria/
      parameters:
        - in: body
          name: search_query
          schema:
            $ref: "#/definitions/SearchQuery"
      responses:
        "200":
          description: A transaction object.
          schema:
            $ref: "#/definitions/SearchResult"
        "400":
          description: Bad Request
          schema:
            $ref: "#/definitions/BeanstreamException"
        "401":
          description: Authentication Failure
          schema:
            $ref: "#/definitions/BeanstreamException"
        "402":
          description: Business Rule Violation or Decline
          schema:
            $ref: "#/definitions/BeanstreamException"
        "403":
          description: Authorization Failure
          schema:
            $ref: "#/definitions/BeanstreamException"
        "405":
          description: Invalid Request Method
          schema:
            $ref: "#/definitions/BeanstreamException"
        "500":
          description: Internal Server Error
          schema:
            $ref: "#/definitions/BeanstreamException"
      summary: Search Query
      tags:
        - Reporting
  /scripts/tokenization/tokens:
    post:
      description: NOTE that the full URL for this API call is https://www.beanstream.com/scripts/tokenization/tokens. Turn a credit card into a token using this service. This helps lessen your PCI scope by not passing the credit card information to your server. Instead you turn the card number into a token in the client app, then send the token to the server. When you send the token to Beanstream to make a payment, Beanstream then looks up the card number from that token and makes the payment. Tokens can also be used to create payment profiles.
      parameters:
        - in: body
          name: token_request
          schema:
            $ref: "#/definitions/TokenRequest"
      responses:
        "200":
          description: Token response object. One will always be returned even if the data or card was invalid. The validity of the card is not checked with this API call.
          schema:
            $ref: "#/definitions/TokenResponse"
      summary: Tokenize credit card
      tags:
        - Tokenization
definitions:
  Address:
    properties:
      address_line1:
        description: alphanumeric (64)
        type: string
      address_line2:
        description: alphanumeric (64)
        type: string
      city:
        description: alphanumeric (32)
        type: string
      country:
        description: characters (2)
        type: string
      email_address:
        description: alphanumeric (32)
        type: string
      name:
        description: alphanumeric (64)
        type: string
      phone_number:
        description: alphanumeric (32)
        type: string
      postal_code:
        description: alphanumeric (16)
        type: string
      province:
        description: characters (2)
        type: string
  Adjustment:
    properties:
      amount:
        format: double
        type: number
      approval:
        format: integer
        type: number
      created:
        description: The date it was created '2015-04-22T10:03:19.323-07:00'
        type: string
      id:
        format: integer
        type: number
      message:
        type: string
      type:
        type: string
      url:
        type: string
  BeanstreamException:
    properties:
      category:
        format: int32
        type: integer
      code:
        format: int32
        type: integer
      details:
        items:
          $ref: "#/definitions/Detail"
        type: array
      message:
        type: string
      reference:
        type: string
  Card:
    properties:
      complete:
        default: true
        description: set to false for Pre-Authorize, and true to complete a payment
        type: boolean
      cvd:
        default: "123"
        description: Security code on the back of the credit card. This can be set to mandatory in the back office. digits(3 or 4)
        type: string
      expiry_month:
        default: "02"
        description: eg. 02 for February. digits(2)
        type: string
      expiry_year:
        default: "18"
        description: eg. 15 for 2015. digits(2)
        type: string
      name:
        description: Card holder name. alphanumeric(64)
        type: string
      number:
        default: "5100000010001004"
        description: Credit card number (PAN). digits(20)
        type: string
    required:
      - name
      - number
      - expiry_month
      - expiry_year
  CardGetTransactionResponse:
    properties:
      address_match:
        description: digits (1)
        type: integer
      avs_result:
        description: characters (1)
        type: string
      card_type:
        description: characters (2)
        type: string
      cvd_match:
        description: digits (2)
        type: integer
      expiry_month:
        description: characters (2)
        type: string
      expiry_year:
        description: characters (2)
        type: string
      last_four:
        description: digits (4)
        type: string
  CardPurchaseResponse:
    properties:
      address_match:
        description: digits (1)
        type: integer
      card_type:
        description: characters (2)
        type: string
      cvd_match:
        description: digits (2)
        type: integer
      last_four:
        description: digits (4)
        type: string
      postal_result:
        description: digits (1)
        type: integer
  CreateProfileBody:
    properties:
      billing:
        $ref: "#/definitions/Address"
      card:
        $ref: "#/definitions/ProfileFromCard"
      comment:
        description: alphanumeric(256)
        type: string
      custom:
        $ref: "#/definitions/Custom"
      language:
        description: characters(2)
        type: string
      token:
        $ref: "#/definitions/ProfileFromToken"
  Criteria:
    properties:
      field:
        description: Refer to the table on this page for the searchable fields http://developer.beanstream.com/documentation/analyze-payments/search-specific-criteria/
        format: integer
        type: number
      operator:
        description: URL encoded comparators such as less than, greater than, equals... Refer to the table on this page for the full list of comparators http://developer.beanstream.com/documentation/analyze-payments/search-specific-criteria/
        type: string
      value:
        description: The value you want to match against.
        type: string
  Custom:
    properties:
      ref1:
        description: alphanumeric (256)
        type: string
      ref2:
        description: alphanumeric (256)
        type: string
      ref3:
        description: alphanumeric (256)
        type: string
      ref4:
        description: alphanumeric (256)
        type: string
      ref5:
        description: alphanumeric (256)
        type: string
  Detail:
    properties:
      field:
        type: string
      message:
        type: string
  GetProfileDefaultCard:
    properties:
      card_type:
        description: MC, VI etc. characters(2)
        type: string
      expiry_month:
        description: digits(2)
        type: string
      expiry_year:
        description: digits(2)
        type: string
      name:
        description: cardholder name alphanumeric(64)
        type: string
      number:
        description: masked credit card number alphanumeric(20)
        type: string
  Link:
    properties:
      href:
        description: alphanumeric (256). Url to perform the void, return, completion etc.
        type: string
      method:
        description: characters (16). Http method. post, put, get etc.
        type: string
      ref:
        description: characters (16). Eg. "void" or "return"
        type: string
  PaymentProfile:
    properties:
      account_ref:
        type: string
      billing:
        $ref: "#/definitions/Address"
      card:
        $ref: "#/definitions/GetProfileDefaultCard"
      code:
        description: digits(2)
        format: int32
        type: integer
      custom:
        $ref: "#/definitions/Custom"
      customer_code:
        description: alphanumeric(32)
        type: string
      language:
        description: characters(2)
        type: string
      last_transaction:
        description: date and time alphanumeric(24)
        type: string
      message:
        description: alphanumeric(64)
        type: string
      modified_date:
        description: date and time it was last modified alphanumeric(24)
        type: string
      profile_group:
        type: string
      status:
        description: characters(1)
        type: string
      velocity_group:
        type: string
  PaymentRequest:
    properties:
      amount:
        description: A decimal value in dollars, or relevant currency. digits(9)
        format: double
        type: number
      billing:
        $ref: "#/definitions/Address"
        description: The billing address
      card:
        $ref: "#/definitions/Card"
        description: Payment with a credit card. The payment_method must be 'card'
      comments:
        description: alphanumeric (256)
        type: string
      custom:
        $ref: "#/definitions/Custom"
      customer_ip:
        description: alphanumeric (30)
        type: string
      language:
        description: characters (3)
        type: string
      order_number:
        description: A unique order number. alphanumeric(30)
        type: string
      payment_method:
        description: One of (card, token, payment_profile, cash, cheque). characters(20)
        type: string
      payment_profile:
        $ref: "#/definitions/ProfilePurchase"
        description: Payment with a Payment Profile. The payment_method must be 'payment_profile'
      shipping:
        $ref: "#/definitions/Address"
        description: The shipping address
      term_url:
        description: alphanumeric (256)
        type: string
      token:
        $ref: "#/definitions/TokenPurchase"
        description: Payment with a Legato token. The payment_method must be 'token'
    required:
      - amount
      - payment_method
  PaymentResponse:
    properties:
      approved:
        description: Approved = 1, declined = 0
        type: integer
      auth_code:
        description: alphanumeric (32)
        type: string
      card:
        $ref: "#/definitions/CardPurchaseResponse"
      created:
        description: alphanumeric (32)
        type: string
      id:
        description: digits (9)
        type: string
      links:
        items:
          $ref: "#/definitions/Link"
        type: array
      message:
        description: alphanumeric (256)
        type: string
      message_id:
        description: digits (3)
        type: string
      order_number:
        description: alphanumeric (32)
        type: string
      payment_method:
        description: characters (16)
        type: string
      type:
        description: characters (16)
        type: string
  ProfileCard:
    properties:
      expiry_month:
        description: digits(2)
        type: string
      expiry_year:
        description: digits(2)
        type: string
      name:
        description: cardholder name. alphanumeric(64)
        type: string
      number:
        description: Credit card number. digits(20)
        type: string
  ProfileCards:
    properties:
      card_id:
        description: 1-indexed card ID. Total number of cards allowed is configured in your merchant account.
        type: string
      card_type:
        description: MC, VI etc. characters(2)
        type: string
      expiry_month:
        description: digits(2)
        type: string
      expiry_year:
        description: digits(2)
        type: string
      function:
        description: Will say DEF for the default card
        type: string
      number:
        description: digits(20)
        type: string
  ProfileFromCard:
    properties:
      cvd:
        default: "123"
        description: Security code on the back of the credit card. This can be set to mandatory in the back office. digits(3)
        type: string
      expiry_month:
        default: "02"
        description: eg. 02 for February. digits(2)
        type: string
      expiry_year:
        default: "18"
        description: digits(2)
        type: string
      name:
        default: "5100000010001004"
        description: Card holder name. alphanumeric(64)
        type: string
      number:
        description: Credit card number (PAN)  digits(20)
        type: string
    required:
      - name
      - number
      - expiry_month
      - expiry_year
  ProfileFromToken:
    properties:
      code:
        description: The token received from the client-side tokenization service. alphanumeric(64)
        type: string
      name:
        description: alphanumeric(64)
        type: string
    required:
      - name
      - code
  ProfileGetCards:
    properties:
      card:
        items:
          $ref: "#/definitions/ProfileCards"
        type: array
      code:
        description: digits(2)
        format: integer
        type: number
      customer_code:
        description: characters(32)
        type: string
      message:
        description: alphanumeric(64)
        type: string
  ProfilePurchase:
    properties:
      card_id:
        description: Which credit card to use. Starts at 1 for the first card. You must configure how many cards can be stored by visiting the profile options in the back office. digits(1)
        type: integer
      complete:
        description: Set to FALSE for pre-auth. digit(1) or boolean
        type: boolean
      customer_code:
        description: The payment profile ID. alphanumeric(32)
        type: string
    required:
      - customer_code
      - card_id
  ProfileResponse:
    properties:
      code:
        format: integer
        type: number
      customer_code:
        description: the ID of the payment profile. You need to keep track of this value.
        type: string
      message:
        type: string
  ProfileToken:
    properties:
      code:
        description: single use token associated with this account. alphanumeric(36)
        type: string
      name:
        description: Name of cardholder. alphanumeric(64)
        type: string
  Return:
    properties:
      amount:
        description: The amount of the transaction to return. Must be less than or equal to the original purchase amount.
        format: double
        type: number
      order_number:
        description: alphanumeric (30)
        type: string
    required:
      - amount
  SearchQuery:
    properties:
      criteria:
        description: Optional search criteria. All criteria are ANDed together.
        items:
          $ref: "#/definitions/Criteria"
        type: array
      end_date:
        description: The end date (inclusive) '2015-04-22T10:03:19' in the timezone of your merchant account.
        type: string
      end_row:
        default: 2
        description: Used to page the results. 1-based. This should always be 1 larger than start_row.
        format: integer
        type: number
      name:
        description: Only accepts 2 values. Can be either 'Search' for all fields or 'TransHistoryMinimal' for a subset of the fields returned in the results.
        type: string
      start_date:
        description: The start date (inclusive) '2015-04-22T10:03:19' in the timezone of your merchant account.
        type: string
      start_row:
        default: 1
        description: Used to page the results. 1-based
        format: integer
        type: number
    required:
      - name
      - start_date
      - end_date
      - start_row
      - end_row
  SearchRecord:
    properties:
      b_address1:
        type: string
      b_address2:
        type: string
      b_city:
        type: string
      b_country:
        type: string
      b_email:
        type: string
      b_name:
        type: string
      b_phone:
        type: string
      b_postal:
        type: string
      b_province:
        type: string
      customer_code:
        description: The PaymentProfile ID used in this transaction, if appropriate.
        type: string
      message_id:
        format: integer
        type: number
      message_text:
        type: string
      product_id:
        type: string
      product_name:
        type: string
      ref1:
        type: string
      ref2:
        type: string
      ref3:
        type: string
      ref4:
        type: string
      ref5:
        type: string
      row_id:
        format: integer
        type: number
      s_address1:
        type: string
      s_address2:
        type: string
      s_city:
        type: string
      s_country:
        type: string
      s_email:
        type: string
      s_name:
        type: string
      s_phone:
        type: string
      s_postal:
        type: string
      s_province:
        type: string
      trn_amount:
        format: float32
        type: number
      trn_approval_code:
        type: string
      trn_avs_result:
        description: Address Verification Service
        type: string
      trn_batch_no:
        format: integer
        type: number
      trn_card_expiry:
        type: string
      trn_card_owner:
        type: string
      trn_card_type:
        description: MC VI etc
        type: string
      trn_completions:
        format: float32
        type: number
      trn_cvd_result:
        format: integer
        type: number
      trn_date_time:
        description: 2015-04-22T10:03:19.323-07:00
        type: string
      trn_id:
        format: integer
        type: number
      trn_ip:
        type: string
      trn_masked_card:
        description: The credit card with the middle digits redacted with X's
        type: string
      trn_order_number:
        type: string
      trn_payment_method:
        type: string
      trn_reference:
        format: integer
        type: number
      trn_response:
        format: integer
        type: number
      trn_returns:
        format: float32
        type: number
      trn_type:
        type: string
      trn_voided:
        format: integer
        type: number
  SearchResult:
    properties:
      records:
        items:
          $ref: "#/definitions/SearchRecord"
        type: array
  TokenPurchase:
    properties:
      code:
        description: the payment token you retrieved from the Legato service. alphanumeric(36)
        type: string
      complete:
        description: Set to FALSE for pre-auth
        type: boolean
      name:
        description: Card holder name. alphanumeric(64)
        type: string
    required:
      - code
      - name
  TokenRequest:
    properties:
      cvd:
        description: a 3 to 4 digit representation of CVD/CDD. This is the number usually found on the back of the credit card.
        type: string
      expiry_month:
        description: a 2 digit representation of the expiry month. For example March is 03.
        type: string
      expiry_year:
        description: a 2 digit representation of the expiry year. For example 2016 is 16.
        type: string
      number:
        description: The credit card number
        type: string
    required:
      - number
      - expiry_month
      - expiry_year
      - cvd
  TokenResponse:
    properties:
      code:
        description: Response code for the message. It can be ignored.
        type: string
      message:
        description: Response message with any hints as to what might have gone wrong, if something went wrong.
        type: string
      token:
        description: The token representing the credit card number that you will send to Beanstream for purchases. You will always receive a token, even if the request data is wrong or the card is invalid.
        type: string
      version:
        description: Message version number. Can be ignored.
        type: integer
    required:
      - token
  Transaction:
    properties:
      adjusted_by:
        items:
          $ref: "#/definitions/Adjustment"
        type: array
      amount:
        format: double
        type: number
      approved:
        type: boolean
      auth_code:
        type: string
      batch_number:
        type: string
      billing:
        $ref: "#/definitions/Address"
      card:
        $ref: "#/definitions/CardGetTransactionResponse"
      comments:
        type: string
      created:
        description: The date it was created '2015-04-22T10:03:19.323-07:00'
        type: string
      custom:
        $ref: "#/definitions/Custom"
      id:
        format: integer
        type: number
      links:
        items:
          $ref: "#/definitions/Link"
        type: array
      message:
        type: string
      message_id:
        format: integer
        type: number
      order_number:
        type: string
      payment_method:
        type: string
      shipping:
        $ref: "#/definitions/Address"
      total_completions:
        format: double
        type: number
      total_refunds:
        format: double
        type: number
      type:
        type: string
  UpdateProfileBody:
    properties:
      billing:
        $ref: "#/definitions/Address"
      card:
        $ref: "#/definitions/ProfileToken"
      comment:
        description: alphanumeric(256)
        type: string
      custom:
        $ref: "#/definitions/Custom"
      language:
        description: characters(2)
        type: string
  Void:
    properties:
      amount:
        description: The amount of the transaction to void. Must be equal to the original purchase amount. You can void purchases as well as pre-auths and returns. The amount you are voiding has to match the amount of that transaction.
        format: double
        type: number
    required:
      - amount
