Documentation Index
Fetch the complete documentation index at: https://docs.propaga.mx/llms.txt
Use this file to discover all available pages before exploring further.
Webhook Endpoint
You should configure your webhook endpoint to receive POST requests from Propaga. The webhook will send the paid transaction notification data in JSON format.
Please contact us to set up the webhook.
Payload Structure
Here’s an example of the webhook payload you’ll receive:
{
"transactionId": "671f75a4-f145-4f4b-82ff-4eaf0fd1e5aa",
"cornerStoreId": "57b9d911-1c6e-45c0-be98-bfaeec8d9cf8",
"wholesalerTransactionId": "bd0880c6-45a7-4998-b30f-65f91f28956d",
"totalAmount": 1000,
"interest": 200,
"totalAmountWithInterest": 1200,
"paidDate": "2024-01-01T00:00:00Z",
"status": "paid"
}
Payload Fields
| Field | Type | Description |
|---|
transactionId | String | The Propaga’s ID of the transaction. |
cornerStoreId | String | The ID of the corner store. |
wholesalerTransactionId | String | The ID of the transaction in the wholesaler system. |
totalAmount | Number | The total amount of the transaction. |
interest | Number | The interest of the transaction. |
totalAmountWithInterest | Number | The total amount of the transaction with interest. |
paidDate | String | The date when the transaction was paid. |
status | String | The status of the transaction. |
Handling the Webhook
Here’s an example of how to handle the webhook in different programming languages:
app.post('/webhook/paid-transaction-notification', async (req, res) => {
try {
const paidTransactionNotification = req.body;
// Process the paid transaction notification data
await processPaidTransactionNotification(paidTransactionNotification);
// Respond with success
res.status(200).json({ status: 'success' });
} catch (error) {
console.error('Error processing paid transaction notification:', error);
res.status(500).json({ status: 'error', message: error.message });
}
});
async function processPaidTransactionNotification(paidTransactionNotification) {
// Validate the paid transaction notification
console.log(`Processing paid transaction notification: ${paidTransactionNotification.id}`);
console.log(`Status: ${paidTransactionNotification.status}`);
// Process each transaction
console.log(`Transaction ID: ${paidTransactionNotification.transactionId}`);
console.log(`Corner Store ID: ${paidTransactionNotification.cornerStoreId}`);
console.log(`Wholesaler Transaction ID: ${paidTransactionNotification.wholesalerTransactionId}`);
console.log(`Total Amount: ${paidTransactionNotification.totalAmount}`);
console.log(`Interest: ${paidTransactionNotification.interest}`);
console.log(`Total Amount With Interest: ${paidTransactionNotification.totalAmountWithInterest}`);
console.log(`Paid Date: ${paidTransactionNotification.paidDate}`);
console.log(`Status: ${paidTransactionNotification.status}`);
}
Best Practices
-
Verify the Webhook Source: Implement security measures to verify that the webhook is coming from Propaga.
-
Implement Idempotency: Store the
referenceNumber to avoid processing the same conciliation multiple times.
-
Handle Errors Gracefully: Implement proper error handling and logging to track any issues with webhook processing.
-
Respond Quickly: Your webhook endpoint should respond as quickly as possible. If processing takes time, handle it asynchronously.
-
Validate Data: Always validate the incoming data before processing it.