Skip to content

PayloadHelper doesn't generate correct json object #384

@amitkma

Description

@amitkma

Description

Well, the whole SDK is a mess. But the most annoying part is that the recommendation provided by your tech team in the docs is absolutely stupid. The doc says to use PayloadHelper, but the PayloadHelper doesn't pass the correct amount value.

val payloadHelper = PayloadHelper(currency, amount, orderId)
        payloadHelper.name = name
        payloadHelper.prefillEmail = userEmail
        payloadHelper.prefillContact = userPhone
        payloadHelper.prefillMethod = userPreferredMethod
        payloadHelper.prefillName = userName
        payloadHelper.sendSmsHash = true
        payloadHelper.retryMaxCount = 4
        payloadHelper.color = "#000000"
        payloadHelper.backDropColor = "#ffffff"
        payloadHelper.rememberCustomer = true
        payloadHelper.modalConfirmClose = true
        payloadHelper.hideTopBar = true
        payloadHelper.image = logo
        val json = payloadHelper.getJson()
        checkout.open(this, json)

When using the above code, the amount is always set to 1. But if I update the JSON manually like below, it works fine.

val json = payloadHelper.getJson()
 json.put("amount", amount)

So either you update the docs to use JSONobject and not PayloadHelper or fix it.

Razorpay SDK Version :

razorpay = "1.6.40"

Also, update your samples and SDK to support compose-based views. It's ridiculous that the checkout is bound to an activity through listeners.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions