From 51e96ab54ea18e0ff96a1e541d4e18f24ebabed4 Mon Sep 17 00:00:00 2001 From: beniaminmunteanu Date: Mon, 23 Nov 2026 14:25:07 +0200 Subject: [PATCH 1/2] feat(MER-155): Open Payments webhook on the management API --- merchant-api.yaml | 86 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 86 insertions(+) diff --git a/merchant-api.yaml b/merchant-api.yaml index e5c2644..ec26ce6 100644 --- a/merchant-api.yaml +++ b/merchant-api.yaml @@ -70,6 +70,9 @@ tags: description: | Register known POS manufacturer/model combinations used to validate terminal registration and BDK storage. + - name: webhook + description: | + Notifications from the Open Payments provider. paths: /v1/manufacturer-models: @@ -528,6 +531,40 @@ paths: '500': $ref: '#/components/responses/InternalError' + /v1/webhooks/open-payments: + post: + summary: Receive Open Payments notification + operationId: receiveOpenPaymentsWebhook + tags: + - webhook + description: | + The Open Payments provider sends payment notifications here. + + The Merchant API acts on `payment_intent.completed` for an incoming + payment it created for a card transaction. It matches the + transaction by the `requestId` in the payment intent's metadata. + This includes a transaction whose outgoing payment the Merchant API + reported as failed, because the payment may have been created anyway. + It acknowledges every other notification without acting on it. + + Repeating a notification returns `204` again. + requestBody: + required: true + description: The notification. + content: + application/json: + schema: + $ref: '#/components/schemas/OpenPaymentsWebhook' + responses: + '204': + description: The notification is accepted. + '400': + $ref: '#/components/responses/BadRequest' + '409': + $ref: '#/components/responses/WebhookConflict' + '500': + $ref: '#/components/responses/InternalError' + components: parameters: MerchantId: @@ -703,6 +740,25 @@ components: detail: invalid status transition instance: 07cf97fa-7c93-4d22-8ad5-eba4116672e6 + WebhookConflict: + description: | + The notification can't be applied to the transaction: + - `payment-not-completable`: the transaction has no payment to + complete. + content: + application/problem+json: + schema: + $ref: '#/components/schemas/Problem' + examples: + paymentNotCompletable: + summary: The transaction has no payment to complete + value: + type: tag:interledger.org,2026:problems/payment-not-completable + title: Payment not completable + status: 409 + detail: transaction has no payment to complete + instance: 07cf97fa-7c93-4d22-8ad5-eba4116672e6 + InternalError: description: Internal server error. content: @@ -1260,6 +1316,36 @@ components: pattern: '^[A-Z]{2}$' example: SI + OpenPaymentsWebhook: + type: object + description: A notification from the Open Payments provider. + required: + - id + - type + - data + properties: + id: + type: string + description: Identifier of the notification. + type: + type: string + description: Notification type, for example `payment_intent.completed`. + example: payment_intent.completed + data: + $ref: '#/components/schemas/OpenPaymentsWebhookData' + + OpenPaymentsWebhookData: + type: object + description: The payment intent the notification is about. + required: + - id + properties: + id: + type: string + description: Identifier of the payment intent. + metadata: + description: The payment intent's metadata, as given when it was created. + Problem: type: object description: | From 5dda635cd771cd796c5176f8d0df9acd74e27d33 Mon Sep 17 00:00:00 2001 From: beniaminmunteanu Date: Mon, 23 Nov 2026 15:13:18 +0200 Subject: [PATCH 2/2] docs(MER-155): explain how the webhook recognises a card payment --- merchant-api.yaml | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/merchant-api.yaml b/merchant-api.yaml index ec26ce6..4694288 100644 --- a/merchant-api.yaml +++ b/merchant-api.yaml @@ -538,14 +538,21 @@ paths: tags: - webhook description: | - The Open Payments provider sends payment notifications here. - - The Merchant API acts on `payment_intent.completed` for an incoming - payment it created for a card transaction. It matches the - transaction by the `requestId` in the payment intent's metadata. - This includes a transaction whose outgoing payment the Merchant API - reported as failed, because the payment may have been created anyway. - It acknowledges every other notification without acting on it. + The Open Payments provider sends payment notifications here, in the + same envelope it sends to the wallet provider: `id`, `type` and + `data`. For `payment_intent.completed`, `data` is the payment intent, + including the `metadata` it was created with. + + When the Merchant API creates the incoming payment for a card + transaction, it puts the transaction's `requestId` in the metadata. + A `requestId` in `data.metadata` therefore marks a card payment. The + Merchant API completes the transaction with that `requestId`. This + includes a transaction whose outgoing payment it reported as failed, + because the payment may have been created anyway. + + Anything else gets `204` without action: other notification types, + payment intents without a `requestId`, and a `requestId` the Merchant + API does not know. Repeating a notification returns `204` again. requestBody: @@ -1344,7 +1351,9 @@ components: type: string description: Identifier of the payment intent. metadata: - description: The payment intent's metadata, as given when it was created. + description: | + The payment intent's metadata, as given when it was created. A + card payment's carries the transaction's `requestId`. Problem: type: object