Search code examples
javascriptrazorpay

Custom fields in Razorpay Checkout form


I am using razorpay for online payments in India,

I want a custom fields like billing address should be store at razorpay account with checkout form. I know about notes which stores a custom data to razorpay account, but i am not getting any link for setting these fields in checkout form.

my code :

var options = {
                "key": [key]
                "amount": [amount],
                "name": [name],
                "description": [desc],
                "image": "logo.png",
                "handler": function (response) {
                    // handler
                },
                "prefill": {
                    "name": userName,
                    "email": userEmail
                },
                "notes": {
                    "billing_name": "Stripe",
                    "billing_address_country": "United States",
                    "billing_address_zip": "94111",
                    "billing_address_state": "CA",
                    "billing_address_line1": "1234 Main Street",
                    "billing_address_city": "San Francisco",
                    "billing_address_country_code": "US",
                },
                "theme": {
                    "color": "#008DD2"
                },
                "modal": {
                    "ondismiss": function () {
                        // code
                    }
                }
            };
            var rzp = new Razorpay(options);
            rzp.open();

So, my question is that how can i get all notes fields in razorpay checkout form?


Solution

  • Notes is a generic field where you can add any custom required details.

    Here is what their documentation says:

    Any additional fields you want to associate with the payment. Usually includes things like shipping address. Upto 15 notes fields may be specified in this way.

    You code here will work

    "notes": {
                        "billing_name": "Stripe",
                        "billing_address_country": "United States",
                        "billing_address_zip": "94111",
                        "billing_address_state": "CA",
                        "billing_address_line1": "1234 Main Street",
                        "billing_address_city": "San Francisco",
                        "billing_address_country_code": "US",
                    }
    

    These details will be available in customer details API, and will not be shown in Razorpay Dashboard.