Edenred Direct Payment Services
Use Case: Chile
I. Generalities
In Chile, a user can spend the exact amount requested, with a minimum of 1000 CLP for each order. These regulations are handled on the Edenred side. Please note the amount is managed in cents (example 1000 CLP = 100000).
Ticket Restaurant local regulation
In Chile, for the Ticket Restaurant product, a user can:
- Perform a transaction with a minimum of 1000 CLP (which meaning that a transaction of 999 CLP will be declined). Reminder: 1000 CLP corresponds to amount = 100000.
Note this check is performed by the local authorization platform itself. Error code related to those limits are described in the specification of the transaction processing.
Junaeb local regulation
In Chile, for the Ticket Junaeb product, a user can:
- Perform a transaction with a minimum of 200 CLP and a maximum of 320000 CLP (which meaning that a transaction of 199 or 320001 CLP will be declined). Reminder: 200 CLP corresponds to amount = 20000.
- Perform maximum 99 transactions per day.
Note this check is performed by the local authorization platform itself. Error code related to those limits are described in the specification of the transaction processing.
II. User Security Tokens
Please refer to this section for more details about security tokens.
Login
1) To test the API in sandbox, you can get an authorization_code by clicking on the link bellow:
Ticket Restaurant:
Example of account that can be used to test the API:
- Username: 17938390K
- Password: Edenred2020
- PAN: 5305
Junaeb:
Example of account that can be used to test the API:
- Username: 262695484
- Password: Edenred2021
- PAN: 4850
Authentication flow for both
- Login Page
- Card selection
- Confirm 2nd factor (Masked PAN code)
- Accept Term and Conditions
2) After login, you'll be redirected to a url like :
http://nowhere.edenred.net/oauth/callback?code={authorization_code}&...
3) Retrieve the authorization_code in the callback URL and paste it in the body of the request "Get access_token from authorization_code".
You can test our APIs in the following collection of API calls :
Ticket Restaurant:
Junaeb:
Please note that an authorization_code is burned every time you try to use it. If your API call fails, you must get a new authorization_code.
Logout
Enable to Logout the user and his Edenred account from your platform.
All tokens (refresh, accesss....) are then invalid
GET /connect/endsession?id_token_hint==HTTP/1.1
Host: {{authentication-URL}}
Where
- 'authentication-URL' = {{authentication-URL}} (check Home page to get the URL per environment)
- And 'idToken' is retrieved from the refreshing token response
- And 'postLogoutRedirectUri' is a callback URL whitelisted on our side (to be provided in the configuration request) . eg: postLogoutRedirectUri = http://nowhere.edenred.net/oauth/callback
III. Direct Payment API
If you use the postman collection, the access_token will automatically be placed in your HTTP Authorization header.
####
Get Balances
Get the balance which is available on the user's account.
The authorization header is mandatory for this request.
Request:
GET /v2/users/{username} HTTP/1.1
Host: {{payment-URL}} (https://directpayment.stg.eu.edenred.io/v2)
Authorization: Bearer {{token}}
X-Client-Id: {{payment-clientId}}
X-Client-Secret: {{payment-clientSecret}}
Response:
{
    "meta": {
        "status": "succeeded",
        "messages": []
    },
    "data": [
        {
            "available_amount": 224300,
            "currency": "CLP"
        }
    ]
}
Estimate Charge
Check if an amount can be spent and answer the possible amount that can be spent. If the requested amount is above the available balance, the service will provide the available amount in the response.
The authorization header is mandatory for this request.
Request:
POST /v2/users/{{username}}/actions/estimate-charge HTTP/1.1
Host: directpayment.stg.eu.edenred.io
Authorization: Bearer {{token}}
X-Client-Id: {{payment-clientId}}
X-Client-Secret: {{payment-clientSecret}}
Content-Type: application/json
{
"amount": 300000
}
Response:
{
    "meta": {
        "status": "succeeded",
        "messages": []
    },
    "data": {
        "available_amount": 224300,
        "currency": "CLP"
    }
}
####
Payment
There is only one capture method supported on the authorization platform : automatic capture of the payment (Capture Mode is set to Auto).
An auto capture can only be requested with an amount in CLP.
The authorization header should be set for this operation.
The idempotency/duplicate check is applied based on the "username / amount / MID" check. Timestamp is not mandatory to trigger the idempotency/duplicate check on the authorization platform.
Request:
POST /v2/transactions HTTP/1.1
Host: directpayment.stg.eu.edenred.io
Authorization: Bearer {{token}}
X-Client-Id: {{payment-clientId}}
X-Client-Secret: {{payment-clientSecret}}
Content-Type: application/json
{
  "mid": "{{mid}}",
  "order_ref": "Test290121",
  "amount": 100000,
  "capture_mode": "auto",
  "security_level": "standard",
  "currency": "CLP",
  "tstamp": "2021-01-29T10:31:09Z"
}
Response:
{
    "meta": {
        "status": "succeeded",
        "messages": []
    },
    "data": {
        "order_ref": "Test290121",
        "mid": "1",
        "authorization_id": "b9064d12-93f9-46bf-921b-11f24e58e5b2",
        "authorized_amount": 100000,
        "capture_id": "752947",
        "captured_amount": 100000,
        "status": "captured"
    }
}
Please keep in mind that the minimum amount is 1000 CLP (which represents amount=100000).
Order_ref must be updated for every transaction.
####
Refund a captured payment
Once captured, a transaction can be refunded.
The authorization_id provided during the payment process must be provided in this request.
the exact "capture_amount" must be provided in the amount field. No partial refund supported
The Authorization {{bearer}} don't have to be provided in the header for this operation.
The authorization_id is used by the platform to retrieve the existing authorization and process the enrichment of the request with the information of this transaction.
Request:
POST /v2/transactions/{[authorization_id}}/actions/refund HTTP/1.1
Host: directpayment.stg.eu.edenred.io
X-Client-Id: {{payment-clientId}}
X-Client-Secret: {{payment-clientSecret}}
Content-Type: application/json
{
"amount": 100000,
"currency": "CLP",
"tstamp": "2021-01-29T14:02:50Z"
}
Response
{
    "meta": {
       "status": "succeeded",
        "messages": []
    },
    "data": {
        "mid": "1",
        "refund_id": "b124de1c-df0f-4f26-aefd-0b98b7e96b29",
        "refunded_amount": 100000,
        "status": "refunded"
    }
}
Mapped status codes
Status Code | Status | Code | Level | Description |
---|---|---|---|---|
200 | succeded | OK | Success | OK |
200 | succeded | SUCCESS | Success | SUCCEEDED |
200 | succeded | TRANSACTION_OK | Success | Transaction Ok |
200 | succeded | AUTH | Success | The transaction has been authorized. |
200 | succeded | AUTH_PENDING | Success | The transaction authorization is pending. |
200 | succeded | PARTIAL_AUTH | Success | The transaction has been partially authorized. |
200 | succeded | SUCCEEDED | Success | OK |
400 | failed | INVALID_USER | Error | Invalid User |
400 | failed | BAD_REQUEST | Error | The input doesn't respect the contract expected (required fields, type, etc.) |
400 | failed | EMPTY_AUTHORIZATION_TOKEN | Error | Unable to retrieve the OpenId token from the request. Please verify your request and, if required, contact the API administrator for assistance. |
400 | failed | INVALID_SEARCH_PERIOD | Error | The search period is longer than 3 months. |
400 | failed | BAD_REQUEST | Error | The server cannot or will not process the request due to an apparent client error. Check messages field for more details. |
400 | failed | DECLINED | Error | Transaction declined. |
400 | failed | INVALID_REQUEST | Error | The configuration allows only single/dual messaging requests. |
400 | failed | CARD_NOT_ACTIVE | Error | No active card found for the username. |
400 | failed | INVALID_AMOUNT | Error | Insufficient funds or amount too small/big. |
400 | failed | INVALID_MERCHANT | Error | The merchant is not valid, please check the given mid. |
400 | failed | INVALID_VOUCHER | Error | Voucher not valid. |
400 | failed | LIMIT_EXCEEDED | Error | The amount is incorrect according your past orders. |
400 | failed | LOCKOUT | Error | Max PIN tries exceeded. |
400 | failed | PARTIAL_REVERSALS_NOT_ALLOWED | Error | Partial refunds are not allowed. |
400 | failed | TEMPORARY_HOLD | Error | Transaction temprorary hold. |
400 | failed | TRANSACTION_DUPLICATED | Error | A same transaction already exists. |
400 | failed | TRANSACTION_NOT_AUTHORISED | Error | The transaction has not been authorized. |
400 | failed | TRANSACTION_STATUS_MUST_BE_AUTHORIZED | Error | Invalid operation, the status of the transaction must be authorized |
400 | failed | INVALID_AMOUNT | Error | Ensure that the amount you want to cancel matches the authorized amount. |
400 | failed | TRANSACTION_NOT_AUTHORISED | Error | Transaction not authorised. |
400 | failed | TRANSACTION_STATUS_MUST_BE_CAPTURED | Error | Invalid operation, the status of the transaction must be captured |
400 | failed | INVALID_MERCHANT | Error | The Merchant is invalid |
400 | failed | INVALID_AMOUNT | Error | The Amount is invalid |
400 | failed | LIMIT_EXCEEDED | Error | The Amount is invalid |
400 | failed | TRANSACTION_DUPLICATED | Error | The transaction is duplicated |
400 | failed | CARD_NOT_FOUND | Error | Card not found |
400 | failed | CARD_NOT_ACTIVATED | Error | The card status is different from active. The transaction can't be processed with the given default card |
400 | failed | INSUFFICIENT_FUNDS | Error | Insufficient funds |
400 | failed | INVALID_CURRENCY_CODE | Error | The currency must be ISO 4217 |
400 | failed | TRANSACTION_NOT_FOUND | Error | The transaction is not found |
400 | failed | INVALID_CARD | Error | The Card is invalid |
400 | failed | TRANSACTION_LIMIT_EXCEEDED | Error | Exceeded the limit of quantity of transactions per day |
401 | failed | INVALID_TOKEN | Error | Invalid, revoked or expired token. You should try to re-authenticate the user. |
401 | failed | UNAUTHORIZED | Error | Missing, invalid or expired token. To fix, you should re-authenticate the user. |
401 | failed | USER_INACTIVE | Error | User Inactive. |
401 | failed | INVALID_TOKEN_ISSUER | Error | The token has not been issued (tokenUsername) for the current user (username) |
401 | failed | UNAUTHORIZED | Error | Unauthorized User |
403 | failed | FORBIDDEN | Error | The request was valid, but the server is refusing action. The user might not have the necessary permissions for this resource. |
404 | failed | TRANSACTION_NOT_FOUND | Error | No transaction found for the given transaction_id. |
404 | failed | ORIGIN_TRANSACTION_ID_NOT_FOUND | Error | The origin transaction_id is not found. |
404 | failed | NOT_FOUND | Error | If no transaction is linked to the transaction_id given as input. |
405 | failed | METHOD_NOT_ALLOWED | Error | A request was made of a resource using a request method not supported by that resource. |
406 | failed | NOT_ACCEPTABLE | Error | The requested resource is only capable of generating content not acceptable according to the Accept headers sent in the request. |
412 | failed | PRECONDITION_FAILED | Error | A business precondition has not been; for example, the user has no active cards. |
412 | failed | PRECONDITION_FAILED | Error | A business precondition has not been. |
412 | failed | PRECONDITION_FAILED | Error | One of the user data is not valid to process the given request |
415 | failed | UNSUPPORTED_MEDIA_TYPE | Error | The request entity has a media type which the server or resource does not support. |
429 | failed | TOO_MANY_REQUEST | Error | Your request has been rejected due to rate limitation. Please check your subscribed service level agreement. |
500 | failed | INVALID_CARD | Error | Blocked card |
500 | failed | INVALID_CARD | Error | Card canceled |
500 | failed | INVALID_CARD | Error | Lost card |
500 | failed | INVALID_CARD | Error | Expired card |
500 | failed | INVALID_MERCHANT | Error | The Merchant is invalid |
500 | failed | LIMIT_EXCEEDED | Error | The Amount is invalid |
500 | failed | TRANSACTION_DUPLICATED | Error | The transaction is duplicated |
500 | failed | INSUFFICIENT_FUNDS | Error | Insufficient funds |
500 | failed | TRANSACTION_LIMIT_EXCEEDED | Error | Exceeded the limit of quantity of transactions per day |
500 | failed | INVALID_CARD | Error | Account canceled |
500 | failed | CARD_NOT_FOUND | Error | Card not found |
500 | failed | TRANSACTION_NOT_FOUND | Error | The transaction is not found |
500 | failed | PARTIAL_REVERSALS_NOT_ALLOWED | Error | The partial reversal is not allowed |
500 | failed | INVALID_CURRENCY_CODE | Error | The currency must be ISO 4217 |
500 | failed | INVALID_CAPTURE_MODE | Error | The property Capture_Mode must contains (auto / manual) |
500 | failed | INTERNAL_ERROR | Error | Internal server error |
500 | failed | INVALID_CARD_NUMBER | Error | The CardNumberID should be a number |
500 | failed | BAD_REQUEST | Error | The property CardNumberID is required |
500 | failed | INVALID_TOKEN | Error | The token is not valid |
500 | failed | INVALID_CARD | Error | The Card is invalid |
500 | failed | UNAUTHORIZED | Error | Unauthorized User |
500 | failed | FORBIDDEN | Error | Bad OAuth request (wrong consumer key, bad nonce, expired timestamp...) |
500 | failed | BAD_GATEWAY | Error | Bad gateway |
500 | failed | CARD_NOT_FOUND | Error | Card not found |
500 | failed | ONLINE_TRANSACTIONS_DISABLED | Error | Online transactions for the card provided is disabled |
500 | failed | INVALID_CARD | Error | Invalid Card Serial Number |
500 | failed | ACCOUNT_CANCELED | Error | Account canceled |
500 | failed | INVALID_CONSULT | Error | It was not possible to consult the available balance |
500 | failed | ORIGINAL_TRANSACTION_NOT_FOUND | Error | Original transaction not found |
500 | failed | INVALID_PRODUCT | Error | Product line control not found |
500 | failed | ONLINE_AGENT | Error | Referred Transaction |
500 | failed | PARTIAL_REFUND_NOT_ALLOWED | Error | Partial amount refund is not allowed |
500 | failed | REFUND_ERROR | Error | Transaction already returned |
500 | failed | ORIGINAL_TRANSATION_ERROR | Error | Original transaction not found |
500 | failed | EXCEEDED_LIMIT | Error | Exceeded the limit of quantity of transactions per day |
500 | failed | BALANCE_INQUIRY | Error | Balance inquiry error |
500 | failed | MAX_TENTATIVES_PIN | Error | Max Tentatives Invalid Pin |
500 | failed | CONTRACT_CANCELED | Error | Merchant Contract Canceled |
500 | failed | FILIATON_CANCELED | Error | Filiation canceled |
500 | failed | INVALID_AMOUNT | Error | Transaction Limit Error |
500 | failed | PRODUCT_SUB_RED_NOT_FOUND | Error | Product Sub-Red not found |
500 | failed | ACCOUNT_NOT_FOUND | Error | Card Account Not Found |
500 | failed | INSUFFICIENT_FUNDS | Error | Insufficient funds |
500 | failed | GENERIC_ERROR | Error | Generic Error |
500 | failed | EXPIRED_CARD | Error | Expired card |
500 | failed | LOST_CARD | Error | Lost card |
500 | failed | CARD_CANCELED | Error | Blocked card |
500 | failed | BLOCKED_CARD | Error | Card blocked |
500 | failed | PENDING_CARD | Error | Confirmation Pending Card |
500 | failed | INTERNAL_ERROR | Error | We had a problem with our server. Please to try again later. |
500 | failed | TRANSACTION_MUST_BE_AUTHORIZED | Error | Invalid operation, the status of the transaction must be authorized |
500 | failed | INTERNAL_ERROR | Error | Internal server error |
501 | failed | NOT_IMPLEMENTED | Error | For the context of the current business unit, this feature is not supported. |
501 | failed | NOT_IMPLEMENTED | Error | The server either does not recognize the request method, or it lacks the ability to fulfill the request |
502 | failed | BAD_GATEWAY | Error | We had a problem with one of our backends that returns a http 500 status. Please to try again later. |
502 | failed | BAD_GATEWAY | Error | Oups... Something wrong on one of the underlying servers! Please contact the administrator to report the issue |
503 | failed | SERVICE_UNAVAILABLE | Error | Oups... Something wrong on one of the underlying servers! Please contact the administrator to report the issue |
503 | failed | CONNECTIVITY | Error | Indicates that there was a problem establishing a connection |
504 | failed | GATEWAY_TIMEOUT | Error | The server, while acting as a gateway or proxy, did not receive a timely response from an upstream server it needed to access in order to complete the request. |