For new integrations, use the new version of the API.

API MBWAY v2 - REST



A) Webservice for MBWAY Payments


The MBWAY web service is available at the following address:


https://mbway.ifthenpay.com/ifthenpaymbw.asmx

 

The method SetPedido and SetPedidoJson allows to send an MBWAY payment Request

 

The only difference between the 2 methods is the format in which the result is returned. In the first one (SetPedido) it is returned in SOAP format (1.1 and 1.2); in the second (SetPedidoJson) it is returned in JSON format.

 

In addition to the methods mentioned above, there are also methods EstadoPedidos and EstadoPedidosJson. Both return the status of the order. The difference between the two is the format of the result as already described above.

 

All referred methods can be invoked by GET or POST.

 

Method SetPedido or SetPedidoJSON


Parameters:

MbWayKey - (Mandatory) provided by IFTHENPAY when concluding the contract.

canal - (Mandatory) In case this API will always have the constant value “03”.

referencia – (Mandatory) Payment identifier to be defined by the customer ( ex. invoice number, order number, etc…= Maximum 15 characters.

•  valor – (Mandatory) amount to be charged.

•  nrtlm – (Mandatory) Customer phone number.

•  email – (Optional) Customer email.

•  descricao - (Mandatory) description of the payment (you can use the [REFERENCIA] tag if you want the description to be the same as the reference); Maximum 50 characters.

 

Response Result:

<RespostaPedido xmlns="https://www.ifthenpay.com/”>

<IdPedido>string</IdPedido>

< Valor>string</Valor>

< CodigoMoeda>string</CodigoMoeda>

< Estado>string</Estado>

< DataHora>string</DataHora>

< MsgDescricao>string</MsgDescricao>

< /RespostaPedido>

 

  • IdPedido - Automatically generated id, can be saved for later reference the order       status;
  • Valor – Value of the request in Euros;
  • CodigoMoeda – It always has the value 9782;
  • Estado – Indicates the success or error of the operation: (“000” = Order successfully    sent to the customer. If the value is different from “000”, it is necessary to analyze the MsgDescricao field, ex: “113” = invalid mobile number);
  • DataHoraPedido – Date and Time that was requested to the SIBS;
  • MsgDescricao – Message associated with the status of the operation.

 

After the order is placed and as soon as the customer accepts payment on the MBWAY App, he will be notified by IFTHENPAY in the same way as the ATM references, that is, by “ push notification”, if you have our app installed with this option active, by email or consult directly in the BackOffice.

If u wish  to be notified by callback, you must request the activation of the callback 

Note: To carry out the order test we advise you to create an account on the MB WAY app and send the orders to that number and as soon as you receive the notification do not accept the payment, otherwise the payment will be processed normally.

 

Method EstadoPedidos Or EstadoPedidosJSON

 

If you wish to consult the status of the request (s), you can invoke any of these methods.

 

Parameters:

  • mbWayKey – Provided by IFTHENPAY when concluding the contract;
  • canal - (Mandatory) In case this API will always have the constant value “03”.
  • idspagamento – ID returned (IdPedido) at the time of the operation SetPedido/SetPedidoJson;

 

   

Table with possible states ( Code, descripition ) :


Code

Descripton

“000” 

Financial transaction completed successfully

“020” 

Financial transaction cancelled by the user

“048”

Financial transaction cancelled by the Merchant

“100”

The operation could not be completed

“104”

Financial operation not allowed

“111” 

The format of the mobile number was not in the correct format

“113”

The mobile number used as an identifier was not found

“122”

Operation refused to the user

“123”

Financial transaction not found

“125”

Operation refused to the user

 

 

B) Callback MBWAY

 

To activate the payment callback, the process is exactly as described in the previous point. Only the URL format is different.

 

• [CHAVE_ANTI_PHISHING] – Token previous defined by you to autenticate the answer;

[REFERENCIA] – MBWAY Reference;

• [ID_TRANSACAO] – Id Transaction (idPedido);

• [VALOR] – Amount payied;

• [DATA_HORA_PAGAMENTO] – Date/Time of payment (returns on format dd-MM-yyyy HH:mm:ss);

• [ESTADO] - Order status. (returns “PAGO” whenever payment is accepted);

 

URL example:

 

 

http://www.yoursite.com/callback.php?chave=[CHAVE_ANTI_PHISHING]&referencia=[REFERENCIA]&idpedido=[ID_TRANSACAO]&valor=[VALOR]&datahorapag=[DATA_HORA_PAGAMENTO]&estado=[ESTADO]

 

 

As described in the previous point, your URL does not have to return any value. The success of our request is determined by the HTTP code obtained: If you return the HTTP 200 code, IFTHENPAY considers that the call was successful, if you return a different code (HTTP 400, 500 or other) then IFTHENPAY considers that the call does not it was successful and will try again later (it will try 13 times, the first 8 will be every 5 minutes and the rest every hour). If in those 13 attempts you do not get an OK answer, you will not try again.




Support:


IFTHENPAY guarantees free technical assistance to all customers and the following channels can be used:


- e-mail suporte@ifthenpay.com


- Phone:  808 222 777  |  +351 227 660 871 


- New ticket here