> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://developers.mapeiatechcompany.store/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://developers.mapeiatechcompany.store/_mcp/server.

# Notificar PBM no carrinho

POST https://santoremedio.mapeiatechcompany.store/pbm/api/v2/cart/notify-pbm
Content-Type: application/json

Chamada pelo front quando o cliente está em **/carrinho**: registra o carrinho no PBM no formato **estágio carrinho**
(`transaction.transactionCode` e `providerCode` vazios; itens em `product`; `consumer.holderId` a partir de `document`).

Corpo típico: `document` (CPF 11 dígitos), `items[]` com `ean`/`EAN`, `requestedQuantity`/`quantity`, `listPrice`/`netPrice` (centavos ou use `unitPrice` em reais como nas outras rotas).
Opcional: `basketId`, `sessionId` (auditoria), `consumer`, `control` para sobrescrever campos do `control`.


Reference: https://developers.mapeiatechcompany.store/referencia-da-api/cart-pbm/post-cart-notify-pbm

## Authentication

- `Authorization` header (bearer token, required) — Bearer authentication of the form `Bearer <token>`, where token is your auth token.

## Servers

- `https://santoremedio.mapeiatechcompany.store` (Ambiente multi-tenant, default)
- `http://localhost:9503` (Desenvolvimento local)

## Request

### Body (application/json)

This endpoint expects an object.

- `document` (string, required) — CPF (11 dígitos; pode vir formatado).
- `items` (list of map from string to any, required)
- `basketId` (string, optional)
- `sessionId` (string, optional)
- `consumer` (map from string to any, optional)
- `control` (map from string to any, optional)

## Response

### 200

Resposta do PBM após efetiva.

- `success` (boolean, required)
- `data` (any, optional)
- `message` (string, optional)
- `_meta` (ApiSuccessEnvelopeMeta, optional)

## Errors

### 400 Bad Request Error

Body inválido.

- `success` (boolean, required)
- `error` (ApiErrorEnvelopeError, required)
- `meta` (ApiErrorEnvelopeMeta, required)

### 500 Internal Server Error

Erro interno ou falha ao falar com o PBM.

- `success` (boolean, required)
- `error` (ApiErrorEnvelopeError, required)
- `meta` (ApiErrorEnvelopeMeta, required)

## Types

### ApiSuccessEnvelopeMeta

- `statusCode` (integer, optional)
- `timestamp` (datetime, optional)
- `requestId` (string, optional)

### ApiErrorEnvelopeError

- `code` (string, required)
- `message` (string, required)
- `statusCode` (integer, required)
- `details` (any, optional)

### ApiErrorEnvelopeMeta

- `timestamp` (datetime, optional)
- `requestId` (string, optional)

## Examples

**Request**

```json
{
  "document": "42799591027",
  "items": [
    {
      "ean": 7896261005884,
      "requestedQuantity": 1,
      "listPrice": 10000,
      "netPrice": 10000,
      "discountType": "B"
    }
  ],
  "basketId": "basket-uuid",
  "sessionId": "session-uuid"
}
```

**Response**

```json
{
  "success": true,
  "message": "string",
  "_meta": {
    "statusCode": 200,
    "timestamp": "2024-01-15T09:30:00Z",
    "requestId": "string"
  }
}
```

**SDK Code**

```python
import requests

url = "https://santoremedio.mapeiatechcompany.store/pbm/api/v2/cart/notify-pbm"

payload = {
    "document": "42799591027",
    "items": [
        {
            "ean": 7896261005884,
            "requestedQuantity": 1,
            "listPrice": 10000,
            "netPrice": 10000,
            "discountType": "B"
        }
    ],
    "basketId": "basket-uuid",
    "sessionId": "session-uuid"
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript
const url = 'https://santoremedio.mapeiatechcompany.store/pbm/api/v2/cart/notify-pbm';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"document":"42799591027","items":[{"ean":7896261005884,"requestedQuantity":1,"listPrice":10000,"netPrice":10000,"discountType":"B"}],"basketId":"basket-uuid","sessionId":"session-uuid"}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://santoremedio.mapeiatechcompany.store/pbm/api/v2/cart/notify-pbm"

	payload := strings.NewReader("{\n  \"document\": \"42799591027\",\n  \"items\": [\n    {\n      \"ean\": 7896261005884,\n      \"requestedQuantity\": 1,\n      \"listPrice\": 10000,\n      \"netPrice\": 10000,\n      \"discountType\": \"B\"\n    }\n  ],\n  \"basketId\": \"basket-uuid\",\n  \"sessionId\": \"session-uuid\"\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://santoremedio.mapeiatechcompany.store/pbm/api/v2/cart/notify-pbm")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"document\": \"42799591027\",\n  \"items\": [\n    {\n      \"ean\": 7896261005884,\n      \"requestedQuantity\": 1,\n      \"listPrice\": 10000,\n      \"netPrice\": 10000,\n      \"discountType\": \"B\"\n    }\n  ],\n  \"basketId\": \"basket-uuid\",\n  \"sessionId\": \"session-uuid\"\n}"

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://santoremedio.mapeiatechcompany.store/pbm/api/v2/cart/notify-pbm")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"document\": \"42799591027\",\n  \"items\": [\n    {\n      \"ean\": 7896261005884,\n      \"requestedQuantity\": 1,\n      \"listPrice\": 10000,\n      \"netPrice\": 10000,\n      \"discountType\": \"B\"\n    }\n  ],\n  \"basketId\": \"basket-uuid\",\n  \"sessionId\": \"session-uuid\"\n}")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://santoremedio.mapeiatechcompany.store/pbm/api/v2/cart/notify-pbm', [
  'body' => '{
  "document": "42799591027",
  "items": [
    {
      "ean": 7896261005884,
      "requestedQuantity": 1,
      "listPrice": 10000,
      "netPrice": 10000,
      "discountType": "B"
    }
  ],
  "basketId": "basket-uuid",
  "sessionId": "session-uuid"
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://santoremedio.mapeiatechcompany.store/pbm/api/v2/cart/notify-pbm");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"document\": \"42799591027\",\n  \"items\": [\n    {\n      \"ean\": 7896261005884,\n      \"requestedQuantity\": 1,\n      \"listPrice\": 10000,\n      \"netPrice\": 10000,\n      \"discountType\": \"B\"\n    }\n  ],\n  \"basketId\": \"basket-uuid\",\n  \"sessionId\": \"session-uuid\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [
  "document": "42799591027",
  "items": [
    [
      "ean": 7896261005884,
      "requestedQuantity": 1,
      "listPrice": 10000,
      "netPrice": 10000,
      "discountType": "B"
    ]
  ],
  "basketId": "basket-uuid",
  "sessionId": "session-uuid"
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://santoremedio.mapeiatechcompany.store/pbm/api/v2/cart/notify-pbm")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```