Webhooks

Webhooks

Webhooks are an essential part of the integration process as it is the way your application is notified when different actions are processed within Amplify.

Setup

To set up your webhooks, you need to create an Amplify user. Once inside your profile, you can configure the URL where we will send the information at: https://getamplify.app/plataforma/webhooks

Integration

The information will be sent via an HTTP POST Request to the URL you have configured in the administration panel.

Here is a basic example of integrating with Node and Express:

// routes.js
app.post('/api/amplify/webhook', (req, res) => {
    AmplifyController.webhook(req, res);
})
// AmplifyController.js
function webhook(req, res) {
  const { body } = req;
  const { topic, transaction } = body;

  console.log('TOPIC', topic)
  console.log('TRANSACTION', transaction);
}

Interfaces

Currently, there are two types of webhooks in Amplify: PAYMENT_INTENT_CREATED and PAYMENT_CREATED, which have the following interfaces:

PAYMENT_INTENT_CREATED

This webhook is triggered when a user executes a payment intent, which means that the SDK was rendered correctly within your integration.

Response

{
    topic: 'PAYMENT_INTENT_CREATED',
    transaction: {
        paymentIntentId: "123...abc",
        receiverId: "123...abc",
        status: "CREATED",
        metadata: { randomKey: "randomValue"}
    }
}

PAYMENT_CREATED

This webhook is triggered when a payment is processed successfully.

Response

{
    topic: 'PAYMENT_CREATED',
    transaction: {
        paymentId: "123...abc",
        receiverId: "123...abc",
        amount: "1.0",
        token: "USDC",
        chain: "mumbai",
        metadata: { randomKey: "randomValue"},
        symbol: "USDC"
    }
}

Última actualización