Edenred Direct Payment Services icon

Edenred Direct Payment Services

(0 reviews)

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:

https://sso.sbx.edenred.io/connect/authorize?response_type=code&client_id=bd1c63d293f34b5ab4ff18dd54722ecf&scope=openid%20edg-xp-mealdelivery-api%20offline_access&redirect_uri=http://nowhere.edenred.net/oauth/callback&state=abc123&nonce=456azerty&acr_values=tenant:cl-ben&ui_locales=es

Example of account that can be used to test the API:

  • Username: 17938390K
  • Password: Edenred2020
  • PAN: 5305

Junaeb:

https://sso.sbx.edenred.io/connect/authorize?response_type=code&client_id=282b669145ed403f8ed6d1b1e449461c&scope=openid%20edg-xp-mealdelivery-api%20offline_access&redirect_uri=http://nowhere.edenred.net/oauth/callback&state=abc123&nonce=456azerty&acr_values=tenant:cl-ben-junaeb&ui_locales=es

Example of account that can be used to test the API:

  • Username: 262695484
  • Password: Edenred2021
  • PAN: 4850

Authentication flow for both

  1. Login Page
  2. Card selection
  3. Confirm 2nd factor (Masked PAN code)
  4. 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:

Run in Postman

Junaeb:

Run in Postman

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 CodeStatusCodeLevelDescription
200succededOKSuccessOK
200succededSUCCESSSuccessSUCCEEDED
200succededTRANSACTION_OKSuccessTransaction Ok
200succededAUTHSuccessThe transaction has been authorized.
200succededAUTH_PENDINGSuccessThe transaction authorization is pending.
200succededPARTIAL_AUTHSuccessThe transaction has been partially authorized.
200succededSUCCEEDEDSuccessOK
400failedINVALID_USERErrorInvalid User
400failedBAD_REQUESTErrorThe input doesn't respect the contract expected (required fields, type, etc.)
400failedEMPTY_AUTHORIZATION_TOKENErrorUnable to retrieve the OpenId token from the request. Please verify your request and, if required, contact the API administrator for assistance.
400failedINVALID_SEARCH_PERIODErrorThe search period is longer than 3 months.
400failedBAD_REQUESTErrorThe server cannot or will not process the request due to an apparent client error. Check messages field for more details.
400failedDECLINEDErrorTransaction declined.
400failedINVALID_REQUESTErrorThe configuration allows only single/dual messaging requests.
400failedCARD_NOT_ACTIVEErrorNo active card found for the username.
400failedINVALID_AMOUNTErrorInsufficient funds or amount too small/big.
400failedINVALID_MERCHANTErrorThe merchant is not valid, please check the given mid.
400failedINVALID_VOUCHERErrorVoucher not valid.
400failedLIMIT_EXCEEDEDErrorThe amount is incorrect according your past orders.
400failedLOCKOUTErrorMax PIN tries exceeded.
400failedPARTIAL_REVERSALS_NOT_ALLOWEDErrorPartial refunds are not allowed.
400failedTEMPORARY_HOLDErrorTransaction temprorary hold.
400failedTRANSACTION_DUPLICATEDErrorA same transaction already exists.
400failedTRANSACTION_NOT_AUTHORISEDErrorThe transaction has not been authorized.
400failedTRANSACTION_STATUS_MUST_BE_AUTHORIZEDErrorInvalid operation, the status of the transaction must be authorized
400failedINVALID_AMOUNTErrorEnsure that the amount you want to cancel matches the authorized amount.
400failedTRANSACTION_NOT_AUTHORISEDErrorTransaction not authorised.
400failedTRANSACTION_STATUS_MUST_BE_CAPTUREDErrorInvalid operation, the status of the transaction must be captured
400failedINVALID_MERCHANTErrorThe Merchant is invalid
400failedINVALID_AMOUNTErrorThe Amount is invalid
400failedLIMIT_EXCEEDEDErrorThe Amount is invalid
400failedTRANSACTION_DUPLICATEDErrorThe transaction is duplicated
400failedCARD_NOT_FOUNDErrorCard not found
400failedCARD_NOT_ACTIVATEDErrorThe card status is different from active. The transaction can't be processed with the given default card
400failedINSUFFICIENT_FUNDSErrorInsufficient funds
400failedINVALID_CURRENCY_CODEErrorThe currency must be ISO 4217
400failedTRANSACTION_NOT_FOUNDErrorThe transaction is not found
400failedINVALID_CARDErrorThe Card is invalid
400failedTRANSACTION_LIMIT_EXCEEDEDErrorExceeded the limit of quantity of transactions per day
401failedINVALID_TOKENErrorInvalid, revoked or expired token. You should try to re-authenticate the user.
401failedUNAUTHORIZEDErrorMissing, invalid or expired token. To fix, you should re-authenticate the user.
401failedUSER_INACTIVEErrorUser Inactive.
401failedINVALID_TOKEN_ISSUERErrorThe token has not been issued (tokenUsername) for the current user (username)
401failedUNAUTHORIZEDErrorUnauthorized User
403failedFORBIDDENErrorThe request was valid, but the server is refusing action. The user might not have the necessary permissions for this resource.
404failedTRANSACTION_NOT_FOUNDErrorNo transaction found for the given transaction_id.
404failedORIGIN_TRANSACTION_ID_NOT_FOUNDErrorThe origin transaction_id is not found.
404failedNOT_FOUNDErrorIf no transaction is linked to the transaction_id given as input.
405failedMETHOD_NOT_ALLOWEDErrorA request was made of a resource using a request method not supported by that resource.
406failedNOT_ACCEPTABLEErrorThe requested resource is only capable of generating content not acceptable according to the Accept headers sent in the request.
412failedPRECONDITION_FAILEDErrorA business precondition has not been; for example, the user has no active cards.
412failedPRECONDITION_FAILEDErrorA business precondition has not been.
412failedPRECONDITION_FAILEDErrorOne of the user data is not valid to process the given request
415failedUNSUPPORTED_MEDIA_TYPEErrorThe request entity has a media type which the server or resource does not support.
429failedTOO_MANY_REQUESTErrorYour request has been rejected due to rate limitation. Please check your subscribed service level agreement.
500failedINVALID_CARDErrorBlocked card
500failedINVALID_CARDErrorCard canceled
500failedINVALID_CARDErrorLost card
500failedINVALID_CARDErrorExpired card
500failedINVALID_MERCHANTErrorThe Merchant is invalid
500failedLIMIT_EXCEEDEDErrorThe Amount is invalid
500failedTRANSACTION_DUPLICATEDErrorThe transaction is duplicated
500failedINSUFFICIENT_FUNDSErrorInsufficient funds
500failedTRANSACTION_LIMIT_EXCEEDEDErrorExceeded the limit of quantity of transactions per day
500failedINVALID_CARDErrorAccount canceled
500failedCARD_NOT_FOUNDErrorCard not found
500failedTRANSACTION_NOT_FOUNDErrorThe transaction is not found
500failedPARTIAL_REVERSALS_NOT_ALLOWEDErrorThe partial reversal is not allowed
500failedINVALID_CURRENCY_CODEErrorThe currency must be ISO 4217
500failedINVALID_CAPTURE_MODEErrorThe property Capture_Mode must contains (auto / manual)
500failedINTERNAL_ERRORErrorInternal server error
500failedINVALID_CARD_NUMBERErrorThe CardNumberID should be a number
500failedBAD_REQUESTErrorThe property CardNumberID is required
500failedINVALID_TOKENErrorThe token is not valid
500failedINVALID_CARDErrorThe Card is invalid
500failedUNAUTHORIZEDErrorUnauthorized User
500failedFORBIDDENErrorBad OAuth request (wrong consumer key, bad nonce, expired timestamp...)
500failedBAD_GATEWAYErrorBad gateway
500failedCARD_NOT_FOUNDErrorCard not found
500failedONLINE_TRANSACTIONS_DISABLEDErrorOnline transactions for the card provided is disabled
500failedINVALID_CARDErrorInvalid Card Serial Number
500failedACCOUNT_CANCELEDErrorAccount canceled
500failedINVALID_CONSULTErrorIt was not possible to consult the available balance
500failedORIGINAL_TRANSACTION_NOT_FOUNDErrorOriginal transaction not found
500failedINVALID_PRODUCTErrorProduct line control not found
500failedONLINE_AGENTErrorReferred Transaction
500failedPARTIAL_REFUND_NOT_ALLOWEDErrorPartial amount refund is not allowed
500failedREFUND_ERRORErrorTransaction already returned
500failedORIGINAL_TRANSATION_ERRORErrorOriginal transaction not found
500failedEXCEEDED_LIMITErrorExceeded the limit of quantity of transactions per day
500failedBALANCE_INQUIRYErrorBalance inquiry error
500failedMAX_TENTATIVES_PINErrorMax Tentatives Invalid Pin
500failedCONTRACT_CANCELEDErrorMerchant Contract Canceled
500failedFILIATON_CANCELEDErrorFiliation canceled
500failedINVALID_AMOUNTErrorTransaction Limit Error
500failedPRODUCT_SUB_RED_NOT_FOUNDErrorProduct Sub-Red not found
500failedACCOUNT_NOT_FOUNDErrorCard Account Not Found
500failedINSUFFICIENT_FUNDSErrorInsufficient funds
500failedGENERIC_ERRORErrorGeneric Error
500failedEXPIRED_CARDErrorExpired card
500failedLOST_CARDErrorLost card
500failedCARD_CANCELEDErrorBlocked card
500failedBLOCKED_CARDErrorCard blocked
500failedPENDING_CARDErrorConfirmation Pending Card
500failedINTERNAL_ERRORErrorWe had a problem with our server. Please to try again later.
500failedTRANSACTION_MUST_BE_AUTHORIZEDErrorInvalid operation, the status of the transaction must be authorized
500failedINTERNAL_ERRORErrorInternal server error
501failedNOT_IMPLEMENTEDErrorFor the context of the current business unit, this feature is not supported.
501failedNOT_IMPLEMENTEDErrorThe server either does not recognize the request method, or it lacks the ability to fulfill the request
502failedBAD_GATEWAYErrorWe had a problem with one of our backends that returns a http 500 status. Please to try again later.
502failedBAD_GATEWAYErrorOups... Something wrong on one of the underlying servers! Please contact the administrator to report the issue
503failedSERVICE_UNAVAILABLEErrorOups... Something wrong on one of the underlying servers! Please contact the administrator to report the issue
503failedCONNECTIVITYErrorIndicates that there was a problem establishing a connection
504failedGATEWAY_TIMEOUTErrorThe 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.

Reviews