@prood/payment-ifthenpay
Ifthenpay payment provider for Portugal — Multibanco, MB WAY, and credit card.
@prood/payment-ifthenpay implements the PaymentProvider interface for Ifthenpay — a Portuguese payment provider supporting Multibanco, MB WAY, and credit card payments.
Installation
Workspace package. Available from the source repo for now.
Usage
import { IfthenpayPaymentProvider } from '@prood/payment-ifthenpay'
const provider = new IfthenpayPaymentProvider({
antiPhishingKey: config.antiPhishingKey,
mbKey: config.mbKey,
mbWayKey: config.mbWayKey,
ccKey: config.ccKey,
})Configuration
| Field | Description |
|---|---|
antiPhishingKey | Anti-phishing verification key |
mbKey | Multibanco gateway key |
mbWayKey | MB WAY gateway key. Optional |
ccKey | Credit card gateway key. Optional |
Each store enters these under Integrations in the dashboard. There is no environment fallback.
mbKey is required, since Multibanco is the default method. The other keys are optional, and each one unlocks its method at checkout.
Ifthenpay has no read-only call to test keys with, so they aren't tested on save. It has no refund API either: refunds happen in the Ifthenpay backoffice, then the merchant records them in the dashboard.
Selecting a method
Pass method on createSession() (defaults to multibanco):
method | Key used | Result |
|---|---|---|
multibanco | mbKey | Entity + reference in providerData |
mbway | mbWayKey | MB WAY push; providerData.requestId |
card | ccKey | Redirect to Ifthenpay hosted card page |
const session = await provider.createSession({
amount: 49.9,
currency: 'EUR',
orderId: 'ord_123',
method: 'mbway',
customer: { phone: '912345678' },
})Reference-based methods (Multibanco) confirm asynchronously — the webhook callback is the source of truth, not a synchronous capture.
Factory usage
import { getTenantPaymentProvider } from '@prood/commerce'
const { provider } = await getTenantPaymentProvider(orgId, 'ifthenpay')Payment methods
| Method | Key | Flow |
|---|---|---|
| Multibanco | mbKey | Entity + reference; async ATM/homebanking payment |
| MB WAY | mbWayKey | Phone push notification |
| Credit card | ccKey | Redirect to Ifthenpay hosted page |
Anti-phishing verification
Ifthenpay uses an anti-phishing key to verify webhook authenticity. The provider validates incoming webhooks against this key before processing.
Webhook setup
The integration form shows the callback URL for your store. Send it to Ifthenpay with your anti-phishing key:
https://checkout.example.com/api/webhooks/ifthenpay/{orgId}?key=[ANTI_PHISHING_KEY]&orderId=[ORDER_ID]&amount=[AMOUNT]&requestId=[REQUEST_ID]Order ids are encoded to fit Ifthenpay's 25-character limit and decoded when the callback arrives.