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

# Retail Pay

> Initiate a retail payment with a customer-presented QR or barcode.



## OpenAPI

````yaml POST /v1/payments/retailPay
openapi: 3.0.3
info:
  title: Rebell Payments API
  version: 0.2.0-draft
  description: >

    OpenAPI derived from "Rebell API Specifications – (Draft for estimate
    integration)".

    This spec covers authentication headers (RSA SHA256 signature), payment
    creation, inquiry, retail pay,

    and webhook notification payloads.


    ---

    ## Swagger UI local setup (dynamic headers)

    This API requires `Request-Time` (RFC 3339) and an RSA-SHA256 `Signature`
    computed **at request time** over:


    ```text

    METHOD + "\n" + HTTP_URI + "\n" + Client-Id + "\n" + Request-Time + "\n" +
    BODY

    ```


    **Recommended pattern (no cloud):**

    - Serve this spec with Swagger UI locally.

    - Use a `requestInterceptor` to set `Client-Id`, compute fresh
    `Request-Time`, and call a **local signer** (running on localhost) to
    produce the base64 signature.

    - Inject the resulting header: `Signature: algorithm=SHA256withRSA,
    keyVersion={keyVersion}, signature={base64}`.


    See `x-swagger-ui-requestInterceptor` in this spec for a drop-in snippet and
    the minimal Node.js signer.



    ### Note on Swagger UI layouts

    If you see `No layout defined for "StandaloneLayout"`, either:

    - include `SwaggerUIStandalonePreset` in your HTML and set `layout:
    "StandaloneLayout"`, **or**

    - simply use `layout: "BaseLayout"` (this spec's embedded snippet uses
    BaseLayout for compatibility).
servers:
  - url: https://api.rebellapp.com
    description: Production
  - url: https://sandbox-api.rebellapp.com
    description: Sandbox (testing)
security:
  - RebellSignature: []
    ClientId: []
    RequestTime: []
tags:
  - name: Authentication
    description: Signature and headers
  - name: Payments
  - name: Webhooks
paths:
  /v1/payments/retailPay:
    post:
      tags:
        - Payments
      summary: Initiate Retail Payment (Customer Wallet Presented QR/Barcode)
      operationId: retailPay
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RetailPayRequest'
            examples:
              example:
                value:
                  productCode: '51051000101000100040'
                  paymentRequestId: REQ_abc_456
                  paymentAuthCode: '289123456789012345'
                  paymentAmount:
                    currency: EUR
                    value: 2500
                  order:
                    orderDescription: In-store purchase
                  paymentNotifyUrl: https://merchant.example.com/rebell/webhook
                  extendInfo: '{"promo":"WINTER"}'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RetailPayResponse'
        '400':
          description: Invalid request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      security:
        - RebellSignature: []
          ClientId: []
          RequestTime: []
      x-codeSamples:
        - lang: cURL
          label: cURL
          source: |-
            curl -X POST https://api.rebellapp.com/v1/payments/retailPay \
              -H "Content-Type: application/json" \
              -H "Client-Id: YOUR_CLIENT_ID" \
              -H "Request-Time: 2024-01-10T12:00:00Z" \
              -H "Signature: algorithm=SHA256withRSA, keyVersion=1, signature=BASE64_SIGNATURE" \
              -d '{
                "productCode": "51051000101000100040",
                "paymentRequestId": "REQ_abc_456",
                "paymentAuthCode": "289123456789012345",
                "paymentAmount": {
                  "currency": "EUR",
                  "value": 2500
                },
                "order": {
                  "orderDescription": "In-store purchase"
                },
                "paymentNotifyUrl": "https://merchant.example.com/webhook"
              }'
        - lang: JavaScript
          label: Node.js
          source: >-
            const response = await
            fetch('https://api.rebellapp.com/v1/payments/retailPay', {
              method: 'POST',
              headers: {
                'Content-Type': 'application/json',
                'Client-Id': 'YOUR_CLIENT_ID',
                'Request-Time': new Date().toISOString(),
                'Signature': 'algorithm=SHA256withRSA, keyVersion=1, signature=BASE64_SIGNATURE'
              },
              body: JSON.stringify({
                productCode: '51051000101000100040',
                paymentRequestId: 'REQ_abc_456',
                paymentAuthCode: '289123456789012345', // Scanned from customer's wallet
                paymentAmount: { currency: 'EUR', value: 2500 },
                order: { orderDescription: 'In-store purchase' },
                paymentNotifyUrl: 'https://merchant.example.com/webhook'
              })
            });


            const data = await response.json();

            if (data.result.resultStatus === 'S') {
              console.log('Payment successful:', data.paymentId);
            }
        - lang: Python
          label: Python
          source: |-
            import requests

            response = requests.post(
                'https://api.rebellapp.com/v1/payments/retailPay',
                headers={
                    'Content-Type': 'application/json',
                    'Client-Id': 'YOUR_CLIENT_ID',
                    'Request-Time': '2024-01-10T12:00:00Z',
                    'Signature': 'algorithm=SHA256withRSA, keyVersion=1, signature=BASE64_SIGNATURE'
                },
                json={
                    'productCode': '51051000101000100040',
                    'paymentRequestId': 'REQ_abc_456',
                    'paymentAuthCode': '289123456789012345',  # Scanned from customer's wallet
                    'paymentAmount': {'currency': 'EUR', 'value': 2500},
                    'order': {'orderDescription': 'In-store purchase'},
                    'paymentNotifyUrl': 'https://merchant.example.com/webhook'
                }
            )

            data = response.json()
            if data['result']['resultStatus'] == 'S':
                print('Payment successful:', data['paymentId'])
components:
  schemas:
    RetailPayRequest:
      type: object
      properties:
        productCode:
          type: string
        paymentRequestId:
          type: string
        paymentAuthCode:
          type: string
          description: User wallet QR/Barcode content
        paymentAmount:
          $ref: '#/components/schemas/Amount'
        order:
          $ref: '#/components/schemas/Order'
        paymentNotifyUrl:
          type: string
          format: uri
        extendInfo:
          type: string
      required:
        - productCode
        - paymentRequestId
        - paymentAuthCode
        - paymentAmount
        - order
    RetailPayResponse:
      type: object
      properties:
        result:
          $ref: '#/components/schemas/Result'
        paymentRequestId:
          type: string
        paymentId:
          type: string
        paymentTime:
          type: string
          format: date-time
        paymentAmount:
          $ref: '#/components/schemas/Amount'
      required:
        - result
    ErrorResponse:
      type: object
      properties:
        result:
          $ref: '#/components/schemas/Result'
      required:
        - result
    Amount:
      type: object
      properties:
        currency:
          type: string
        value:
          type: integer
      required:
        - currency
        - value
      description: Amount in minor units (e.g., cents).
    Order:
      type: object
      properties:
        orderDescription:
          type: string
        orderMemo:
          type: string
        latitude:
          type: string
        longitude:
          type: string
        transactionAddress:
          type: string
          description: >-
            Merchant store address separated by '||'. Example: 'Torino||Corso
            Duca degli Abruzzi,24||10129||IT||Italy'
        merchant:
          $ref: '#/components/schemas/Merchant'
      required:
        - orderDescription
    Result:
      type: object
      properties:
        resultStatus:
          type: string
          enum:
            - S
            - F
            - U
            - A
        resultCode:
          type: string
        resultMessage:
          type: string
      required:
        - resultStatus
    Merchant:
      type: object
      properties:
        store:
          $ref: '#/components/schemas/Store'
    Store:
      type: object
      properties:
        externalStoreId:
          type: string
      required:
        - externalStoreId
  securitySchemes:
    RebellSignature:
      type: apiKey
      in: header
      name: Signature
      description: >-
        RSA SHA256 signature header. Example: `Signature:
        algorithm=SHA256withRSA, keyVersion=0, signature=BASE64...`
    ClientId:
      type: apiKey
      in: header
      name: Client-Id
      description: Rebell-assigned Client Id.
    RequestTime:
      type: apiKey
      in: header
      name: Request-Time
      description: RFC3339 timestamp (e.g., 2019-05-28T12:12:00+08:00).

````