Card
Cards act as secondary identifiers for customers and can be used for checkins or ordering. We support two different types of cards: first-party and third-party.
These APIs are available using both the /user/card route path and the /user/card3rdparty route path, depending on the type of card you mean to work with.
Retrieve a list of cards
This request returns a list of all cards a user has linked to their account. The internal reference numbers for each card can be found here, which allows a specific card to be accessed at a later time.
Query parameters
- Name
session_key- Type
- string
- Description
Session token for an end-customer.
Response attributes
- Name
created- Type
- integer
- Description
The date this card was added to the system, listed as a Unix timestamp in seconds from 1970-01-01 00:00:00.
- Name
number- Type
- string
- Description
The number found on the actual card itself.
- Name
pin- Type
- string
- Description
The personal identification number linked to this card.
- Name
status- Type
- object
- Description
An object that contains information about the current status of the card.
- Name
type- Type
- object
- Description
An internal reference number that indicates the type of the current card.
- Name
updated- Type
- integer
- Description
The last date this card was updated in the system, listed as a Unix timestamp in seconds from 1970-01-01 00:00:00.
Request
curl -G https://api.spoonity.com/user/card/list?session_key={session_key}
Response
{
"count": 1,
"data": [
{
"card": {
"created": 1559520000,
"number": "9999016134385493",
"pin": "123",
"status": {
"id": 1,
"name": "Active",
"object": "status"
},
"type": {},
"updated": 1559520000
},
"created": 1559584453,
"id": "1817015",
"object": "user_card",
"status": {
"id": 1,
"name": "Active",
"object": "status"
},
"updated": 1559584453,
"user": {}
}
],
"next_page_url": "https://api.staging.spoonity.com/user/card/list?session_key=b63d345b0323a1efbe324b9373366ca2&page=2&limit=0",
"object": "collection",
"page": 1,
"page_size": 0,
"previous_page_url": null,
"total_pages": 0
}
Link a card
This request adds a new card to a user's account. Once added, a "user_card" object is created that links this card with this user. Referencing this object gives us access to both the card and the user, which is important for future requests.
Query parameters
- Name
session_key- Type
- string
- Description
Session token for an end-customer.
Required attributes
- Name
user- Type
- integer
- Description
The internal reference number specific to the user logged into this session.
- Name
number- Type
- string
- Description
The card number of the card being added.
- Name
number- Type
- string
- Description
The pin associated with this card, required for all
/cardpaths, optional for all/card3rdpartypaths.
Response attributes
- Name
created- Type
- integer
- Description
The date this card was added to the system, listed as a Unix timestamp in seconds from 1970-01-01 00:00:00.
- Name
number- Type
- string
- Description
The number found on the actual card itself.
- Name
pin- Type
- string
- Description
The personal identification number linked to this card.
- Name
status- Type
- object
- Description
An object that contains information about the current status of the card.
- Name
type- Type
- object
- Description
An internal reference number that indicates the type of the current card.
- Name
updated- Type
- integer
- Description
The last date this card was updated in the system, listed as a Unix timestamp in seconds from 1970-01-01 00:00:00.
Request
curl -G https://api.spoonity.com/user/card/add?session_key={session_key} \
-d '{
"user": "{user_id}",
"number": "4242424242424242",
"pin": "123",
}'
Response
{
"card": {
"created": 1559520000,
"number": "9999016134385493",
"pin": "123",
"status": {
"id": 1,
"name": "Active",
"object": "status"
},
"type": {},
"updated": 1559520000
},
"created": 1559584453,
"id": "1817015",
"object": "user_card",
"status": {
"id": 1,
"name": "Active",
"object": "status"
},
"updated": 1559584453,
"user": {}
}
Mark a card as lost
Referencing the link between a user and a specific card, this request updates a given card as lost by changing its status to "inactive".
Query parameters
- Name
session_key- Type
- string
- Description
Session token for an end-customer.
Required attributes
- Name
user_card- Type
- integer
- Description
The internal reference number that refers to the lost card as it is linked with the user's account.
Request
curl -G https://api.spoonity.com/user/card/lost?session_key={session_key} \
--request PUT \
-d '{
"user_card: {user_card}
}'
Response
{}
Mark a card as found
Referencing the link between a user and a specific card, this request updates a given card as found by changing its status to "active".
Query parameters
- Name
session_key- Type
- string
- Description
Session token for an end-customer.
Required attributes
- Name
user_card- Type
- integer
- Description
The internal reference number that refers to the lost card as it is linked with the user's account.
Request
curl -G https://api.spoonity.com/user/card/found?session_key={session_key} \
--request PUT \
-d '{
"user_card: {user_card}
}'
Response
{}
Remove a card
Referencing the link between a user and a specific card, this request deletes a given card from a user's account.
Query parameters
- Name
session_key- Type
- string
- Description
Session token for an end-customer.
Required attributes
- Name
user_card- Type
- integer
- Description
The internal reference number that refers to the card being removed from the user's account.
Request
curl -G https://api.spoonity.com/user/card?session_key={session_key} \
--request DELETE \
-d '{
"user_card: {user_card}
}'
Response
{}