> For the complete documentation index, see [llms.txt](https://apidocs.akinon.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://apidocs.akinon.com/commerce-openapis/dynamic-bin-scheduler/pre-order/assign-raw-card-to-basket.md).

# Assign raw card to basket

Assigns a raw credit/debit card number to a basket and returns eligible promotion activations. Functionally identical to `POST /preorder/card/`.

**Flow:**

1. Extracts BIN-6 from the card number (first 6 digits).
2. Checks whether any active promotions include that BIN for the given currency.
3. If no match: clears existing `PreOrder`/`PreOrderCall` for this basket, returns `[]`.
4. Calls TapPay to tokenise the card and retrieve its fingerprint.
5. Creates or updates the `PreOrder` record (basket ↔ tokenized card mapping).
6. Deletes and recreates `PreOrderCall` records for each matching promotion.
7. Returns one `{basket_offer_id, session_code}` entry per matching `BasketOffer` ID.

**Constraint:** Card number must be 15 or 16 digits.

```json
{"openapi":"3.0.3","info":{"title":"Bankaci API","version":"1.0.0"},"tags":[{"name":"PreOrder","description":"Assign a card to a basket and retrieve eligible promotion activations"}],"servers":[{"url":"{BASE_URL}/api/v1","description":"Bankaci API","variables":{"BASE_URL":{"default":"https://your-bankaci-instance.example.com","description":"Base URL of the Bankaci service"}}}],"paths":{"/preorder/":{"post":{"tags":["PreOrder"],"summary":"Assign raw card to basket","description":"Assigns a raw credit/debit card number to a basket and returns eligible promotion\nactivations. Functionally identical to `POST /preorder/card/`.\n\n**Flow:**\n1. Extracts BIN-6 from the card number (first 6 digits).\n2. Checks whether any active promotions include that BIN for the given currency.\n3. If no match: clears existing `PreOrder`/`PreOrderCall` for this basket, returns `[]`.\n4. Calls TapPay to tokenise the card and retrieve its fingerprint.\n5. Creates or updates the `PreOrder` record (basket ↔ tokenized card mapping).\n6. Deletes and recreates `PreOrderCall` records for each matching promotion.\n7. Returns one `{basket_offer_id, session_code}` entry per matching `BasketOffer` ID.\n\n**Constraint:** Card number must be 15 or 16 digits.\n","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PreorderCardRequest"}}}},"responses":{"200":{"description":"Eligible promotion activations","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BasketOfferResponse"}}}},"422":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationError"}}}}}}}},"components":{"schemas":{"PreorderCardRequest":{"type":"object","required":["card_number","basket_id","basket_modified_date"],"properties":{"card_number":{"type":"string","description":"Raw card number. Must be exactly 15 or 16 digits."},"basket_id":{"type":"integer","description":"Omnitron basket ID"},"basket_modified_date":{"type":"string","format":"date-time","description":"Last modification timestamp of the basket (ISO 8601)"},"currency":{"$ref":"#/components/schemas/CurrencyType"}}},"CurrencyType":{"type":"string","enum":["try","eur","usd","egp","gbp","mad","pln","sar","ron","uah","czk","huf","rub","bgn","iqd","kwd","bhd","omr","qar","aed","ngn","inr","lei","kzt","jod","rsd"],"description":"ISO 4217 currency codes supported by Bankaci"},"BasketOfferResponse":{"type":"object","properties":{"basket_offers":{"type":"array","items":{"$ref":"#/components/schemas/BasketOfferItem"},"description":"Basket offer activations eligible for this card/basket combination.\nEmpty array when no promotions match the card BIN.\n"}}},"BasketOfferItem":{"type":"object","properties":{"basket_offer_id":{"type":"integer","description":"Omnitron BasketOffer ID to activate for this basket"},"session_code":{"type":"string","format":"uuid","description":"Unique session UUID linking this activation to its `PreOrderCall` record.\nUsed internally for usage verification.\n"}}},"ValidationError":{"type":"object","properties":{"detail":{"type":"array","items":{"type":"object","properties":{"loc":{"type":"array","items":{"type":"string"}},"msg":{"type":"string"},"type":{"type":"string"}}}}}}}}}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://apidocs.akinon.com/commerce-openapis/dynamic-bin-scheduler/pre-order/assign-raw-card-to-basket.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
