API Integration by POST:


Note: You need an mbKey supplied for Ifthenpay to use that API. If you don't have any mbKey, please request one from ifthenpay.


Production Endpoint Url:

https://ifthenpay.com/api/multibanco/reference/init


Sandbox Endpoint Url: (All tests must be performed through the sandbox)

https://ifthenpay.com/api/multibanco/reference/sandbox


For responsible use of the service, we recommend ALWAYS using the sandbox for testing. Abuse of the production API may generate a lock on the account.


Request format Json (Body)

 

{

    "mbKey": "MBK-000000",

    "orderId": "order-1234",

    "amount": "1234.56",

    "description": "DESCRIPTION",

    "url": "URL_STORE_SITE",

    "clientCode": "",

    "clientName": "",

    "clientEmail": "",

    "clientUsername": "",

    "clientPhone": "",

    "expiryDays" : 3

}


Definition of parameters:


mbKey: (mandatory) - Multibanco Key assigned by ifthenpay.

orderId: (required) - Order/invoice number up to a maximum of 15 characters.

amount: (mandatory) - Amount to be charged in the reference. Decimal separator "." (Ex: "1234.56")

description: (optional) - Short description up to a maximum of 200 characters.

url: (optional) - Web address up to a maximum of 200 characters.

clientCode: (optional) - Your client code up to a maximum of 200 characters.

clientName: (optional) - Name of your client up to a maximum of 200 characters.

clientEmail: (optional) - Your client email address up to a maximum of 200 characters.

clientUsername: (optional) - Username of your client up to a maximum of 200 characters.

clientPhone: (optional) - Your customer's cell phone/phone up to a maximum of 200 characters.

expiryDays: (optional) - Number of days until reference expire. Accepted values in days: 0, 1, 2, 3, 4, 5... up to 31, 45, 60, 90, 120, 180, 365, 730 


Example of the number of validity days:

expiryDays=0 valid until midnight of the same day. AIn the remaining options, the validity will be the sum of the number of days indicated to the date of generation of the reference (until 23:59h).


(Ex: expiryDays: 1 - Valid until 23.59h of the following day)


Important notes:


If the number of days sent is different from those indicated, the day immediately following available will be assigned.

(Ex: 155 will be given 180 days until expire).


If you do not want expiration date on the reference, you should not send the "expiryDays" parameter in the request.


Response format Json:


{

    "Amount": "1234.56",

    "Entity": "11990",

    "ExpiryDate": "30-10-2021",

    "Message": "Success",

    "OrderId": "order-1234 ",

    "Reference": "000000291",

    "RequestId": "5Qd8gtWLAEUJ6n0lkS5g",

    "Status": "0" 

}


In case of parameter "Status" <> "0", check the reason in the parameter "Message".


For the example above, the information presented to the customer would be:


Entity: 11990

Reference: 000000291

Amount: 1234.56


Payment deadline: 30-10-2021


CALLBACK (Webhook)


We always advise you to set a callback url and an antiphishing key with ifthenpay, that way whenever a payment occurs this url will be called and you can read the payment information in it.


http://www.yoursite.com/callback.php?key=[ANTI_PHISHING_KEY]&orderId=[ORDER_ID]&amount=[AMOUNT]&requestId=[REQUEST_ID]&entity=[entity]&reference=[REFERENCE]&payment_datetime=[PAYMENT_DATETIME]



Example of Callback URL called (after confirmed payment):

http://www.yoursite.com/callback.php?key=my_anti_phishing_key&orderId=order-1234&amount=1234.56&requestId=5Qd8gtWLAEUJ6n0lkS5g&entity=11990&reference=075000291&payment_datetime=28-10-2021 10:55:21


Support:


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


- Through the email suporte@ifthenpay.com

- By phone: +351 227 660 871

- By opening a ticket here on helpdesk