# Cards

Card user, product, transactions and setup endpoints

## GET /api/cards/create-card-user

> Status check for create-card-user API

```json
{"openapi":"3.0.3","info":{"title":"Madra Finance Cards API","version":"1.0.0"},"tags":[{"name":"Cards","description":"Card user, product, transactions and setup endpoints"}],"servers":[{"url":"https://platform.madra.finance","description":"Production environment"}],"paths":{"/api/cards/create-card-user":{"get":{"tags":["Cards"],"summary":"Status check for create-card-user API","operationId":"getCardUserStatus","responses":{"200":{"description":"API status","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}}}}}}}}}}}
```

## Create a new card user

> Creates a Marqeta card user with first name, last name, and wallet address.

```json
{"openapi":"3.0.3","info":{"title":"Madra Finance Cards API","version":"1.0.0"},"tags":[{"name":"Cards","description":"Card user, product, transactions and setup endpoints"}],"servers":[{"url":"https://platform.madra.finance","description":"Production environment"}],"paths":{"/api/cards/create-card-user":{"post":{"tags":["Cards"],"summary":"Create a new card user","description":"Creates a Marqeta card user with first name, last name, and wallet address.","operationId":"createCardUser","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["firstName","lastName","walletAddress"],"properties":{"firstName":{"type":"string"},"lastName":{"type":"string"},"walletAddress":{"type":"string"}}}}}},"responses":{"200":{"description":"Card user created","content":{"application/json":{"schema":{"type":"object","properties":{"userResult":{"type":"object","additionalProperties":true}}}}}},"400":{"description":"Missing required fields"},"404":{"description":"User not found"},"500":{"description":"Internal server error"}}}}}}
```

## POST /api/cards/create-card-product

> Fetch and store card products

```json
{"openapi":"3.0.3","info":{"title":"Madra Finance Cards API","version":"1.0.0"},"tags":[{"name":"Cards","description":"Card user, product, transactions and setup endpoints"}],"servers":[{"url":"https://platform.madra.finance","description":"Production environment"}],"paths":{"/api/cards/create-card-product":{"post":{"tags":["Cards"],"summary":"Fetch and store card products","operationId":"createCardProduct","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["cardUserId"],"properties":{"cardUserId":{"type":"string"}}}}}},"responses":{"200":{"description":"Card products fetched and stored","content":{"application/json":{"schema":{"type":"object","properties":{"cardProductResult":{"type":"object","additionalProperties":true}}}}}},"500":{"description":"Internal server error"}}}}}}
```

## GET /api/cards/create-card

> Status check for create-card API

```json
{"openapi":"3.0.3","info":{"title":"Madra Finance Cards API","version":"1.0.0"},"tags":[{"name":"Cards","description":"Card user, product, transactions and setup endpoints"}],"servers":[{"url":"https://platform.madra.finance","description":"Production environment"}],"paths":{"/api/cards/create-card":{"get":{"tags":["Cards"],"summary":"Status check for create-card API","operationId":"getCreateCardStatus","responses":{"200":{"description":"API status","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}}}}}}}}}}}
```

## POST /api/cards/create-card

> Create card using card product and user token

```json
{"openapi":"3.0.3","info":{"title":"Madra Finance Cards API","version":"1.0.0"},"tags":[{"name":"Cards","description":"Card user, product, transactions and setup endpoints"}],"servers":[{"url":"https://platform.madra.finance","description":"Production environment"}],"paths":{"/api/cards/create-card":{"post":{"tags":["Cards"],"summary":"Create card using card product and user token","operationId":"createCard","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["cardProductToken","userToken"],"properties":{"cardProductToken":{"type":"string"},"userToken":{"type":"string"},"walletAddress":{"type":"string"}}}}}},"responses":{"200":{"description":"Card created","content":{"application/json":{"schema":{"type":"object","properties":{"cardCreateResult":{"type":"object","additionalProperties":true},"cardResult":{"type":"object","additionalProperties":true}}}}}},"400":{"description":"Missing required parameters"},"404":{"description":"User not found"},"500":{"description":"Internal server or Marqeta API error"}}}}}}
```

## GET /api/cards/fund-card

> Status check for fund-card API

```json
{"openapi":"3.0.3","info":{"title":"Madra Finance Cards API","version":"1.0.0"},"tags":[{"name":"Cards","description":"Card user, product, transactions and setup endpoints"}],"servers":[{"url":"https://platform.madra.finance","description":"Production environment"}],"paths":{"/api/cards/fund-card":{"get":{"tags":["Cards"],"summary":"Status check for fund-card API","operationId":"getFundCardStatus","responses":{"200":{"description":"API status","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}}}}}}}}}}}
```

## POST /api/cards/fund-card

> Fund card

```json
{"openapi":"3.0.3","info":{"title":"Madra Finance Cards API","version":"1.0.0"},"tags":[{"name":"Cards","description":"Card user, product, transactions and setup endpoints"}],"servers":[{"url":"https://platform.madra.finance","description":"Production environment"}],"paths":{"/api/cards/fund-card":{"post":{"tags":["Cards"],"summary":"Fund card","operationId":"fundCard","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["user_token","amount","currencyCode"],"properties":{"user_token":{"type":"string"},"amount":{"type":"number"},"currencyCode":{"type":"string"}}}}}},"responses":{"200":{"description":"Card funded","content":{"application/json":{"schema":{"type":"object","properties":{"fundCardResult":{"type":"object","additionalProperties":true}}}}}},"400":{"description":"Missing required fields"},"500":{"description":"Internal server or Marqeta API failure"}}}}}}
```

## GET /api/cards/send-transaction

> Status check for send-transaction API

```json
{"openapi":"3.0.3","info":{"title":"Madra Finance Cards API","version":"1.0.0"},"tags":[{"name":"Cards","description":"Card user, product, transactions and setup endpoints"}],"servers":[{"url":"https://platform.madra.finance","description":"Production environment"}],"paths":{"/api/cards/send-transaction":{"get":{"tags":["Cards"],"summary":"Status check for send-transaction API","operationId":"getSendTransactionStatus","responses":{"200":{"description":"API status","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}}}}}}}}}}}
```

## POST /api/cards/send-transaction

> Send card transaction

```json
{"openapi":"3.0.3","info":{"title":"Madra Finance Cards API","version":"1.0.0"},"tags":[{"name":"Cards","description":"Card user, product, transactions and setup endpoints"}],"servers":[{"url":"https://platform.madra.finance","description":"Production environment"}],"paths":{"/api/cards/send-transaction":{"post":{"tags":["Cards"],"summary":"Send card transaction","operationId":"sendCardTransaction","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["amount","card_token","card_acceptor_mid","network"],"properties":{"amount":{"type":"number"},"card_token":{"type":"string"},"card_acceptor_mid":{"type":"string"},"network":{"type":"string"},"webhook":{"type":"string"}}}}}},"responses":{"200":{"description":"Transaction simulated","content":{"application/json":{"schema":{"type":"object","properties":{"simulationResult":{"type":"object","additionalProperties":true}}}}}},"400":{"description":"Missing required fields"},"500":{"description":"Internal server or Marqeta API failure"}}}}}}
```

## GET /api/cards/setup

> Status check for card setup API

```json
{"openapi":"3.0.3","info":{"title":"Madra Finance Cards API","version":"1.0.0"},"tags":[{"name":"Cards","description":"Card user, product, transactions and setup endpoints"}],"servers":[{"url":"https://platform.madra.finance","description":"Production environment"}],"paths":{"/api/cards/setup":{"get":{"tags":["Cards"],"summary":"Status check for card setup API","operationId":"getCardSetupStatus","responses":{"200":{"description":"API status","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}}}}}}}}}}}
```

## POST /api/cards/setup

> Setup card user, products, and card in one workflow

```json
{"openapi":"3.0.3","info":{"title":"Madra Finance Cards API","version":"1.0.0"},"tags":[{"name":"Cards","description":"Card user, product, transactions and setup endpoints"}],"servers":[{"url":"https://platform.madra.finance","description":"Production environment"}],"paths":{"/api/cards/setup":{"post":{"tags":["Cards"],"summary":"Setup card user, products, and card in one workflow","operationId":"setupCardWorkflow","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["firstName","lastName","walletAddress"],"properties":{"firstName":{"type":"string"},"lastName":{"type":"string"},"walletAddress":{"type":"string"}}}}}},"responses":{"200":{"description":"Setup complete with user, products and card created","content":{"application/json":{"schema":{"type":"object","properties":{"userResult":{"type":"object","additionalProperties":true},"cardProductResult":{"type":"object","additionalProperties":true},"cardCreateResult":{"type":"object","additionalProperties":true},"card":{"type":"object","additionalProperties":true}}}}}},"400":{"description":"Missing required fields"},"404":{"description":"User not found"},"500":{"description":"Internal server error during setup"}}}}}}
```
