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

# Deposit via Payment Page

Initiates a payment session using the pawaPay Payment Page.

<Card title="Learn more!" icon="readme" href="/payment_page" horizontal="true">
  See how the Payment Page works for your customers.
</Card>

* The request will return a `redirectURL`.
* The customer should be forwarded to this URL to start the payment process.
* Once the customer completes the payment process on the Payment Page, they will be forwarded to the `returnUrl`.
* The original `depositId` will be passed as a query parameter.

Your page on the `returnUrl` has two options to determine the status of the payment. You can do that by either:

<CardGroup cols={2}>
  <Card title="Waiting for a callback" icon="webhook" href="../deposits/deposit-callback" horizontal="true">
    If you have configured callbacks, just wait for it.
  </Card>

  <Card title="Checking the status" icon="code-compare" href="../deposits/check-deposit-status" horizontal="true">
    Or poll the Check Deposit Status endpoint.
  </Card>
</CardGroup>

The customer experience of the Payment Page can be changed through the following parameters during initiation.

| Parameter | Behaviour if specified                                                                                   | Behaviour if not specified                                                                                   |
| --------- | -------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------ |
| `amount`  | The specified amount will be used for the payment. Customer is not able to change it.                    | The customer is able to enter the amount they wish to pay. For example, when depositing into their eWallet.  |
| `msisdn`  | The payment will be initiated from the specified mobile money wallet. Customer is not able to change it. | The customer can specify the phone number of the mobile money wallet they wish to pay from.                  |
| `country` | The customer can pay only using a mobile money wallet from the specified country.                        | The customer can pay with a mobile money wallet from any country that is configured on your pawaPay account. |
| `reason`  | The reason will be shown to the customer on the Payment Page                                             | The customer will not be shown what they are paying for.                                                     |


## OpenAPI

````yaml openapi_v1 post /v1/widget/sessions
openapi: 3.0.0
info:
  title: pawaPay Merchant API v1
  description: Please find complete documentation from https://docs.pawapay.io/.
  version: v1
  x-logo:
    url: >-
      https://global-uploads.webflow.com/62824591015aa314fd308df1/6411b26596e3de3f52551c00_Logopawapay-p-500.png
    href: https://docs.pawapay.io/
    altText: pawaPay logo
servers:
  - url: https://api.sandbox.pawapay.io
    description: pawaPay Merchant API sandbox
  - url: https://api.pawapay.io
    description: pawaPay Merchant API production
security:
  - bearerAuth: []
tags:
  - name: payouts
    x-displayName: Payouts
  - name: deposits
    x-displayName: Deposits
  - name: refunds
    x-displayName: Refunds
  - name: payment-page
    x-displayName: Payment Page
  - name: toolkit
    x-displayName: Toolkit
  - name: wallet-balances
    x-displayName: Wallet balances
paths:
  /v1/widget/sessions:
    post:
      tags:
        - payment-page
      summary: Deposit via Payment Page
      operationId: create-session
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateSession'
        required: true
      responses:
        '200':
          description: Payment Page session is created successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Session'
        '400':
          description: >-
            Request was rejected due to incompatibility with pawaPay API
            specification
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                INVALID_INPUT:
                  value:
                    errorId: 94bd5e86-9bc4-4328-b128-c705f6496db8
                    errorCode: 1
                    errorMessage: 'INVALID_INPUT: Missing required property ''returnUrl'''
        '401':
          description: Authentication Failure. Please check your authentication token.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                Unauthorized:
                  value:
                    message: Unauthorized
        '403':
          description: Authorization Failure. Please check your authentication token.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                Forbidden:
                  value:
                    message: Missing Authentication Token
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                Internal Server Error:
                  value:
                    errorId: 94bd5e86-9bc4-4328-b128-c705f6496db8
                    errorCode: 0
                    errorMessage: Internal error
components:
  schemas:
    CreateSession:
      type: object
      required:
        - depositId
        - returnUrl
      properties:
        depositId:
          minLength: 36
          maxLength: 36
          type: string
          format: uuid
          description: >-
            A UUIDv4 based ID specified by you, that uniquely identifies the
            deposit.
          example: <INSERT_UUID_FOR_DEPOSIT>
        returnUrl:
          type: string
          format: uri
          example: https://merchant.com/paymentProcessed
          description: >-
            The URL to which the user will be redirected after completion of the
            operation.
        statementDescription:
          minLength: 4
          maxLength: 22
          type: string
          pattern: ^[a-zA-Z0-9 ]+$
          description: >
            Short description for the transaction. 

            Depending on the specific MMO performing the transaction this
            message may be visible to the customer in the SMS receipt or within
            their transaction history.


            Must be between **4 and 22 alphanumeric characters**.
          example: Note of 4 to 22 chars
        amount:
          minLength: 1
          maxLength: 23
          type: string
          pattern: ^([0]|([1-9][0-9]{0,17}))([.][0-9]{0,3}[1-9])?$
          description: >
            If specified, the amount will be displayed to the customer as the
            payment amount. For example, when paying for specific goods or
            services.


            If not specified, the customer will have to specify the amount they
            wish to pay. For example, when depositing money into their eWallet.


            Amount must follow below requirements or the request will be
            **rejected**:

            * Between zero and two decimal places can be supplied, depending on
            what the specific MMO supports. Learn about all [MMO supported
            decimal places](/using_the_api#correspondents).

            * The minimum and maximum amounts depend on the limits of the
            specific MMO. You can find them from the [Active
            Configuration](/v1/api-reference/toolkit/active-configuration)
            endpoint.

            * Leading zeroes are not permitted except where the value is less
            than 1. For any value less than one, one and only one leading zero
            must be supplied.

            * Trailing zeroes are permitted.


            Valid examples:
              `5`, `5.0`, `5.00`, `5.5`, `5.55`, `5555555`, `0.5`

            Not valid examples:
              `5.`, `5.555`, `5555555555555555555`, `.5`, `-5.5`, `00.5`, `00.00`, `00001.32`
          example: '15'
        msisdn:
          type: string
          description: >
            If specified, this phone number will be used to collect the deposit.
            If not specified, the customer paying can specify the phone number
            that they want to pay from.


            The format is described in
            [Wikipedia](https://en.wikipedia.org/wiki/MSISDN). 


            MSISDN validation has following rules:
             * Only digits without whitespaces or any other separators or prefixes like '+'.
             * Should not start with zero.
             * Country code is mandatory.
             * Should not exceed or be less than the valid length of specified country.
             
             Valid examples for Zambia:
             `260763456789`
             
             Not valid examples for Zambia:
             `+260763456789`, `260 763 456789`, `260-7634-56789`, `0260763456789`, `2607634567`, `260763456789543`, `999558708954`, `37255870895`
          example: '260763456789'
        language:
          type: string
          description: >
            The language in which the Payment Page will be presented to the
            customer. If the user has explicitly changed their languages
            preferences, their selection will override this parameter.
          example: EN
          enum:
            - EN
            - FR
        country:
          type: string
          description: >
            If specifified, allows payment from phone numbers only from a
            specific country. 

            If not specified, the customer can select any country that is
            configured for your account in pawaPay. 


            You can use the [active configuration](#operation/active-conf)
            endpoint to verify which counrties and MMOs have been configured for
            your account. 


            Format must be the ISO 3166-1 alpha-3, three character country code
            in upper case. Read more from
            [Wikipedia](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-3#Officially_assigned_code_elements).
          example: ZMB
        reason:
          type: string
          minLength: 1
          maxLength: 50
          description: >-
            Optional text which will be displayed to the customer on the payment
            page to specify what they are paying for.
          example: Ticket to festival
        metadata:
          $ref: '#/components/schemas/TransactionMetadataRequest'
    Session:
      type: object
      properties:
        redirectUrl:
          type: string
          format: uri
          description: >
            The unique URL of the payment page for this specific payment
            session. Customer has to be forwarded to this URL where they can
            complete the payment. 

            The session is valid for 15 minutes for the customer to complete the
            payment.


            **Please note! The URL is valid for 5 minutes.**
          example: >-
            https://paywith.pawapay.io/?token=AgV4aA3ZxKfGcdMIo6a6Upf7X2MRptdFUrc6Oi3U53CxC0YAkAADABVhd3MtY3J5cHRvLXB1YmxpYy1rZXkAREFzdDR5WktOeWVTRTZ5bTdhVTJJeno3bG1ydkFYenFpUWZqNVQxbGQ2RUgweEpkZVZ0cWJGM3hwMzI1VWN6VGxEdz09AAdwdXJwb3NlAA5jcmVhdGUtc2Vzc2lvbgAFc3RhZ2UAD3NpZ24tY2xvdWRmcm9udAACAAdhd3Mta21zAE5hcm46YXdzOmttczpldS1jZW50cmFsLTE6MTAxOTQ0Mzc3ODY2OmtleS82ZTgzZmVjMS00MWRhLTQxMWQt
    ErrorResponse:
      required:
        - errorId
        - errorCode
        - errorMessage
      type: object
      properties:
        errorId:
          maxLength: 36
          type: string
          description: A unique error ID in the pawaPay platform.
          example: 63743264-7292-11ea-bc55-0242ac130003
        errorCode:
          type: integer
          description: pawaPay internal error code.
          example: 1
        errorMessage:
          type: string
          description: Error message.
          example: Internal error
    TransactionMetadataRequest:
      description: >
        A list of metadata that you can attach to the payment for providing
        additional context about the payment.

        For example, adding `orderId` to indicate for which order this payment
        was for or `customerId` to know which customer this payment pertains to.


        Metadata will not be visible to the customer that is party to this
        payment. 

        It will be visible in the pawaPay Dashboard on the payment details page
        and in your financial statements as a JSON object to support automated
        reconciliation.

        It is also possible to search for recent payments in the pawaPay
        Dashboard using global search based on the values of metadata.


        Up to 10 metadata fields can be attached to a payment. 
      type: array
      items:
        $ref: '#/components/schemas/TransactionMetadataRequestItem'
      example:
        - fieldName: orderId
          fieldValue: ORD-123456789
        - fieldName: customerId
          fieldValue: customer@email.com
          isPII: true
    TransactionMetadataRequestItem:
      required:
        - fieldName
        - fieldValue
      type: object
      properties:
        fieldName:
          type: string
          description: >-
            The name of the metadata that you are attaching to the payment. For
            example `orderId`.
          example: orderId
        fieldValue:
          type: string
          description: The value for this metadata field. For example `ORD-123456789`.
          example: ORD-123456789
        isPII:
          type: boolean
          default: false
          description: >-
            Indicates whether the field contains personally identifiable
            information. Used for enabling compliance with GDPR or other
            relevant data privacy laws.
          example: true
  securitySchemes:
    bearerAuth:
      type: http
      description: See [Authentication](/using_the_api#authentication).
      scheme: bearer
      bearerFormat: JWT

````