Callback & Notifications
Overview
Once the order has been placed and payment has been confirmed, you will be notified by ifthenpay via the usual channels, i.e. by push notification, if you have our app installed and have this option activated, by email, or you can check directly in our backoffice.
If you wish to be notified by callback, you must first ask ifthenpay to activate your callback (webhook).
In simpler terms: The callback URL is like a template. When a payment happens, the template is filled in with real information about that payment, and then the information is sent to your website.
ifthenpay offers free technical support to all customers through the following channels:
« go to index
Explanation
The following is an explanation of what a callback is and its purpose.
URL Breakdown:
- http://www.yoursite.com/callback.php: This is the basic address of a PHP script on your website. It's where the information from the payment gateway will be sent.
- ?key=[ANTI_PHISHING_KEY]&orderId=[ORDER_ID]&amount=[AMOUNT]&requestId=[REQUEST_ID]&payment_datetime=[PAYMENT_DATETIME]: This part is called a query string. It contains key-value pairs that provide additional information.
The Square Brackets []:
- The parts within the square brackets are placeholders. They will be replaced with actual values when the payment is processed.
- For example, [ANTI_PHISHING_KEY] will be replaced with a unique security key to prevent fraudulent transactions.
- [ORDER_ID] will be replaced with the specific order number.
- [AMOUNT] will be replaced with the total amount of the purchase.
- And so on.
What Happens During a Callback:
- Customer Completes Purchase: When a customer finishes buying something on your website, the payment gateway processes the transaction.
- Gateway Sends Request: The payment gateway sends a request to the URL you provided.
- Placeholders are Replaced: The gateway replaces the placeholders in the URL with the specific details of the transaction.
- Your Server Receives Data: Your server receives the request and processes the data, updating your database, sending emails, or performing other actions.
Why use a callback URL?
- Automation: It allows you to automate processes like updating order status or sending receipts.
- Security: The [ANTI_PHISHING_KEY] helps prevent fraudulent transactions.
- Flexibility: You can customize the information you receive for each transaction.
Common Use Cases:
- E-commerce: Updating order status, sending shipping notifications.
- Subscriptions: Managing recurring payments and cancellations.
- Donations: Processing donations and issuing receipts.
Multibanco
The description of the replacements is as follows:
- [ANTI_PHISHING_KEY]: Will be replaced with the anti-phishing key that validates the authenticity of the transaction.
- [ORDER_ID]: Will be replaced with the unique order ID associated with the transaction.
- [AMOUNT]: Will be replaced with the total amount of the transaction.
- [REQUEST_ID]: Will be replaced with the request ID that initiated the payment.
- [ENTITY]: Will be replaced with the multibanco entity that was used to process the payment.
- [REFERENCE]: Will be replaced with the multibanco that was used to process the payment.
- [PAYMENT_DATETIME]: Will be replaced with the date and time when the payment was made.
MB WAY
The description of the replacements is as follows:
- [ANTI_PHISHING_KEY]: Will be replaced with the anti-phishing key that validates the authenticity of the transaction.
- [ORDER_ID]: Will be replaced with the unique order ID associated with the transaction.
- [AMOUNT]: Will be replaced with the total amount of the transaction.
- [REQUEST_ID]: Will be replaced with the request ID that initiated the payment.
- [PAYMENT_DATETIME]: Will be replaced with the date and time when the payment was made.
Payshop
The description of the replacements is as follows:
- [ANTI_PHISHING_KEY]: Will be replaced with the anti-phishing key that validates the authenticity of the transaction.
- [ORDER_ID]: Will be replaced with the unique order ID associated with the transaction.
- [AMOUNT]: Will be replaced with the total amount of the transaction.
- [REFERENCE]: Will be replaced with the payshop reference that was used to process the payment.
- [PAYMENT_DATETIME]: Will be replaced with the date and time when the payment was made.
Direct Debit
The description of the replacements is as follows:
- [ANTI_PHISHING_KEY]: Will be replaced with the anti-phishing key that validates the authenticity of the transaction.
- [ORDER_ID]: Will be replaced with the Mandate ID and the identifier, separated by a hyphen, associated with the transaction.
Note: In the order ID example 06866684094-0000
, the first part before the hyphen (06866684094
) corresponds to the Mandate ID, and the second part (0000
) corresponds to the transaction identifier.
- [AMOUNT]: Will be replaced with the total amount of the transaction.
- [REFERENCE]: Will be replaced with the direct debit reference that was used to process the payment.
- [REQUEST_ID]: Will be replaced with the transaction ID that initiated the direct debit payment.
- [PAYMENT_DATETIME]: Will be replaced with the date and time when the payment was made.
In addition to the callback URL, which only confirms when a payment is successfully collected, you can also use the notification URL to receive the status of each individual collection attempt as it is processed.
The following parameters are included in the direct debit notification URL when a payment is either confirmed or refused:
- mandateId: The Mandate ID (e.g., 09039807130).
- transactionId: The Transaction ID (e.g., KL83NVuf0fy8GYkpohVo).
- amount: The total amount of the transaction (e.g., 0.01).
- currency: The transaction currency (e.g., EUR).
- collectionDate: The scheduled collection date (e.g., 2025-04-17).
- reference: The transaction reference (e.g., 6CCEA46379).
- status: The status of the transaction (e.g., PROCESSING).
- PENDING
- PROCESSING
- ACTIVE
- COMPLETED
- ERROR
- CANCELED
- code: The status code returned (e.g., 0000).
PIX
The description of the replacements is as follows:
- [ANTI_PHISHING_KEY]: Will be replaced with the anti-phishing key that validates the authenticity of the transaction.
- [ORDER_ID]: Will be replaced with the unique order ID associated with the transaction.
- [AMOUNT]: Will be replaced with the total amount of the transaction.
- [PAYMENT_DATETIME]: Will be replaced with the date and time when the payment was made.
PAY BY LINK & PINPAY
The description of the replacements is as follows:
- [ANTI_PHISHING_KEY]: Will be replaced with the anti-phishing key that validates the authenticity of the transaction.
- [ID]: Will be replaced with the order ID associated with the transaction.
- [AMOUNT]: Will be replaced with the total amount of the transaction.
- [PAYMENT_METHOD]: Will be replaced with the payment method that was used to process the payment.
- [PAYMENT_DATETIME]: Will be replaced with the date and time when the payment was made.