How to find payment from webhook?

Hi,
When we create transfer, we receive only location id, which is same for all the payments made.
Example of Location:

/transfers/8d653cf5-8d41-ee11-8154-ee5b5eeb80f1

And when we received webhook, we also receive same resourceId in all payloads.

So How can i identifty that for which payment i received which webhook response?

Hi @aakashgameium – it sounds like you may be getting the same resourceId in the location because the idempotency-key header value in the new transfer request is the same.

If you reattempt a POST request with the same value for the Idempotency-Key , rather than creating new or potentially duplicate resources, you will receive a 201 Created , with the original response of the created resource.

If you replace the idempotency-key value, you should be able to create a new transfer which will have a different resourceId.

Hope that helps! Let us know if that’s not the case!

1 Like

Hi @shreya Thanks for quick reply!!
I have tried setting the same in HttpHeaders class but there is no change in result.

ttpHeaders headers = new HttpHeaders(); headers.setAccept(Collections.singletonList(MediaType.parseMediaType(MEDIA_TYPE_DWOLLA)));
headers.set("Idempotency-Key", payment.getTransactionId());
headers.setContentType(MediaType.APPLICATION_JSON);
headers.setBearerAuth(getAppAuthorizationToken());

HttpEntity<DwollaCreateTransferRequestModel> request = new HttpEntity<>(dwollaCreateTransferRequestModel, headers);
URI response = restTemplate.postForLocation(baseUrl + "transfers", request);

Response is still received 201.
Still in the webook, the resource id is same as old and same in all payment webhhok responses.

Hi @aakashgameium, thanks for trying that out. Would you be able to share some examples of transfer resources and webhooks where the resource ID is the same?

Sure! Here is the recent transaction example.
Transfer request response details

CASE 1:
REQUEST
Request Idempotency-Key: 4d16e25b-1e46-48d5-b500-dd6e467fcece
URL in response: https://api-sandbox.dwolla.com/transfers/96bf15a4-fe42-ee11-8154-ee5b5eeb80f1
Path in response: /transfers/96bf15a4-fe42-ee11-8154-ee5b5eeb80f1

Webhook Response
id β†’ 83a3df1e-2e90-41ce-b7d1-7d5b30d0b73f
resourceId β†’ 95bf15a4-fe42-ee11-8154-ee5b5eeb80f1
topic β†’ customer_bank_transfer_completed
Links:
Self: href β†’ https://api-sandbox.dwolla.com/events/83a3df1e-2e90-41ce-b7d1-7d5b30d0b73f
Account: href β†’ https://api-sandbox.dwolla.com/accounts/ee587602-8e57-450f-9f2a-199d187c3254
Resource: href β†’ https://api-sandbox.dwolla.com/transfers/95bf15a4-fe42-ee11-8154-ee5b5eeb80f1
Customer: href β†’ https://api-sandbox.dwolla.com/customers/06be5f6a-c66d-4d3d-916c-e60ce8436dff

CASE 2
Request Idempotency-Key: cd1c0e81-a444-4909-84e9-4b4bbd1f5bd5
URL in response: https://api-sandbox.dwolla.com/transfers/d54ca59f-0043-ee11-8154-ee5b5eeb80f1
Path in response: /transfers/d54ca59f-0043-ee11-8154-ee5b5eeb80f1

Webhook Response
id β†’ 3e173d99-fa21-47c3-a12f-f31efb7c20a5
resourceId β†’ d54ca59f-0043-ee11-8154-ee5b5eeb80f1
topic β†’ customer_transfer_completed
Links:
Self: href β†’ https://api-sandbox.dwolla.com/events/3e173d99-fa21-47c3-a12f-f31efb7c20a5
Account: href β†’ https://api-sandbox.dwolla.com/accounts/ee587602-8e57-450f-9f2a-199d187c3254
Resource: href β†’ https://api-sandbox.dwolla.com/transfers/95bf15a4-fe42-ee11-8154-ee5b5eeb80f1
Customer: href β†’ https://api-sandbox.dwolla.com/customers/06be5f6a-c66d-4d3d-916c-e60ce8436dff

Although i am able to receive corerelation id in resoponse, but since you mentioned that i should be receiving different resourceId if i pass different Idempotency-Key, that is not happening here.

Thanks for the examples, @aakashgameium!

Looking at our webhook logs, I’m seeing the right resource Id for each webhook. Here are some examples:

CASE 1:
REQUEST
Request Idempotency-Key: 4d16e25b-1e46-48d5-b500-dd6e467fcece
URL in response: https://api-sandbox.dwolla.com/transfers/96bf15a4-fe42-ee11-8154-ee5b5eeb80f1
Path in response: /transfers/96bf15a4-fe42-ee11-8154-ee5b5eeb80f1

Webhook

{
    "id": "9f79fd5c-8353-43c6-99c9-b09db21eaf04",
    "eventId": "83a3df1e-2e90-41ce-b7d1-7d5b30d0b73f",
    "subscriptionId": "03e5021c-5e29-40d9-bf2a-570817b0daf1",
    "accountId": "ee587602-8e57-450f-9f2a-199d187c3254",
    "url": "https://webhook.site/9c085cd0-a3de-4256-8f26-672cdc4fc3b5",
    "topic": "customer_bank_transfer_completed",
    "body": "{\"id\":\"83a3df1e-2e90-41ce-b7d1-7d5b30d0b73f\",\"resourceId\":\"95bf15a4-fe42-ee11-8154-ee5b5eeb80f1\",\"topic\":\"customer_bank_transfer_completed\",\"timestamp\":\"2023-08-25T04:28:53.260Z\",\"_links\":{\"self\":{\"href\":\"https://api-sandbox.dwolla.com/events/83a3df1e-2e90-41ce-b7d1-7d5b30d0b73f\"},\"account\":{\"href\":\"https://api-sandbox.dwolla.com/accounts/ee587602-8e57-450f-9f2a-199d187c3254\"},\"resource\":{\"href\":\"https://api-sandbox.dwolla.com/transfers/95bf15a4-fe42-ee11-8154-ee5b5eeb80f1\"},\"customer\":{\"href\":\"https://api-sandbox.dwolla.com/customers/06be5f6a-c66d-4d3d-916c-e60ce8436dff\"}},\"created\":\"2023-08-25T04:28:53.260Z\"}",
    "signature": "242945501672212916e809a39032fcf38bf5d2fb",
    "signatureSha256": "d8b7a65f62ef274ec10b9b430895ffbc8c87645f911f1e79e019437eb3e319ee",
    "timestamp": "2023-08-25T04:28:52.255Z"
}

CASE 2
Request Idempotency-Key: cd1c0e81-a444-4909-84e9-4b4bbd1f5bd5
URL in response: https://api-sandbox.dwolla.com/transfers/d54ca59f-0043-ee11-8154-ee5b5eeb80f1
Path in response: /transfers/d54ca59f-0043-ee11-8154-ee5b5eeb80f1

Webhook

{
    "id": "750c014e-a12e-4f39-846d-81c8afdf19ed",
    "eventId": "3e173d99-fa21-47c3-a12f-f31efb7c20a5",
    "subscriptionId": "03e5021c-5e29-40d9-bf2a-570817b0daf1",
    "accountId": "ee587602-8e57-450f-9f2a-199d187c3254",
    "url": "https://webhook.site/9c085cd0-a3de-4256-8f26-672cdc4fc3b5",
    "topic": "customer_transfer_completed",
    "body": "{\"id\":\"3e173d99-fa21-47c3-a12f-f31efb7c20a5\",\"resourceId\":\"d54ca59f-0043-ee11-8154-ee5b5eeb80f1\",\"topic\":\"customer_transfer_completed\",\"timestamp\":\"2023-08-25T04:37:06.608Z\",\"_links\":{\"self\":{\"href\":\"https://api-sandbox.dwolla.com/events/3e173d99-fa21-47c3-a12f-f31efb7c20a5\"},\"account\":{\"href\":\"https://api-sandbox.dwolla.com/accounts/ee587602-8e57-450f-9f2a-199d187c3254\"},\"resource\":{\"href\":\"https://api-sandbox.dwolla.com/transfers/d54ca59f-0043-ee11-8154-ee5b5eeb80f1\"},\"customer\":{\"href\":\"https://api-sandbox.dwolla.com/customers/06be5f6a-c66d-4d3d-916c-e60ce8436dff\"}},\"created\":\"2023-08-25T04:37:06.608Z\",\"correlationId\":\"cd1c0e81-a444-4909-84e9-4b4bbd1f5bd5\"}",
    "signature": "115d87031b01a18c75d1e57dfa9da34b40c5f4c6",
    "signatureSha256": "8cce53cb8e287c5b42b69fde10c4ac023442f29f2775b0b8a97f1352b553ebc2",
    "timestamp": "2023-08-25T04:37:05.591Z"
}

Could it be that the webhook processing logic on your end is retaining the same "Resource: href" value for all new webhooks?

I can confirm that the webhooks we are sending has the correct Resource link populated in the payload. Let us know if we can help provide any more information!

1 Like

Thanks for the clarification!!! I appreciate the help!!

1 Like

Glad I could help! :slight_smile:

1 Like