Edenred Direct Payment Services icon

Edenred Direct Payment Services

(0 reviews)

Use Case: Mexico

1. Generalities

In Mexico, with the Ticket Despensas Card, the daily limit for card usage is 10 times per day, with no days restrictions, no minimum purchase and with maximum purchase limit for the card being MXN $1500. These regulations for daily limit to maximum purchase are handled on the Edenred side.

Food restrictions (Alcohol and Tabacco) will apply for users of Ticket Despensas card and will be handled by the partner.

Please note that all amounts in our API are given in cents (example: 9MXN$ = 900).

2. User Security Tokens

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

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=0ef66819f992451c8399fb7209dc011c=openid%20edg-xp-mealdelivery-api%20offline_access=http://nowhere.edenred.net/oauth/callback=abc123=456azerty=tenant:mx-ben=es

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

  Username: tapia@mailinator.com
  Password: Pablo0206
  Tarjta: ***********24533
  CVC: 438

2) After login and agreement acceptance, you'll be redirected to a url like :

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

3) 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 /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 to your local project manager)

eg: postLogoutRedirectUri = http://nowhere.edenred.net/oauth/callback

3. Direct Payment API

3.1. Postman Collection


Postman Collection Link:

Run in Postman

3.2. User Balance

Get Balances

Get all the available user vouchers including the full sum of their values.

The authorization header is mandatory for this request.

Request:

 GET /v2/users/{username} HTTP/1.1
 Host: directpayment.stg.eu.edenred.io
 Authorization: Bearer {token}
 X-Client-Id: {payment-clientId}
 X-Client-Secret: {payment-clientSecret}

Response:

{
  "meta": {
    "status": "succeeded",
    "messages": []
  },
  "data": {
    "available_amount": 85000,
    "currency": "MXN"
  }
}

Estimate Charge

Checks 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.

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": 1
 }

Response:

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

3.3. User Transactions

Capture Mode: Auto

Step 1: Auto Capture a payment

An auto capture can be requested with an amount ""in cents"".

The "manual" capture is not supported on the Mexican authorization platform: "Capture" and "cancel" APIs are not implemented / supported

The authorization header should be set for this operation.

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
 {
  "order_ref": "889579",
  "mid": "00100128008",
  "amount": 1,
  "security_level": "standard",
  "capture_mode": "auto",
  "tstamp": "2021-10-03T15:20:22Z",
  "currency": "MXN"
 }

Response:

{
    "meta": {
        "status": "succeeded",
        "messages": []
    },
    "data": {
        "mid": "00100128008",
        "authorization_id": "919683",
        "authorized_amount": 1,
        "capture_id": "919683",
        "captured_amount": 1,
        "status": "captured",
        "order_ref": "889579"
    }
}
Step 2: 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 authorization header should not be set for this operation.

The field tstamp MUST be the one used in the authorization to manage the refund

Refund Request:

 POST /v2/transactions/{authorization_id}/actions/cancel HTTP/1.1
 Host: directpayment.stg.eu.edenred.io
 X-Client-Id: {payment-clientId}
 X-Client-Secret: {payment-clientSecret}
 Content-Type: application/json
 {
   "amount": 1,
   "tstamp": "2021-10-03T15:20:22Z",
   "currency": "MXN"
 }

Refund Response:

{
   "meta": {
      "status": "succeeded",
      "messages": []
   },
   "data": {
      "mid": "00100128008",
      "refund_id": "919683",
      "refunded_amount": 1,
      "status": "refunded",
      "order_ref": "889579"
    }
}

4. Error Codes

Status CodeStatusCodeLevelDescription
200succededOKSuccessOK
200failedAUTHSuccessThe transaction has been authorized.
200failedAUTH_PENDINGSuccessThe transaction authorization is pending.
200failedPARTIAL_AUTHSuccessThe transaction has been partially authorized.
400failedINVALID_MERCHANTErrorInvalid Merchant
400failedINVALID_AMOUNTErrorINSUFFICIENT FUNDS
400failedDECLINEDErrorDeclined
400failedINVALID_AMOUNTErrorInvalid Amount
400failedLIMIT_EXCEEDEDErrorLimit exceeded
400failedTRANSACTION_DUPLICATEDErrorTransaction Duplicated
400failedTEMPORARY_HOLDErrorTemporary hold
400failedPARTIAL_REVERSALS_NOT_ALLOWEDErrorPartial resversals not allowed
400failedINCORRECT_PINErrorIncorrect PIN
400failedINVALID_VOUCHERErrorInvalid Voucher
400failedLOCKOUTErrorlockout
400failedPARTIAL_AUTH_NOT_SUPPORTEDErrorPartial authorization not supported
400failedCARD_BLOCKEDErrorCard blocked
400failedCARD_NOT_ACTIVATEDErrorCard is not activated
400failedINVALID_CARDErrorInvalid card
400failedINVALID_CURRENCY_CODEErrorInvalid currency
400failedCARD_ALREADY_ACTIVATEDErrorCard is already activated
400failedACCOUNT_BLOCKEDErrorAccount blocked
400failedINVALID_TRANSACTION_TYPEErrorInvalid transaction type
400failedTOPTP_VALIDATION_FAILEDErrortoptp validation failed
400failedINVALID_CAPTURE_MODEErrorYou are not allowed to capture transaction
400failedINVALID_ACCOUNTErrorInvalid account
400failedVALIDATION_ERRORErrorError for validations
400failedWRONG_USER_DATAErrorWrong user data
400failedBAD_REQUESTErrorRequest is null
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_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
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)
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; 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.
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.
500failedINTERNAL_ERRORErrorInternal Server Error
500failedCARD_EXPIREDErrorCard expired
500failedINTERNAL_ERRORErrorInvalid Message :Field: [value.amt] must be numeric
500failedINTERNAL_ERRORErrorInternal error
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_GATEWAYErrorOups... Something wrong on one of the underlying servers! Please contact the administrator to report the issue.
502failedBAD_GATEWAYErrorWe had a problem with one of our backends that returns a http 500 status. Please to try again later.

Reviews