# Instructions

### 1. Calling the payment widget

To trigger a payment, you need to call our checkout widget with the following URL and mandatory parameters:

```
https://widget.mtpelerin.com/?_ctkn=<integrationKey>&tabs=merchant&bdc=<SettlementCurrency>&bda=<amountInSettlementCurrency>&oid=<merchant_order_id>
```

* **integrationKey:** the unique integration key that you will have received from us by email.
* **SettlementCurrency:** the crypto or fiat currency in which you want to denominate the payment.
* **amountInSettlementCurrency:** the payment amount in the SettlementCurrency.
* **merchant\_order\_id:** your internal payment order ID.

Here are all the codes that you can use for the SettlementCurrency parameter:

**Fiat codes:** AUD, CAD, CHF, CZK, DKK, EUR, GBP, HKD, HUF, JPY, MXN, NOK, NZD, PLN, SEK, SGD, USD, ZAR

**Crypto codes:** AVAX, BNB, BTC, BTC.b, BTCB, cbBTC, CELO, crvUSD, DAI, ETH, EURA, EURC, EURS, FRAX, GHO, LUSD, PAXG, POL, RBTC, RIF, S, sat, tzBTC, USDC, USDC.e, USDRIF, USDT, WBTC, WETH, XAUt, XDAI, XTZ, ZCHF

### 2. Payment confirmation

Once a payment has been made successfully, we call a webhook on your side to let you know that the transaction is completed. The webhook contains the following info:

```
{
    "id": "664369c938b3ca001a3cd44f" // our own transaction id,
    "amount": 123.45,
    "currency": "USDC",
    "external_id": "123456789", // The order id that you passed in the widget parameters (oid)
}
```

#### Webhook setup

For us to setup the webhook, we need from you the webhook URL that we must call, as well as 2 keys (authentication and signature) that we will exchange.

The authentication key will be used in the "Authentication" header.

The signature key will allow to compute a HMAC on your side. This HMAC will have to be the same as the "Mtp-Signature" header parameters. The HMAC has to be computed on the full request body. JS example:

```
const computedSignature = crypto.createHmac('sha256', SIGNATURE_KEY).update(JSON.stringify(body)).digest('hex')
```
