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

# Payments - Session token

> Creates a session object or a session token for wallets like Apple Pay, Google Pay, etc. These tokens are used by Green Banana's SDK to initiate these wallets' SDK.



## OpenAPI

````yaml openapi_spec post /payments/session_tokens
openapi: 3.0.3
info:
  title: GreenBanana - API Documentation
  description: >

    ## Get started


    GreenBanana provides a collection of APIs that enable you to process and
    manage payments.

    Our APIs accept and return JSON in the HTTP body, and return standard HTTP
    response codes.


    You can consume the APIs directly using your favorite HTTP/REST library.


    We have a testing environment referred to "sandbox", which you can setup to
    test API calls without

    affecting production data.

    Currently, our sandbox environment is live while our production environment
    is under development

    and will be available soon.

    You can sign up on our Dashboard to get API keys to access GreenBanana API.


    ### Environment


    Use the following base URLs when making requests to the APIs:


    | Environment   |  Base URL                          |

    |---------------|------------------------------------|

    | Sandbox       | <https://api.staging.bnplx.io>   |

    | Production    | <https://api.bnplx.io>       |


    ## Authentication


    When you sign up on our [dashboard](https://app.bnplx.io) and create a
    merchant

    account, you are given a secret key (also referred as api-key) and a
    publishable key.

    You may authenticate all API requests with GreenBanana server by providing
    the appropriate key in

    the request Authorization header.


    | Key             | 
    Description                                                                                 
    |

    |-----------------|-----------------------------------------------------------------------------------------------|

    | api-key         | Private key. Used to authenticate all API requests from
    your merchant server                  |

    | publishable key | Unique identifier for your account. Used to authenticate
    API requests from your app's client  |


    Never share your secret api keys. Keep them guarded and secure.
  contact:
    name: GreenBanana Support
    url: https://api.staging.bnplx.io
    email: support@greenbanana.group
  license:
    name: Apache-2.0
  version: 0.1.0
servers:
  - url: https://api.staging.bnplx.io
    description: Sandbox Environment
security: []
tags:
  - name: Guide
    description: Follow this guide to do your first BNPL payment with GreenBanana
  - name: Merchant Account
    description: Create and manage merchant accounts
  - name: Profile
    description: Create and manage profiles
  - name: Merchant Connector Account
    description: Create and manage merchant connector accounts
  - name: Payments
    description: Create and manage one-time payments, recurring payments and mandates
  - name: Refunds
    description: Create and manage refunds for successful payments
  - name: Mandates
    description: Manage mandates
  - name: Customers
    description: Create and manage customers
  - name: Payment Methods
    description: Create and manage payment methods of customers
  - name: Products
    description: Create and manage products in the merchant catalog
  - name: Disputes
    description: Manage disputes
  - name: API Key
    description: Create and manage API Keys
  - name: payment link
    description: Create payment link
  - name: Routing
    description: Create and manage routing configurations
  - name: Event
    description: Manage events
paths:
  /payments/session_tokens:
    post:
      tags:
        - Payments
      summary: Payments - Session token
      description: >-
        Creates a session object or a session token for wallets like Apple Pay,
        Google Pay, etc. These tokens are used by Green Banana's SDK to initiate
        these wallets' SDK.
      operationId: Create Session tokens for a Payment
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PaymentsSessionRequest'
        required: true
      responses:
        '200':
          description: >-
            Payment session object created or session token was retrieved from
            wallets
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PaymentsSessionResponse'
        '400':
          description: Missing mandatory fields
      security:
        - publishable_key: []
components:
  schemas:
    PaymentsSessionRequest:
      type: object
      required:
        - payment_id
        - client_secret
      properties:
        payment_id:
          type: string
          description: The identifier for the payment
        client_secret:
          type: string
          description: >-
            This is a token which expires after 15 minutes, used from the client
            to authenticate and create sessions from the SDK
        merchant_connector_details:
          allOf:
            - $ref: '#/components/schemas/MerchantConnectorDetailsWrap'
          nullable: true
    PaymentsSessionResponse:
      type: object
      required:
        - payment_id
        - client_secret
      properties:
        payment_id:
          type: string
          description: The identifier for the payment
        client_secret:
          type: string
          description: >-
            This is a token which expires after 15 minutes, used from the client
            to authenticate and create sessions from the SDK
        installment_providers:
          type: array
          items:
            $ref: '#/components/schemas/ConnectorInstallmentPlan'
          description: The list of connectors that provide the installments
          nullable: true
    MerchantConnectorDetailsWrap:
      type: object
      description: Merchant connector details used to make payments.
      required:
        - creds_identifier
      properties:
        creds_identifier:
          type: string
          description: >-
            Creds Identifier is to uniquely identify the credentials. Do not
            send any sensitive info, like encoded_data in this field. And do not
            send the string "null".
        encoded_data:
          allOf:
            - $ref: '#/components/schemas/MerchantConnectorDetails'
          nullable: true
    ConnectorInstallmentPlan:
      type: object
      required:
        - connector
      properties:
        connector:
          $ref: '#/components/schemas/Connector'
        plans:
          type: array
          items:
            $ref: '#/components/schemas/InstallmentPlan'
          description: The list of installment plans
          nullable: true
    MerchantConnectorDetails:
      type: object
      properties:
        connector_account_details:
          type: object
          description: >-
            Account details of the Connector. You can specify up to 50 keys,
            with key names up to 40 characters long and values up to 500
            characters long. Useful for storing additional, structured
            information on an object.
          nullable: true
        metadata:
          type: object
          description: >-
            Metadata is useful for storing additional, unstructured information
            on an object.
          nullable: true
    Connector:
      type: string
      description: A connector is an integration to fulfill payments
      enum:
        - axytos
        - billie
        - twisto
        - avarda
        - payla
        - ratepay
        - riverty
        - svea
        - unzer
        - zaver
        - openbank
        - mondu
        - bnplx_test
    InstallmentPlan:
      type: object
      required:
        - plan_id
        - payment_method
        - duration_months
      properties:
        plan_id:
          type: string
          description: A unique identifier for the installment plan
        payment_method:
          $ref: '#/components/schemas/PaymentMethodType'
        duration_months:
          type: integer
          format: int32
          description: Duration of the installment plan in months
          minimum: 0
        nominal_interest_rate:
          type: number
          format: double
          description: Annual nominal interest rate percentage
          nullable: true
        effective_interest_rate:
          type: number
          format: double
          description: >-
            Annual effective interest rate percentage (includes
            compounding/taxes/fees)
          nullable: true
        first_installment_amount:
          allOf:
            - $ref: '#/components/schemas/MinorUnit'
          nullable: true
        last_installment_amount:
          allOf:
            - $ref: '#/components/schemas/MinorUnit'
          nullable: true
        down_payment_amount:
          allOf:
            - $ref: '#/components/schemas/MinorUnit'
          nullable: true
        total_amount:
          allOf:
            - $ref: '#/components/schemas/MinorUnit'
          nullable: true
        total_interest_amount:
          allOf:
            - $ref: '#/components/schemas/MinorUnit'
          nullable: true
        total_fees_amount:
          allOf:
            - $ref: '#/components/schemas/MinorUnit'
          nullable: true
    PaymentMethodType:
      type: string
      description: >-
        Indicates the sub type of payment method. Eg: 'invoice' &
        'direct_debit'.
      enum:
        - direct_debit
        - installment_invoice
        - installment_direct_debit
        - invoice
        - subscription_invoice
        - subscription_direct_debit
    MinorUnit:
      type: integer
      format: int64
      description: This Unit struct represents MinorUnit in which core amount works
  securitySchemes:
    publishable_key:
      type: apiKey
      in: header
      name: api-key
      description: >-
        Publishable keys are a type of keys that can be public and have limited
        scope of usage.

````