Metadata not passing through

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": "",
      "cancel_checkout_url": "",
      "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
      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');


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 =;
        let 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

        } else {
            // Handle failed payment
            response.status(200).send("Payment failed");
    } else {
        response.status(405).send("Only POST requests are accepted");

Welcome to the developer community @whitelotus - happy to have you here. Are you still getting the error? Are you in the production or sandbox environment?

Thank you

yes im still getting this error, i am currently in sandbox

Now this is not a problem anymore, by some sudden miracle this is fixed. if you did something i deeply thank you, if note im suprisingly happy that its working.

Thanks @whitelotus for letting us know it is now working for you.