Edenred Direct Payment Services icon

Edenred Direct Payment Services

(0 reviews)

Use Case: Greece

1. Generalities

In Greece, with the Ticket Restaurant Card, a user can spend the amount requested without any limitation (in the limit of the balance available on his account), i.e. balance can’t be negative.

The regulation(s) are handled on the Edenred side. Please note that all amounts in our API are given in cents (example: 9€ = 900).

{{Authentication URL}} = https://sso.sbx.edenred.io

{{payment URL}} = https://directpayment.stg.eu.edenred.io/v2

2. User Security Tokens

Please refer to this section for more details about security tokens.

The following flow is the only authentication flow supported for security reasons (no authentication flow is available per API for example)

2.1. Login Process

1) To test the API in sandbox, you can get an authorization_code by clicking on the link bellow:

https://sso.sbx.edenred.io/connect/authorize?response_type=code&client_id=7deea1a069ed44f98dd97634e286f443&scope=openid%20edg-xp-mealdelivery-api%20offline_access&redirect_uri=http://nowhere.edenred.net/oauth/callback&state=d710ce14-ace6-4300-8e58-5877e7b92500&nonce=11df89b0-4bde-4696-a00ed04cf06b9ab2&acr_values=tenant:gr-ben&ui_locales=el

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

  Username: edps.ergruat2@gmail.com
  Password: Edenred2020*
  CVV: 9856

####

2) After login and consent granted by the user, we will redirect the user to a url you have provided us like :

http://nowhere.edenred.net/oauth/callback?code={authorizationcode}&...

This URL must be whilested on our side to be used. We can whitelist several on demand.

3) During the redirection process, we send you back the authorization code. Copy the authorization_code and use the request "Get access_token from authorization_code" in the following collection of API calls :

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.

2.2. Logout Process

Logout the Edenred account from your platform. All tokens are then invalid

GET {{authentication-URL}}/connect/endsession?id_token_hint=<idToken>=<postLogoutRedirectUri> HTTP/1.1
Host: {{authentication-URL}}

Where

'authentication-URL' = sso.sbx.edenred.io

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

3. Direct Payment API

3.1. Postman Collection


If you use the postman collection, the access_token will automatically be placed in your HTTP Authorization header after Get Token from authorization code request is sent.

Run in Postman

3.2. User Balance

Get Balance

Gets the available amount that can be spent on the user's account.

The authorization header is mandatory for this request.

Note: The {Username} is retrieved by introspection of the token-id

Request:

 GET {{payment URL}}/users/{username}/balances HTTP/1.1
 Host: {{payment URL}}
 Authorization: Bearer {token}
 X-Client-Id: {payment-clientId}
 X-Client-Secret: {payment-clientSecret}

Response:

{
  "meta": {
"status": "succeeded",
"messages": []
  },
  "data": {
    "available_amount": 299998,
    "currency": "EUR"
  }
}

Estimate Charge

Check if an amount can be spent and answer the exact amount that could be spent (if the balance is below the requested amount).

The authorization header is mandatory for this request.

Note: The {Username} is retrieved by introspection of the token-id

Request:

 POST {{payment URL}}/users/{username}/actions/estimate-charge HTTP/1.1
 Host: {{payment URL}}
 Authorization: Bearer {token}
 X-Client-Id: {payment-clientId}
 X-Client-Secret: {payment-clientSecret}
 Content-Type: application/json
 {
   "amount": 1
 }

Response:

{
  "meta": {
    "status": "succeeded",
    "messages": []
  },
  "data": {
    "available_amount": 1,
    "currency": "EUR"
  }
}

3.3. User Transactions

EDPS manages two kinds of transaction mode, auto and manual. The postman collection provided is set up in capture mode auto. If you want to test an environment in capture mode manual, please request a dedicated environment.

In the next sections, we will explain the difference between those two modes.

Capture Mode: Manual

Step 1: Authorize a payment

An authorization is requested with an amount.

In capture mode = manual, you must set the capture mode in the body of the request to "manual".

The authorization header should be set for this operation.

The field tstamp MUST be set in order to manage idempotency

Request:

 POST {{payment URL}}/transactions HTTP/1.1
 Host: {{payment URL}}
 Authorization: Bearer {token}
 X-Client-Id: {payment-clientId}
 X-Client-Secret: {payment-clientSecret}
 Content-Type: application/json

 {
    "mid": "5423945122",
    "amount": 1,
    "security_level": "standard",
    "capture_mode": "manual",
    "order_ref": "785420",
    "tstamp": "2020-05-26T19:45:51Z",
    "currency": "EUR"
}

Response:

{
    "meta": {
        "status": "succeeded"
    },
    "data": {
        "order_ref": "679089",
        "mid": "5423945122",
        "status": "authorized",
        "authorization_id": "MTU5MjMxMzkzNzU0MjM5NDUxMjI0M-031407",
        "authorized_amount": 1
    }
}
Step 2: Cancel OR Capture a payment

An "authorized" payment can be cancelled or captured.

The authorization_id provided during the authorization process must be provided in this request.

The authorized_amount must be provided in the body of the request.

The canceled amount must be equal to the authorized amount

The captured amount can be lower or equal to the authorized amount.

The authorization header must be set for the two operations cancel and capture.

Cancel Request:

 POST {{payment URL}}/transactions/{authorization_id}/actions/cancel HTTP/1.1
 Host: {{payment URL}}
 X-Client-Id: {payment-clientId}
 X-Client-Secret: {payment-clientSecret}
 Content-Type: application/json
 {
   "amount": 1,
   "currency": "EUR",
   "tstamp": "2020-05-26T19:45:51Z"
 }

Cancel Response:

{
    "meta": {
        "status": "succeeded"
    },
    "data": {
        "mid": "5423945122",
        "status": "cancelled",
        "cancel_id": "MTU5MTgwMDMxMzU0MjM5NDUxMjI0M",
        "cancelled_amount": 1,
        "order_ref": "679089",
        "authorization_id": "MTU5MjMxMzkzNzU0MjM5NDUxMjI0M-031407",
        "authorized_amount": 1
    }
}

OR

Capture Request:

 POST {{payment URL}}/transactions/{authorization_id}/actions/capture HTTP/1.1
 Host: {{payment URL}}
 X-Client-Id: {payment-clientId}
 X-Client-Secret: {payment-clientSecret}
 Content-Type: application/json
 {
   "amount": 1,
   "currency": "EUR",
   "tstamp": "2020-05-26T19:45:51Z"
 }

Capture Response:

{
  "meta": {
     "status": "succeeded",
     "messages": []
  },
  "data": {
      "order_ref": "889180",
      "mid": "5423945122",
      "capture_id": "MTU5MjMxNDAyMTU0MjM5NDUxMjI0M-110983",
      "capture_amount": 1,
      "status": "captured",
      "authorization_id": "MTU5MjMxNDAyMTU0MjM5NDUxMjI0M-110983",
      "authorized_amount": 1
    }
}
Step 3: Refund a captured payment

Once captured, a transaction can't be cancelled, it can be only refunded.

We support both the partial refund OR the refund of the full amount of the captured transaction. The query param "partial" must be provided in the refund request to manage a partial refund.

The authorization_id provided during the authorization/capture process must be provided in this request with the amount to refund

  • "captured_amount" in case of full refund request
  • "amount" (below the "captured_amount") in case of partial refund request

The authorization header should not be set for this operation.

The field tstamp MUST be set in order to manage idempotency

Full Refund

Request:

POST {{payment-url}}/transactions/{{authorization_id}}/actions/refund
Host: {{payment-url}}
X-Client-Id: {payment-clientId}
X-Client-Secret: {payment-clientSecret}
Content-Type: application/json

{
  "amount": 1,
  "capture_mode": "manual",
  "currency": "EUR",
  "tstamp": "2020-05-27T08:54:20Z"
}

Response:

{
  "meta": {
"status": "succeeded"

},
  "data": {
      "mid": "5423945122",
      "status": "refunded",
      "refund_id": "MTU5MDU1ODg2MDU0MjM5NDUxMjI0M",
      "refunded_amount": 1,
    }
}

Partial Refund

Request:

POST {{payment-url}}/transactions/{{authorization_id}}/actions/**refund?type=partial**
Host: {{payment-url}}
X-Client-Id: {payment-clientId}
X-Client-Secret: {payment-clientSecret}
Content-Type: application/json

 {
   "amount": 1,
   "currency": "EUR",
   "capture_mode": "manual",
   "tstamp": "2020-05-26T19:45:51Z"
 }

Response:

{
  "meta": {
"status": "succeeded"

},
  "data": {
      "mid": "5423945122",
      "status": "refunded",
      "refund_id": "MTU5MDU1ODg2MDU0MjM5NDUxMjI0M",
      "refunded_amount": 1,
    }
}

Capture Mode: Auto

Step 1: Auto Capture a payment

An transaction processed is "authorization + auto capture" is requested with an amount.

In capture mode = auto, the capture mode is not mandatory in the body of the request. This is default capture mode of the API.

The authorization header should be set for this operation.

The field tstamp MUST be set in order to manage idempotency

Request:

 POST {{payment URL}}/transactions HTTP/1.1
 Host: {{payment URL}}
 Authorization: Bearer {token}
 X-Client-Id: {payment-clientId}
 X-Client-Secret: {payment-clientSecret}
 Content-Type: application/json
 {

       "mid": "5423945122",
       "amount": 1,
       "security_level": "standard",
       "capture_mode": "auto",
       "order_ref": "419134",
       "tstamp": "2020-05-27T08:53:20Z"
       "currency": "EUR"

 }

Response:


{
  "meta": {
     "status": "succeeded",
     "messages": []
  },
  "data": {
      "order_ref": "5423945122",
      "mid": "419134",
      "capture_id": "MTU5MDU1ODg2MDU0MjM5NDUxMjI0M-127298",
      "capture_amount": 1,
      "status": "captured",
      "authorization_id": "MTU5MDU1ODg2MDU0MjM5NDUxMjI0M-127298",
      "authorized_amount": 1
    }
}
Step 2: Refund a captured payment

In this capture mode scenario the "Cancel" and "Capture" are not used.

Once captured, a transaction can be only refunded.

We support both the partial refund OR the refund of the full amount of the captured transaction. The query param "partial" must be provided in the refund request to manage a partial refund.

The authorization_id provided during the authorization/capture process must be provided in this request with the amount to refund

  • "captured_amount" in case of full refund request
  • "amount" (below the "captured_amount") in case of partial refund request

The authorization header should not be set for this operation.

The field tstamp MUST be set in order to manage idempotency

Full Refund

Request:

POST {{payment-url}}/transactions/{{authorization_id}}/actions/refund
Host: {{payment-url}}
X-Client-Id: {payment-clientId}
X-Client-Secret: {payment-clientSecret}
Content-Type: application/json

{
  "amount": 1,
  "currency": "EUR",
  "tstamp": "2020-05-27T08:54:20Z"
}

Response:

{
  "meta": {
"status": "succeeded"

},
  "data": {
      "mid": "5423945122",
      "status": "refunded",
      "refund_id": "MTU5MDU1ODg2MDU0MjM5NDUxMjI0M",
      "refunded_amount": 1,
    }
}

Partial Refund

Request:

POST {{payment-url}}/transactions/{{authorization_id}}/actions/**refund?type=partial**
Host: {{payment-url}}
X-Client-Id: {payment-clientId}
X-Client-Secret: {payment-clientSecret}
Content-Type: application/json

 {
   "amount": 1,
   "currency": "EUR",
   "tstamp": "2020-05-26T19:45:51Z"
 }

Response:

{
  "meta": {
"status": "succeeded"

},
  "data": {
      "mid": "5423945122",
      "status": "refunded",
      "refund_id": "MTU5MDU1ODg2MDU0MjM5NDUxMjI0M",
      "refunded_amount": 1,
    }
}

4. Error Codes

Status CodeStatusCodeLevelDescription
200succededOKSuccessOK
200succededAUTHSuccessThe transaction has been authorized.
200succededAUTH_PENDINGSuccessThe transaction authorization is pending.
200succededPARTIAL_AUTHSuccessThe transaction has been partially authorized.
400failedINVALID_CARDErrorINVALID CARD SERIAL NUMBER
400failedCARDHOLDER_ALREADY_EXISTSErrorCARDHOLDER ALREADY EXISTS
400failedREFERENCE_ALREADY_EXISTSErrorREFERENCE ALREADY EXISTS
400failedINVALID_ACTIVATION_CODEErrorINVALID ACTIVATION CODE
400failedINVALID_ACCOUNTErrorINVALID ACCOUNT NUMBER
400failedBAD_REQUESTErrorINVALID DATE RANGE
400failedBAD_REQUESTErrorINVALID PAGE OFFSET
400failedINVALID_CARDHOLDERErrorINVALID CARDHOLDER
400failedINVALID_EMAILErrorINVALID EMAIL
400failedBAD_REQUESTErrorDATE FROM TOO OLD
400failedINVALID_PHONEErrorINVALID PHONE
400failedNON_UNIQUE_MOBILE_NUMBERErrorNON-UNIQUE MOBILE NUMBER
400failedCARD_NOT_BLOCKEDErrorCANNOT RESUME(Card not blocked or already blocked)
400failedCARD_ALREADY_REGISTEREDErrorCARD ALREADY REGISTERED
400failedREGISTRATION_NOT_ALLOWEDErrorREGISTRATION NOT ALLOWED
400failedDUPLICATE_CARDHOLDERErrorDUPLICATE CARDHOLDER
400failedCARD_BLOCKEDErrorCard is not in valid state
400failedBAD_REQUESTErrorPIN REQUIRED
400failedCARDHOLDER_STATUS_INVALIDErrorCARDHOLDER STATUS INVALID
400failedCARD_BLOCKEDErrorCARD/ACCOUNT BLOCKED
400failedBAD_REQUESTErrorINVALID PRODUCT BALANCE
400failedBAD_REQUESTErrorINVALID ACCOUNT EXTERNAL REFERENCE
400failedBAD_REQUESTErrorPIN ERROR
400failedBAD_REQUESTErrorPIN STATUS NOT BLOCKED
400failedCARD_ALREADY_ACTIVATEDErrorCard is already activated
400failedBAD_REQUESTErrorCARD NOT FULFILLED
400failedBAD_REQUESTErrorPIN LOCKED
400failedBAD_REQUESTErrorCARD NOT ACTIVE
400failedBAD_REQUESTErrorMAX PIN TRIES EXCEEDED
400failedBAD_REQUESTErrorPIN STATUS NOT ACTIVE ACTIVATING
400failedINVALID_MERCHANTErrorInvalid Merchant
400failedINVALID_AMOUNTErrorInvalid Amount
400failedINVALID_AMOUNTErrorINSUFFICIENT FUNDS
400failedTRANSACTION_DUPLICATEDErrorTransaction Duplicated
400failedDECLINEDErrorDeclined
400failedLIMIT_EXCEEDEDErrorLimit exceeded
400failedTEMPORARY_HOLDErrorTemporary hold
400failedPARTIAL_REVERSALS_NOT_ALLOWEDErrorPartial resversals not allowed
400failedTRANSACTION_NOT_AUTHORISEDErrorTransaction not authorised
400failedINVALID_VOUCHERErrorInvalid Voucher
400failedLOCKOUTErrorlockout
400failedPARTIAL_AUTH_NOT_SUPPORTEDErrorPartial authorization not supported
400failedINCORRECT_PINErrorIncorrect PIN
400failedCARD_BLOCKEDErrorCard blocked
400failedCARD_NOT_ACTIVATEDErrorCard is not activated
400failedINVALID_ACCOUNTErrorInvalid account
400failedINVALID_CURRENCY_CODEErrorInvalid currency
400failedINVALID_CARDErrorInvalid card
400failedACCOUNT_BLOCKEDErrorAccount blocked
400failedINVALID_CAPTURE_MODEErrorYou are not allowed to capture transaction
400failedTOPTP_VALIDATION_FAILEDErrortoptp validation failed
400failedINVALID_TRANSACTION_TYPEErrorInvalid transaction type
400failedASSOCIATION_MUST_BE_RESTARTEDErrorThe association needs to be restarted.
400failedBAD_REQUESTErrorThe request you made is not valid
400failedINVALID_BENEFErrorThe user name iS invalid.
400failedINVALID_EMAILErrorThe email address is invalid.
400failedINVALID_EMAILErrorThe email address is already in use.
400failedMISMATCH_PASSWORD_COMPLEXITYErrorThe password provided is too short.
400failedINVALID_EMAILErrorThe user name is already in use.
400failedMISMATCH_PASSWORD_COMPLEXITYErrorThe password provided requires an lowercase character.
400failedMISMATCH_PASSWORD_COMPLEXITYErrorThe password provided requires no alphanumeric characters.
400failedMISMATCH_PASSWORD_COMPLEXITYErrorThe password provided requires a digit.
400failedMISMATCH_PASSWORD_COMPLEXITYErrorThe password provided requires an uppercase character.
400failedMISMATCH_PASSWORD_COMPLEXITYErrorThe password provided a unique character.
400failedINVALID_TOKENErrorThe user name was not found
400failedACC001ErrorINVALID ACCOUNT NUMBER
400failedBAD_REQUESTErrorINVALID PARAMETERS
400failedFORMAT002ErrorINVALID PAGE OFFSET
400failedFORMAT002ErrorDATE FROM TOO OLD
400failedFORMAT002ErrorINVALID DATE RANGE
400failedFORMAT002ErrorPIN ERROR
400failedACC001ErrorINVALID ACCOUNT EXTERNAL REFERENCE
400failedFORMAT002ErrorPIN REQUIRED
400failedCARD006ErrorPIN STATUS NOT BLOCKED
400failedCARD001ErrorINVALID PRODUCT BALANCE
400failedCARD007ErrorPIN LOCKED
400failedCARD003ErrorCARD NOT ACTIVE
400failedCARD002ErrorCARD NOT FULFILLED
400failedCARD004ErrorPIN STATUS NOT ACTIVE ACTIVATING
400failedCARD005ErrorMAX PIN TRIES EXCEEDED
400failedBENEF004ErrorUsername is required
400failedBENEF006ErrorPassword is required
400failedBAD_REQUESTErrorEmail is required
400failedBENEF004ErrorPassword is required
400failedINVALID_EMAIL_DOMAINErrorEmail is required.
400failedFORMAT001ErrorEmail is invalid
400failedBENEF005ErrorEmail is required
400failedBENEF007ErrorInvalid verification key
400failedBENEF006ErrorNew password must be different
400failedBENEF006ErrorInvalid old password
400failedBAD_REQUESTErrorUnable to process your request, please check its validity.
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
401failedUNAUTHORIZEDErrorINVALID SSL CERTIFICATE
401failedUNAUTHORIZEDErrorSSL CONNECTION REQUIRED
401failedUNAUTHORIZEDErrorINVALID CREDENTIALS
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)
403failedFORBIDDENErrorINVALID IP
403failedFORBIDDENErrorINVALID MAC
403failedINVALID_PASSWORDErrorThe password provided is not correct
403failedFORBIDDENErrorThe request was valid, but the server is refusing action. The user might not have the necessary permissions for this resource.
404failedNOT_FOUNDErrorThe user name was not found
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; for example, using GET on a form which requires data to be presented via POST, or using PUT on a read-only resource.
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.
409failedCONFLICTErrorCard already associated.
412failedPRECONDITION_FAILEDErrorA business precondition has not been; for example, the user has no active cards.
412failedPRECONDITION_FAILEDErrorA business precondition has not been.
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_POST_CODEErrorINVALID POST CODE
500failedCOMPLIANCE_DATA_NOT_ALLOWEDErrorCOMPLIANCE DATA NOT ALLOWED
500failedINTERNAL_ERRORErrorInternal Server Error
500failedCARD_EXPIREDErrorCard expired
500failedINTERNAL_ERRORErrorInvalid Message :Field: [value.amt] must be numeric
500failedINTERNAL_ERRORErrorOups... Something wrong on the server! Please contact the administrator to report the issue.
500failedINVALID_CREDENTIALSErrorThe user name was not found
500failedINTERNAL_ERRORErrorSSL CONNECTION REQUIRED
500failedINTERNAL_ERRORErrorINVALID CREDENTIALS
500failedINTERNAL_ERRORErrorINVALID IP
500failedINTERNAL_ERRORErrorINVALID MAC
500failedINTERNAL_ERRORErrorINVALID SSL CERTIFICATE
500failedINTERNAL_ERRORErrorERROR
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
501failedNOT_IMPLEMENTEDErrorFor the context of the current business unit, this feature is not supported.
502failedBAD_GATEWAYErrorINVALID ORIGINATING SYSTEM
502failedBAD_GATEWAYErrorERROR
502failedBAD_GATEWAYErrorOups... Something wrong on one of the underlying servers! Please contact the administrator to report the issue.
502failedGLOBAL002ErrorINVALID ORIGINATING SYSTEM
502failedBAD_GATEWAYErrorWe had a problem with one of our backends that returns a http 500 status. Please to try again later.

Reviews