'how can i pass metadata to square ChargeRequest same as we do in stripe PaymentIntentCreateParams

Currently i have integrated stripe and square in my application.
and i have some extra data(metadata) that needs to be stored in square ChargeRequest API.

ChargeRequest body = new ChargeRequest()
                .idempotencyKey(UUID.randomUUID().toString())
                .amountMoney(new Money()
                        .amount(GeneralUtils.getInCents(amount))
                        .currency(Money.CurrencyEnum.fromValue(currency)))
                .customerId(customerId)
                .customerCardId(customerCardId)
                .additionalRecipients(getAdditionalRecipientsAsAe(applicationFee,currency))
                .buyerEmailAddress(email);```

I am unable to find API to send metadata for square related API.

as same thing i can do with stripe using below API
PaymentIntentCreateParams.Builder().putAllMetadata(metadataParams)

here metadataParams is map of string key-value pair


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source