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

# Create a transaction

> Creates a new transaction and send a verification code to the customer

When you call this endpoint, we internally perform several validations, including checking the transaction amount, the customer's status, and their available credit.

<RequestExample>
  ```bash Request theme={null}
  curl --location --request POST 'https://staging-api.propaga.io/v1/transaction'
  --header 'Authorization: <your_awesome_token>' 
  --header 'Content-Type: application/json'
  --data '{
      "cornerStoreId": "57b9d911-1c6e-45c0-be98-bfaeec8d9cf8",
      "totalAmount": 1234,
      "wholesalerTransactionId": "123413123123",
      "deliveryDate": "2024-12-31",
      "products": [
          {
              "externalSKU": "7501018310103",
              "name": "Pasta Spaghetti La Moderna - Moderna - Paquete 200 g",
              "quantity": 5
          }
      ],
      "metadata": {}
  }'
  ```
</RequestExample>

<ResponseExample>
  ```json Response theme={null}
  {
      "incrementalID": 999,
      "transactionId": "13e8b9f0-b73f-4498-a245-05aaae7893dc",
      "verificationId": "561f8ed5-8e90-4b32-9637-4f36a0c66286",
      "userPhoneNumber": "****1207"
  }
  ```
</ResponseExample>

## Body

<ParamField body="cornerStoreId" type="string" required>
  Propaga's corner store id
</ParamField>

<ParamField body="totalAmount" type="number" required>
  Total amount of the order
</ParamField>

<ParamField body="wholesalerTransactionId" type="string">
  Your internal ID for this order
</ParamField>

<ParamField body="deliveryDate" type="string">
  An estimated delivery date
</ParamField>

<ParamField body="products" type="array" required>
  <Expandable title="properties">
    <ParamField body="externalSKU" type="string" />

    <ParamField body="name" type="string" />

    <ParamField body="quantity" type="number" />
  </Expandable>
</ParamField>

<ParamField body="metadata" type="json" optional>
  Any metadata you want to save for the transaction
</ParamField>

## Response

<ResponseField name="incrementalID" type="number">
  Propaga's incremental numeric id
</ResponseField>

<ResponseField name="transactionId" type="string">
  Propaga's transaction id
</ResponseField>

<ResponseField name="verificationId" type="string">
  Verification id to confirm transaction with a code
</ResponseField>

<ResponseField name="userPhoneNumber" type="string">
  Masked user's phone number
</ResponseField>

## Error codes

<ResponseField>
  ```json Corner store not found (404) theme={null}
  {
      "errorCode": "CORNER_STORE_NOT_FOUND",
      "errorMessage": "Corner store id not found"
  }
  ```

  ```json Amount exceeded the limit credit available (422) theme={null}
  {
      "errorCode": "CREDIT_LIMIT_EXCEEDED",
      "errorMessage": "The amount exceeded the limit credit available for the user"
  }
  ```

  ```json User is in default (422) theme={null}
  {
      "errorCode": "USER_IS_IN_DEFAULT",
      "errorMessage": "This user is in default"
  }
  ```

  ```json Transaction amount bellows the minimum required (422) theme={null}
  {
      "errorCode": "MINIMAL_TRANSACTION_REQUIRED",
      "errorMessage": "You need minimal transaction to process the payment"
  }
  ```

  ```json User not verified (422) theme={null}
  {
      "errorCode": "USER_NOT_VERIFIED",
      "errorMessage": "This user not verified"
  }
  ```

  ```json Invalid delivery date (422) theme={null}
  {
      "errorCode": "INVALID_DELIVERY_DATE",
      "errorMessage": "Delivery date has to be a date in the future"
  }
  ```

  ```json User is undergoing internal validations (412) theme={null}
  {
      "errorCode": "USER_IS_IN_INTERNAL_VALIDATION",
      "errorMessage": "The user is currently in the process of internal validation"
  }
  ```
</ResponseField>
