Webhook

Webhook

This is a way SwitchWallet Notifies our Merchants of deposits being made to the wallet addresses They generated, Thus: ("Alert" in our Traditional Fiat Banking system).

Merchants are to provide this "Responds Url" to send this webhooks

So to "Add" or "Update" your webhooks Url

Here is a sample

Add | Update Webhook

PUT BaseUrl/api/v1/merchant/remittancewebhook

Request Body

Name
Type
Description

webHookUrl

String

https://yoursite.com/webhook

publicKey

String

Your PublicKey

Update Webhook Code gist

PUT BaseUrl/api/v1/merchant/remittancewebhook

```
PUT /api/v1/merchant/remittancewebhook HTTP/1.1
Host: testnet.switchwallet.io
Authorization: ApiKey 5128620015083006430
Content-Type: application/json
Content-Length: 93

{
  "webHookUrl": "http://webhook.site",
  "publicKey": "Your publicKey"
}
```
Javascript
var myHeaders = new Headers();
myHeaders.append("Authorization", "ApiKey 5128620015083006430");
myHeaders.append("Content-Type", "application/json");

var raw = JSON.stringify({
  "webHookUrl": "http://webhook.site",
  "publicKey": "Your publicKey"
});

var requestOptions = {
  method: 'PUT',
  headers: myHeaders,
  body: raw,
  redirect: 'follow'
};

fetch("https://testnet.switchwallet.io/api/v1/merchant/remittancewebhook", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

After updating your Webhook Url, SwitchWallet sends the following webhooks

Here are Enums to look out in the webhook payloads

1) Currency

2) Network

3) TransactionStatus

4) TransactionTypeEnum

Click on Currency and Network above to view their schema

TransactionStatus

Enum
Value

ABOUT_TO_INITIATE

1

PENDING

2

CONFIRMED

3

FAILED

4

NOT_PROPAGATED

5

TransactionTypeEnum

Enum
Value

DEPOSIT

1

WITHDRAW

2

TRANSFER

3

MERCHANT_DEPOSIT

4

REMITTANCE

5

Deposit WebhookWithdrawal WebhookRemittance Webhook

Last updated