I have a flutter app in the making and i have succesfully made the payment work using InAppWebView where user can pay… But i try to pass a metadata for the info that i need about the user and product, but it doesnt seem to be coming into the webhook.
i recieve the webhook with firebase functions, and when i log the response the metadata list is empty.
what am i missing?
i will share the code im using here
---------------------this is my rapyd.dart
Map<String, dynamic> _getBody(String type, String eventId, String userId) {
    return {
      "amount": amount.toString(),
      "currency": "ISK",
      "country": "IS",
      "complete_checkout_url": "https://www.thewhitelotus.is/",
      "cancel_checkout_url": "https://www.mamareykjavik.is/",
      "metadata": {
        "purchase_type": type,
        "event_id": eventId,
        "user_id": userId,
      }
    };
  }
Future<http.Response> createCheckoutPage(String type, String eventId, String userId) async {
    final responseURL = Uri.parse("$baseUrl/v1/checkout");
    final String body = jsonEncode(_getBody(type, eventId, userId));
    print(body); // This will show you the exact structure being sent
    var response = await http.post(
      responseURL,
      headers: _getHeaders("/v1/checkout", body: body),
      body: body,
    );
    return response;  
}
---------------------Here is the Index.js
const functions = require('firebase-functions');
const admin = require('firebase-admin');
admin.initializeApp();
exports.rapydWebhook = functions.region('europe-west1').https.onRequest(async (request, response) => {
        console.log("Full webhook payload:", JSON.stringify(request.body));
    if (request.method === "POST") {
        console.log("Webhook event received:", request.body);
        // Extract payment status and metadata
        const paymentStatus = request.body.data.status;
        let metadata = request.body.data.metadata;
        if (typeof metadata === 'string') {
            metadata = JSON.parse(metadata);
        }
        const purchaseType = metadata.purchase_type;
        const eventId = metadata.event_id;
        const userId = metadata.user_id;
        // Check if the payment was successful
        const isSuccess = paymentStatus === 'CLO';
        if (isSuccess) {
            if (purchaseType === 'event') {
                // Logic for handling event ticket purchase
            } else if (purchaseType === 'store') {
                // Logic for handling store purchase
            }
            response.status(200).send("Received");
        } else {
            // Handle failed payment
            response.status(200).send("Payment failed");
        }
    } else {
        response.status(405).send("Only POST requests are accepted");
    }
});