Search code examples
phppayment-gatewayrazorpay

prefill not working in razorpay


$data = [
        "key"               => $api_key,
        "amount"            => $amount,
        "name"              => "DJ Tiesto",
        "description"       => "Tron Legacy",
        "image"             => "logo.png",
        "prefill"           => [
                                    "name"     => "Daft Punk",
                                    "email"    => "[email protected]",
                                    "contact"  => "9999999999",
                               ],
        "notes"             => [
                                    "address"           => "Hello World",
                                    "merchant_order_id" => "12312321",
                               ],
        "theme"             => [
                                    "color"    => "#F37254"
                               ],
        "order_id"          => $razorpayOrderId,
    ];

I am trying to integrate razorpay with php everything is ok but in prefill, I get a default value. how can I change this value to custom value?


Solution

  • In prefill you will get the value which you are given in the prefill object. Just like you passsed $amount and $razorpayOrderId you can use $name and $email etc which might be the value you get from textbox or something like that. Store those names and email in a variable and pass that into prefill.