API Tarjeta de Fidelización
Encuentra aquí toda la información necesaria para la integración de tu tarjeta de fidelización con el TPV de tu local.
Índice
Definición Tarjeta de Fidelización
Parámetros
Contenido
Ejemplo
Definición servicio Web
Asignación de un ticket a un usuario en Cheerfy
1. Definición Tarjeta de Fidelización
1.1. Parámetros
Una tarjeta de fidelización deberá contener obligatoriamente 1 parámetro:
user_id : Identificador único que identifica al cliente (en Cheerfy).
El formato del user_id es un campo alfanumérico con un número variable de caracteres.
1.2. Contenido
El QR code contendrá el parámetro definido en la sección "Parámetros" sin saltos de línea.
El contenido al escanear un código QR (o de barras) de una tarjeta de fidelización debería ser algo parecido a esto (es un mero ejemplo):
1.3. Ejemplo
Adjuntamos un código QR, con el código de ejemplo anterior, por si es necesario hacer una prueba por parte del proveedor del TPV.
2. Definición servicios Web
Las llamadas desde el TPV a Cheerfy se harán mediante servicios Web de tipo REST y con contenido definido en formato JSON.
Cada llamada deberá contener una serie de parámetros obligatorios en la cabecera (además de los propios parámetros del servicio que se invoque), estos parámetros de la cabecera indicarán:
1. El contenido tiene formato JSON
2. Los datos de autenticación de la llamada
2.1. Asignación de un ticket a un usuario en Cheerfy
Una vez el TPV escanea un código de tarjeta de fidelización (user_id), se lo tiene que comunicar a Cheerfy conjuntamente con el ticket de su transacción. Y, para ello, necesita llamar a un servicio Web REST.
La respuesta en el caso de error, por ahora no contendrá datos del estado de la tarjeta de fidelización (ej. cancelada), ya que Cheerfy muestra esa información en la tarjeta de fidelización, no obstante, es un dato que podría incluirse en próximas versiones.
URL
Método HTTP
Parámetros de la cabecera:
Field | Type | Description |
Content-Type | String | Data application raw type. |
Authorization | String | Admin unique access-key (Content must start by Token). |
Parámetros de la llamada:
Field | Type | Description |
id | String | Ticket unique identifier. Can be a string, it should be unique within the organization |
ticket_numberoptional | Number | Ticket identifier. Not necessarily unique |
rectification_idoptional | String | Ticket unique identifier from the rectification ticket (total or partial refund). Can be a string, it should be unique within the organization |
created_atoptional | Long | Timestamp when the ticket was created, format UNIX epoch, Example: 1419992910. If not present, set current datetime |
status | Number | Ticket current status. Values: TICKET_STATUS_REQUESTED = 3, TICKET_STATUS_CANCELLED = 2, TICKET_STATUS_CONFIRMED = 4, TICKET_STATUS_READY = 5, TICKET_STATUS_ON_ROUTE = 6, TICKET_STATUS_COMPLETED = 1 |
channeloptional | Number | API request origin. Values: 1- SHOP (TPV) (default), 2 - ONLINE (Web, APP, etc) |
nameoptional | String | Given name (human readable) to the ticket |
additional_dataoptional | String | Place here any relevant information you want to persist into the system |
summary | Object | Ticket summary data |
subtotal | Number | Total amount before taxes and fees (only apply to ticket items. Format is a number. Value unit is in cents, it means that if you have 10.56€ value will be 1056, while a value of 15€ will be 1500 |
service_feeoptional | Number | Service fee amount before taxes. Format is a number. Value unit is in cents, it means that if you have 1.60€ value will be 160, while a value of 0.95€ will be 95 |
other_feesoptional | Number | Other fees not included into subtotal or service fee. Format is a number. Value unit is in cents, it means that if you have 0.30€ value will be 30, while a value of 0.05€ will be 5 |
taxes | Number | Taxes amount applied to all the ticket items and fees. Format is a number. Value unit is in cents, it means that if you have 2.75€ value will be 275, while a value of 1.9€ will be 190 |
tipoptional | Number | Tips amount, this value does not implies taxes. Format is a number. Value unit is in cents, it means that if you have 5€ value will be 500, while a value of 2.99€ will be 299 |
total | Number | Total amount including taxes, fees and tips, it is the price which the user has to pay. Format is a number. Value unit is in cents, it means that if you have 150.20€ value will be 15020, while a value of 75.79 will be 7579 |
due | Number | Amount given by the user. Format is a number. Value unit is in cents, it means that if you have 150.20€ value will be 15020, while a value of 75.79 will be 7579 |
discount_amountoptional | Number | Total discount applied to the ticket. Format is a number. Value unit is in cents, it means that if you have 150.20€ value will be 15020, while a value of 75.79 will be 7579 |
currency | String | 3 letters ISO 4217 Code for currencies, upper case value. https://www.iso.org/iso-4217-currency-codes.html |
deliveryoptional | Object | Ticket delivery data if any |
pick_up_address | String | Address where the order needs to be picked up. Exclude fields typically added as address line 2 such as building block or door number |
pick_up_atoptional | Long | Timestamp when the order has to be picked up, format UNIX epoch, Example: 1419992910. If not present, set current datetime |
drop_off_address | String | Address where the order needs to be dropped off |
drop_off_address_latitudeoptional | Float | Geo latitude of the drop off address |
drop_off_address_longitudeoptional | Float | Geo longitude of the drop off address |
drop_off_atoptional | Long | Timestamp when the order has to be dropped off, format UNIX epoch, Example: 1419992910. If not present, set current datetime |
drop_off_notesoptional | String | Address or delivery additional notes |
contact_phone_numberoptional | String | Contact user phone for courier usage |
serviceoptional | Object | Ticket service data |
service_type | Number | Service type. Values: 1 - DELIVERY, 2 - TAKE AWAY, 3 - DINE IN, 4 - BOOKING |
table_id | String | Shop table id, usually attached to Dine in service type |
ready_at | Long | Timestamp when the order needs to be ready, format UNIX epoch, Example: 1419992910. If not present, set current datetime |
now | Boolean | Service type now true or false |
payments | Object[] | List of payment items included into the ticket |
type | Number | Values: 1 - CASH, 2 - CREDIT CARD, 3 - OTHERS |
amount | Number | Total amount paid by the user. Format is a number. Value unit is in cents, it means that if you have 10.56€ value will be 1056, while a value of 15€ will be 1500 |
card_detailsoptional | String | Credit card details (masked) in case type is 2 |
idoptional | Number | Payment unique identifier, if available |
useroptional | Object | User information - optional field |
idoptional | String | Unique user identifier |
external_idoptional | String | Unique external user identifier |
emailoptional | String | User email |
phoneoptional | String | User phone number |
nameoptional | String | User first name, utf-8 encoding |
surnameoptional | String | User surname, utf-8 encoding |
addressoptional | String | User full address |
cityoptional | String | Address city |
zipcodeoptional | String | Address zipcode |
countryoptional | String | Address country. Format ISO 3166 alpha 2 codes (UPPERCASE) https://www.iso.org/iso-3166-country-codes.html |
languageoptional | String | User language. Format ISO 639 alpha 2 codes (LOWERCASE) https://www.iso.org/iso-639-language-codes.html |
genderoptional | Number | User gender. Values: 1 - MALE, 2 - FEMALE, 3 - OTHER, 4 - N/A |
items | Object[] | List of items included into the ticket |
item_idoptional | String | Unique product item identifier from the list of items. Example: item order from ticket |
ref_item_idoptional | String | Reference to unique product item id, in case, current item is attached to another ticket item. Example: Promotion applied to a parent item id |
sku_codeoptional | String | External product item identifier |
nameoptional | String | Human readable product item name |
voucher_codeoptional | String | Promotion unique identifier. Example: User has a promotional code and attached to the ticket order |
quantity | Number | Number of same items into the ticket |
subtotal | Number | Total amount before taxes applied to the current ticket item. Format is a number. Value unit is in cents, it means that if you have 10.56€ value will be 1056, while a value of 15€ will be 1500 |
taxes | Number | Taxes amount applied to the current ticket item. Format is a number. Value unit is in cents, it means that if you have 2.75€ value will be 275, while a value of 1.9€ will be 190 |
total | Number | Total amount after taxes applied to the current ticket item. Format is a number. Value unit is in cents, it means that if you have 10.56€ value will be 1056, while a value of 15€ will be 1500 |
modifiersoptional | Object[] | List of item modifiers included into the ticket item |
sku_codeoptional | String | External product modifier identifier |
nameoptional | String | Human readable product modifier name |
quantity | Number | Number of same modifier into the item |
subtotaloptional | Number | Total amount before taxes applied to the current item modifier. Format is a number. Value unit is in cents, it means that if you have 10.56€ value will be 1056, while a value of 15€ will be 1500 |
taxesoptional | Number | Taxes amount applied to the current item modifier. Format is a number. Value unit is in cents, it means that if you have 2.75€ value will be 275, while a value of 1.9€ will be 190 |
totaloptional | Number | Total amount after taxes applied to the current item modifier. Format is a number. Value unit is in cents, it means that if you have 10.56€ value will be 1056, while a value of 15€ will be 1500 |
combos | Object[] | List of combos included into the ticket |
item_idoptional | String | Unique combo item identifier from the list of items. Example: item order from ticket |
ref_item_idoptional | String | Reference to unique combo item id, in case, current item is attached to another ticket item. Example: Promotion applied to a parent item id |
sku_codeoptional | String | External combo item identifier |
nameoptional | String | Human readable combo item name |
voucher_codeoptional | String | Promotion unique identifier. Example: User has a promotional code and attached to the ticket order |
quantity | Number | Number of same combo into the ticket |
subtotal | Number | Total amount before taxes applied to the current ticket combo. Format is a number. Value unit is in cents, it means that if you have 10.56€ value will be 1056, while a value of 15€ will be 1500 |
taxes | Number | Taxes amount applied to the current ticket combo. Format is a number. Value unit is in cents, it means that if you have 2.75€ value will be 275, while a value of 1.9€ will be 190 |
total | Number | Total amount after taxes applied to the current ticket combo. Format is a number. Value unit is in cents, it means that if you have 10.56€ value will be 1056, while a value of 15€ will be 1500 |
modifiersoptional | Object[] | List of item modifiers included into the ticket combo |
sku_codeoptional | String | External combo modifier identifier |
nameoptional | String | Human readable combo modifier name |
quantity | Number | Number of same modifier into the item |
subtotaloptional | Number | Total amount before taxes applied to the current combo modifier. Format is a number. Value unit is in cents, it means that if you have 10.56€ value will be 1056, while a value of 15€ will be 1500 |
taxesoptional | Number | Taxes amount applied to the current combo modifier. Format is a number. Value unit is in cents, it means that if you have 2.75€ value will be 275, while a value of 1.9€ will be 190 |
totaloptional | Number | Total amount after taxes applied to the current combo modifier. Format is a number. Value unit is in cents, it means that if you have 10.56€ value will be 1056, while a value of 15€ will be 1500 |
itemsoptional | Item[] | List of items included into the combo - same definition than Item object |
ticket_promotion_listoptional | Object | List of promotions included into the ticket |
code | String | Code of the promotion |
generated_idoptional | String | Unique ID generated after user apply a promotion code |
nameoptional | String | Name of the promotion |
promotion_type | Number | Promotion type. Values: 1 - FIXED_DISCOUNT, 2 - PERCENT_DISCOUNT |
valueoptional | String | Percentage or fixed value depending on promotion_type |
client_dataoptional | Object | Client data belongs to the app which invokes the service. The parameter must include at least these parameters (you can include as much as you need for debugging): client_type (ANDROID, WEB or IOS) and client_version |
scope | Object | Virtual geographical scope belong to the given request |
locations | Number[] | List of selected locations |
Ejemplo llamada:
Parámetros de la respuesta (código 200 OK):
Field | Type | Description |
ticket | Object | |
id | String | Ticket unique identifier. Can be a string, it should be unique within the organization |
ticket_numberoptional | Number | Ticket identifier. Not necessarily unique |
rectification_idoptional | String | Ticket unique identifier from the rectification ticket (total or partial refund). Can be a string, it should be unique within the organization |
created_atoptional | Long | Timestamp when the ticket was created, format UNIX epoch, Example: 1419992910. If not present, set current datetime |
status | Number | Ticket current status. Values: TICKET_STATUS_REQUESTED = 3, TICKET_STATUS_CANCELLED = 2, TICKET_STATUS_CONFIRMED = 4, TICKET_STATUS_READY = 5, TICKET_STATUS_ON_ROUTE = 6, TICKET_STATUS_COMPLETED = 1 |
channeloptional | Number | API request origin. Values: 1- SHOP (TPV) (default), 2 - ONLINE (Web, APP, etc) |
nameoptional | String | Given name (human readable) to the ticket |
additional_dataoptional | String | Place here any relevant information you want to persist into the system |
ticket_summary | Object | Ticket summary data |
subtotal | Number | Total amount before taxes and fees (only apply to ticket items. Format is a number. Value unit is in cents, it means that if you have 10.56€ value will be 1056, while a value of 15€ will be 1500 |
service_feeoptional | Number | Service fee amount before taxes. Format is a number. Value unit is in cents, it means that if you have 1.60€ value will be 160, while a value of 0.95€ will be 95 |
other_feesoptional | Number | Other fees not included into subtotal or service fee. Format is a number. Value unit is in cents, it means that if you have 0.30€ value will be 30, while a value of 0.05€ will be 5 |
taxes | Number | Taxes amount applied to all the ticket items and fees. Format is a number. Value unit is in cents, it means that if you have 2.75€ value will be 275, while a value of 1.9€ will be 190 |
tipoptional | Number | Tips amount, this value does not implies taxes. Format is a number. Value unit is in cents, it means that if you have 5€ value will be 500, while a value of 2.99€ will be 299 |
total | Number | Total amount including taxes, fees and tips, it is the price which the user has to pay. Format is a number. Value unit is in cents, it means that if you have 150.20€ value will be 15020, while a value of 75.79 will be 7579 |
due | Number | Amount given by the user. Format is a number. Value unit is in cents, it means that if you have 150.20€ value will be 15020, while a value of 75.79 will be 7579 |
discount_amountoptional | Number | Total discount applied to the ticket. Format is a number. Value unit is in cents, it means that if you have 150.20€ value will be 15020, while a value of 75.79 will be 7579 |
currency | String | 3 letters ISO 4217 Code for currencies, upper case value. https://www.iso.org/iso-4217-currency-codes.html |
ticket_deliveryoptional | Object | Ticket delivery data if any |
pick_up_address | String | Address where the order needs to be picked up. Exclude fields typically added as address line 2 such as building block or door number |
pick_up_atoptional | Long | Timestamp when the order has to be picked up, format UNIX epoch, Example: 1419992910. If not present, set current datetime |
drop_off_address | String | Address where the order needs to be dropped off |
drop_off_address_latitudeoptional | Float | Geo latitude of the drop off address |
drop_off_address_longitudeoptional | Float | Geo longitude of the drop off address |
drop_off_atoptional | Long | Timestamp when the order has to be dropped off, format UNIX epoch, Example: 1419992910. If not present, set current datetime |
drop_off_notesoptional | String | Address or delivery additional notes |
contact_phone_numberoptional | String | Contact user phone for courier usage |
ticket_serviceoptional | Object | Ticket service data |
service_type | Number | Service type. Values: 1 - DELIVERY, 2 - TAKE AWAY, 3 - DINE IN, 4 - BOOKING |
table_id | String | Shop table id, usually attached to Dine in service type |
ready_at | Long | Timestamp when the order needs to be ready, format UNIX epoch, Example: 1419992910. If not present, set current datetime |
now | Boolean | Service type now true or false |
ticket_payment_list | Object[] | List of payment items included into the ticket |
type | Number | Values: 1 - CASH, 2 - CREDIT CARD, 3 - OTHERS |
amount | Number | Total amount paid by the user. Format is a number. Value unit is in cents, it means that if you have 10.56€ value will be 1056, while a value of 15€ will be 1500 |
card_detailsoptional | String | Credit card details (masked) in case type is 2 |
idoptional | Number | Payment unique identifier, if available |
useroptional | Object | User information - optional field |
idoptional | String | Unique user identifier |
external_idoptional | String | Unique external user identifier |
emailoptional | String | User email |
phoneoptional | String | User phone number |
nameoptional | String | User first name, utf-8 encoding |
surnameoptional | String | User surname, utf-8 encoding |
addressoptional | String | User full address |
cityoptional | String | Address city |
zipcodeoptional | String | Address zipcode |
countryoptional | String | Address country. Format ISO 3166 alpha 2 codes (UPPERCASE) https://www.iso.org/iso-3166-country-codes.html |
languageoptional | String | User language. Format ISO 639 alpha 2 codes (LOWERCASE) https://www.iso.org/iso-639-language-codes.html |
genderoptional | Number | User gender. Values: 1 - MALE, 2 - FEMALE, 3 - OTHER, 4 - N/A |
ticket_item_list | Object[] | List of items included into the ticket |
item_idoptional | String | Unique product item identifier from the list of items. Example: item order from ticket |
ref_item_idoptional | String | Reference to unique product item id, in case, current item is attached to another ticket item. Example: Promotion applied to a parent item id |
sku_codeoptional | String | External product item identifier |
nameoptional | String | Human readable product item name |
voucher_codeoptional | String | Promotion unique identifier. Example: User has a promotional code and attached to the ticket order |
quantity | Number | Number of same items into the ticket |
subtotal | Number | Total amount before taxes applied to the current ticket item. Format is a number. Value unit is in cents, it means that if you have 10.56€ value will be 1056, while a value of 15€ will be 1500 |
taxes | Number | Taxes amount applied to the current ticket item. Format is a number. Value unit is in cents, it means that if you have 2.75€ value will be 275, while a value of 1.9€ will be 190 |
total | Number | Total amount after taxes applied to the current ticket item. Format is a number. Value unit is in cents, it means that if you have 10.56€ value will be 1056, while a value of 15€ will be 1500 |
modifiersoptional | Object[] | List of item modifiers included into the ticket item |
sku_codeoptional | String | External product modifier identifier |
nameoptional | String | Human readable product modifier name |
quantity | Number | Number of same modifier into the item |
subtotaloptional | Number | Total amount before taxes applied to the current item modifier. Format is a number. Value unit is in cents, it means that if you have 10.56€ value will be 1056, while a value of 15€ will be 1500 |
taxesoptional | Number | Taxes amount applied to the current item modifier. Format is a number. Value unit is in cents, it means that if you have 2.75€ value will be 275, while a value of 1.9€ will be 190 |
totaloptional | Number | Total amount after taxes applied to the current item modifier. Format is a number. Value unit is in cents, it means that if you have 10.56€ value will be 1056, while a value of 15€ will be 1500 |
ticket_combo_list | Object[] | List of combos included into the ticket |
item_idoptional | String | Unique combo item identifier from the list of items. Example: item order from ticket |
ref_item_idoptional | String | Reference to unique combo item id, in case, current item is attached to another ticket item. Example: Promotion applied to a parent item id |
sku_codeoptional | String | External combo item identifier |
nameoptional | String | Human readable combo item name |
voucher_codeoptional | String | Promotion unique identifier. Example: User has a promotional code and attached to the ticket order |
quantity | Number | Number of same combo into the ticket |
subtotal | Number | Total amount before taxes applied to the current ticket combo. Format is a number. Value unit is in cents, it means that if you have 10.56€ value will be 1056, while a value of 15€ will be 1500 |
taxes | Number | Taxes amount applied to the current ticket combo. Format is a number. Value unit is in cents, it means that if you have 2.75€ value will be 275, while a value of 1.9€ will be 190 |
total | Number | Total amount after taxes applied to the current ticket combo. Format is a number. Value unit is in cents, it means that if you have 10.56€ value will be 1056, while a value of 15€ will be 1500 |
modifiersoptional | Object[] | List of item modifiers included into the ticket combo |
sku_codeoptional | String | External combo modifier identifier |
nameoptional | String | Human readable combo modifier name |
quantity | Number | Number of same modifier into the item |
subtotaloptional | Number | Total amount before taxes applied to the current combo modifier. Format is a number. Value unit is in cents, it means that if you have 10.56€ value will be 1056, while a value of 15€ will be 1500 |
taxesoptional | Number | Taxes amount applied to the current combo modifier. Format is a number. Value unit is in cents, it means that if you have 2.75€ value will be 275, while a value of 1.9€ will be 190 |
totaloptional | Number | Total amount after taxes applied to the current combo modifier. Format is a number. Value unit is in cents, it means that if you have 10.56€ value will be 1056, while a value of 15€ will be 1500 |
itemsoptional | Item[] | List of items included into the combo - same definition than Item object |
ticket_promotion_listoptional | Object | List of promotions included into the ticket |
code | String | Code of the promotion |
generated_idoptional | String | Unique ID generated after user apply a promotion code |
nameoptional | String | Name of the promotion |
promotion_type | Number | Promotion type. Values: 1 - FIXED_DISCOUNT, 2 - PERCENT_DISCOUNT |
valueoptional | String | Percentage or fixed value depending on promotion_type |
client_dataoptional | Object | Client data belongs to the app which invokes the service. The parameter must include at least these parameters (you can include as much as you need for debugging): client_type (ANDROID, WEB or IOS) and client_version |
scope | Object | Virtual geographical scope belong to the given request |
locations | Number[] | List of selected locations |
Ejemplo respuesta (200 OK):
Parámetros respuesta (código 400 Invalid Request):
Name | Description |
InvalidData | The given data is not valid |
Ejemplo respuesta (400 Invalid data):
Parámetros respuesta (código 500 Internal Error)
Name | Description |
InternalServer | The server failed. Try again. |
Ejemplo respuesta (500 Internal Error):
En caso de error 500, el TPV internamente intentará volver a llamar 3 veces (una vez cada 1 segundo), en caso de seguir recibiendo error 500, el TPV dejará de intentarlo.
En caso de error 400, la tarjeta está cancelada o el usuario dado de baja, Cheerfy no realizará ninguna asignación del ticket al usuario en cuestión.
Última actualización