-
Notifications
You must be signed in to change notification settings - Fork 0
Tokens
zodiacfireworks edited this page Mar 7, 2021
·
1 revision
Consulta la documentación de Culqi en https://apidocs.culqi.com/#/tokens
def get_token_data(code, provider):
return deepcopy(Data.CARD[code][provider])token_list = culqi.token.list(
data={
"limit": 1,
},
headers={
"Accept-Encoding": "identity",
}
)
display(token_list){
"status": 200,
"data": {
"paging": {
"previous": "https://api.culqi.com/v2/tokens?limit=1&before=tkn_test_CcP3ZegM0zlVNuQv",
"next": "https://api.culqi.com/v2/tokens?limit=1&after=tkn_test_CcP3ZegM0zlVNuQv",
"cursors": {
"before": "tkn_test_CcP3ZegM0zlVNuQv",
"after": "tkn_test_CcP3ZegM0zlVNuQv"
},
"remaining_items": 0
},
"items": [
{
"object": "token",
"id": "tkn_test_CcP3ZegM0zlVNuQv",
"type": "card",
"creation_date": 1615131583000,
"email": "richard0b7f@piedpiper.com",
"card_number": "360001****0007",
"last_four": "0007",
"active": true,
"iin": {
"object": "iin",
"bin": "360001",
"card_brand": "Diners",
"card_type": "credito",
"card_category": null,
"issuer": {
"name": "",
"country": "PERU",
"country_code": "PE",
"website": null,
"phone_number": null
},
"installments_allowed": []
},
"client": {
"ip": "191.98.182.73",
"ip_country": "Peru",
"ip_country_code": "PE",
"browser": "UNKNOWN",
"device_fingerprint": null,
"device_type": "Escritorio"
},
"metadata": {}
}
]
}
}
token_data = get_token_data("successful", "visa")
token = culqi.token.create(data=token_data)
display(token){
"status": 201,
"data": {
"object": "token",
"id": "tkn_test_qW2ETydmZ8CmKZQE",
"type": "card",
"creation_date": 1615131587000,
"email": "richard@piedpiper.com",
"card_number": "411111******1111",
"last_four": "1111",
"active": true,
"iin": {
"object": "iin",
"bin": "411111",
"card_brand": "Visa",
"card_type": "credito",
"card_category": "Clásica",
"issuer": {
"name": "BBVA",
"country": "PERU",
"country_code": "PE",
"website": null,
"phone_number": null
},
"installments_allowed": [
2,
4,
6,
8,
10,
12,
3,
5,
7,
9,
24,
48
]
},
"client": {
"ip": "191.98.182.73",
"ip_country": "Peru",
"ip_country_code": "PE",
"browser": "UNKNOWN",
"device_fingerprint": null,
"device_type": "Escritorio"
},
"metadata": {}
}
}
token_id = token["data"]["id"]
token = culqi.token.read(id_=token_id)
display(token){
"status": 200,
"data": {
"object": "token",
"id": "tkn_test_qW2ETydmZ8CmKZQE",
"type": "card",
"creation_date": 1615131587000,
"email": "richard@piedpiper.com",
"card_number": "411111******1111",
"last_four": "1111",
"active": true,
"iin": {
"object": "iin",
"bin": "411111",
"card_brand": "Visa",
"card_type": "credito",
"card_category": "Clásica",
"issuer": {
"name": "BBVA",
"country": "PERU",
"country_code": "PE",
"website": null,
"phone_number": null
},
"installments_allowed": [
2,
4,
6,
8,
10,
12,
3,
5,
7,
9,
24,
48
]
},
"client": {
"ip": "191.98.182.73",
"ip_country": "Peru",
"ip_country_code": "PE",
"browser": "UNKNOWN",
"device_fingerprint": null,
"device_type": "Escritorio"
},
"metadata": {}
}
}
token_id = token["data"]["id"]
token_metadata = {
"metadata": {
"orderId": "1234567890"
}
}
token = culqi.token.update(id_=token_id, data=token_metadata)
display(token){
"status": 200,
"data": {
"object": "token",
"id": "tkn_test_qW2ETydmZ8CmKZQE",
"type": "card",
"creation_date": 1615131587000,
"email": "richard@piedpiper.com",
"card_number": "411111******1111",
"last_four": "1111",
"active": true,
"iin": {
"object": "iin",
"bin": "411111",
"card_brand": "Visa",
"card_type": "credito",
"card_category": "Clásica",
"issuer": {
"name": "BBVA",
"country": "PERU",
"country_code": "PE",
"website": null,
"phone_number": null
},
"installments_allowed": [
2,
4,
6,
8,
10,
12,
3,
5,
7,
9,
24,
48
]
},
"client": {
"ip": "191.98.182.73",
"ip_country": "Peru",
"ip_country_code": "PE",
"browser": "UNKNOWN",
"device_fingerprint": null,
"device_type": "Escritorio"
},
"metadata": {
"orderId": "1234567890"
}
}
}
SoftButterfly Development Team