Container service for Transbank OneClick API using MongoDB as database storage.
- MongoDB v4+ required
- NOTE: For security reasons, prevent exposing this API directly at client-side applications.
MONGO_URL: MongoDB URL, required (i.e. mongodb://mongo/app)
BASE_URL: Base URL for cloud setup, a path in URL is supported (i.e. https://myservices.com/tbk-oneclick/)
API_KEY: Service API Key (required)
ENCRYPTION_KEY: Key for URL encrypt/decrypt (optional, must be 32 chars length)
TBK_CODE: OneClick Mall Store Code for production (a.k.a código comercio)
TBK_KEY: OneClick Mall API Key for production
TBK_SUCCESS_URL: OneClick Inscription success URL
TBK_FAILED_URL: OneClick Inscription failed URL
DEBUG_LOGS: Enable debug logs in production environment
Pull image
docker pull npulidom/tbk-oneclick
Run the container
docker run -p 8080:80 --env-file .env npulidom/tbk-oneclick
Content-Type: application/json
Authorization: Bearer {token}
(optional)
Endpoint for service health checks.
curl -i https://{host}/health
Body Params
- userId
ObjectId.string
- email
string
curl -iX POST -H 'Content-Type: application/json' -H 'Authorization: Bearer {API-KEY}' -d '{ "userId": "6517213dd708e471d4f1cc46", "email": "[email protected]" }' {BASE_URL}/inscription/create
Body Params
- inscriptionId
ObjectId.string
- userId
ObjectId.string
curl -iX POST -H 'Content-Type: application/json' -H 'Authorization: Bearer {API-KEY}' -d '{ "userId": "6517213dd708e471d4f1cc46", "inscriptionId": "651749a3ab79729b9f5effad" }' {BASE_URL}/inscription/delete
Body Params
- userId
ObjectId.string
- inscriptionId
ObjectId.string
(optional, use first inscription found for given userId) - commerceCode
string
- buyOrder
string
- amount
number
- shares
number
curl -iX POST -H 'Content-Type: application/json' -H 'Authorization: Bearer {API-KEY}' -d '{ "userId": "6517213dd708e471d4f1cc46", "inscriptionId": "651749a3ab79729b9f5effad", "commerceCode": "597055555542", "buyOrder": "12345678", "amount": 1000, "shares": 0 }' {BASE_URL}/inscription/charge
Body Params
- commerceCode
string
- buyOrder
string
- authCode
string
- amount
number
curl -iX POST -H 'Content-Type: application/json' -H 'Authorization: Bearer {API-KEY}' -d '{ "commerceCode": "597055555542", "buyOrder": "12345678", "authCode": "123456", "amount": 800 }' {BASE_URL}/inscription/refund
// output response ok
{
"status": "ok",
...payload
}
// output response error
{
"status": "error",
"error": "SOME_ERROR"
}
# Credit Card
4051885600446623 (success)
5186059559590568 (fail)
CV: 123
# Debit Card
4051884239937763 (success)
5186008541233829 (fail)
# Prepaid Card
4051886000056590 (Visa success)
5186174110629480 (Mastercard success)
CV: 123
# Commerce Codes (OneClick Mall)
597055555541 (Mall)
597055555542 (Store 1)
597055555543 (Store 2)
# Certification Login
user: 11111111-1
pass: 123