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

# Initialize Payment

> This is Spotflow's Redirect Checkout. Initiate a payment request to generate a unique payment reference, payment code and checkout URL for your customers

## Adding Test Funds

<Info>
  On test mode with your test keys, you can easily add fake funds to the jollof bank account number created for you using our [Funds Simulator App](https://d2i9iv7q8xti2t.cloudfront.net/). Note that this is for NGN and GHS only.

  See the full guide on [Adding Fake Funds For Testing](/expert-desk/simulating-funds).
</Info>

## Mobile Money

<Info>
  When `channel` is set to `mobile_money` and a `planId` is included, Spotflow will automatically send a mandate approval request to the customer's phone. The subscription will only activate once the mandate is approved.

  See the full guide on [Mobile Money Subscriptions](/features/mobile-money-subscriptions).
</Info>


## OpenAPI

````yaml post /payments/initialize
openapi: 3.1.0
info:
  title: Spotflow
  description: ''
  license:
    name: MIT
  version: 1.0.0
servers:
  - description: Production server
    url: https://api.spotflow.co/api/v1
security:
  - bearerAuth: []
paths:
  /payments/initialize:
    post:
      description: >-
        This is Spotflow's Redirect Checkout. Initiate a payment request to
        generate a unique payment reference, payment code and checkout URL for
        your customers
      operationId: IntializePayment
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                reference:
                  type: string
                  example: string
                  description: >-
                    Specify a unique reference ID generated by your company to
                    identify each customer.
                amount:
                  type: number
                  example: 0
                  description: >-
                    Amount should be in the subunit of our supported currency
                    i.e your local currency or USD. This is not needed if you
                    use a planId in your request.
                expiresIn:
                  type: number
                  example: 10
                  description: >-
                    The default maximum expiry time is 30 mins. However, you can
                    set yours to the time you desire. The least time you can set
                    is 5 mins.
                planId:
                  type: string
                  example: 95eb086a-b11a-44b2-8422-a1955ca0fd9a
                  description: >-
                    ***Note that including this turns the payment into a
                    subscription.** Omitting it makes it a one-time charge as it
                    is used when paying for a subscription plan.
                currency:
                  type: string
                  enum:
                    - USD
                    - NGN
                    - GHS
                    - KES
                    - ZAR
                    - TZS
                    - XOF
                    - XAF
                  example: USD
                  description: >-
                    Select the currency for the payment charge. Can either be in
                    USD or in the local currency of your collection region. If
                    you put in USD, you have to put in the local currency of the
                    region in the local currency request field.
                countryCode:
                  type: string
                  example: CI
                  description: >-
                    ***Note that, this is only needed to be passed or used for
                    XOF and XAF currency payments***. Country code of XOF
                    countries like Cote D'voire with code CI, or XAF countries
                    like Cameroon with code CM.
                  if:
                    properties:
                      currency:
                        enum:
                          - XOF
                          - XAF
                  then:
                    required:
                      - countryCode
                localCurrency:
                  type: string
                  enum:
                    - NGN
                    - GHS
                    - KES
                    - ZAR
                    - TZS
                  example: NGN
                  description: >-
                    This is the local currency of your region. Used only when
                    currency is set to USD. According to the local region, this
                    can either be in NGN, GHS, ZAR, TZS, KSH etc.
                  if:
                    properties:
                      currency:
                        const: USD
                  then:
                    required:
                      - localCurrency
                callBackUrl:
                  type: string
                  format: url
                  example: https://yourapp.com/callback
                  description: >-
                    This is the URL you want your users to be redirected to
                    after making payments. You can also set this permanently on
                    your Spotflow dashboard.
                metadata:
                  type: object
                  properties:
                    productName:
                      type: string
                      example: Algo.ai
                  description: >-
                    This is information pertaining to additional details about
                    your product or service. Under metadata, you have
                    productName” as a field — This is necessary for you to add
                    as it indicates the name of your product and helps to
                    specify to your user what your product is called. You can
                    add any other additional field as you deem fit.
                customer:
                  type: object
                  properties:
                    email:
                      type: string
                      format: email
                      example: john@example.com
                  required:
                    - email
                  description: The customer’s email address
              required:
                - reference
                - currency
                - customer
      responses:
        '200':
          description: A JSON array of intialize payment objects.
          content:
            application/json:
              schema:
                type: object
                properties:
                  reference:
                    type: string
                    format: uuid
                  checkoutUrl:
                    type: string
                    format: url
                    example: https://checkout.spotflow.co/paymentCode
                  paymentCode:
                    type: string
                    example: PAY123456789
                  status:
                    type: string
                    example: pending
                  mode:
                    type: string
                    example: TEST
                  expiryTime:
                    type: string
                    example: '2025-11-03T10:16:26.948278058'
                  callBackUrl:
                    type: string
                    format: url
                    example: https://yourapp.com/callback
                  metadata:
                    type: object
                    properties:
                      productName:
                        type: string
                        example: Algo.ai
                    description: >-
                      This is information pertaining to additional details about
                      your product or service.
        '400':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error400'
        '401':
          description: Unauthorized - Invalid or missing authentication token.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error401'
components:
  schemas:
    Error400:
      type: object
      properties:
        error:
          type: string
          example: Missing Parameter
        message:
          type: string
          example: missing_parameter
        status:
          type: integer
          format: float
          example: 400
    Error401:
      type: object
      properties:
        error:
          type: string
          example: Unauthorized
        message:
          type: string
          example: invalid_credentials
        status:
          type: integer
          format: float
          example: 401
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````