razorpay / razorpay-node

Razorpay node.js bindings
MIT License
182 stars 111 forks source link

partial payment and notes not working together #327

Open Murtoz-h opened 1 year ago

Murtoz-h commented 1 year ago

Steps to reproduce the behavior

During Creating order in Nodejs using option created by following code.

Expected behavior

if there are partial amount, create order with partial payment or create full payment order

Actual behavior

when there are partial payment, returned error notes["anything"] are extra document, error code 400. without partial payment, zero partial payment working as expected.

Code snippets

if ((first_payment_min_amount != undefined || first_payment_min_amount != null) && (first_payment_min_amount > 0 && first_payment_min_amount < amount)) {
    var option = {
      notes: notes,
      amount: amount,  // amount in the smallest currency unit
      //currency: "INR",
      partial_payment: true,
      first_payment_min_amount: first_payment_min_amount,
      receipt: receipt,

    };

  }
  else {

    option = {
      "amount": amount,  // amount in the smallest currency unit
      "currency": "INR",

      "receipt": receipt,
      "notes": notes
    };
  }

Node version

Node 16

Library version

2.8.4

Additional Information

currently I can create more than one order with single receipt, both through api and nodejs. Dont know its new feature or bug. Previously I could create only one order against one receipt.

ankitdas13 commented 1 year ago

@Murtoz-h We have identified the issue and it will be fixed in the next release

Murtoz-h commented 1 year ago

In the meantime, do you have any suggestion about alternative way? Another request, please look at the "Additonal Information" section.

ankitdas13 commented 1 year ago

@Murtoz-h could you please try this code snippet and let me know is it working or not ?

const option = { "amount": 10000, "currency":"INR", "partial_payment": 1, "first_payment_min_amount": 50000, "receipt": "#test89", "notes": {"key1": "value3"} }

const payload = { url : "orders", data : option }

instance.api.post(payload).then(res=> console.log(res)).catch(err=> console.log(err))

Murtoz-h commented 1 year ago

@Murtoz-h could you please try this code snippet and let me know is it working or not ?

const option = { "amount": 10000, "currency":"INR", "partial_payment": 1, "first_payment_min_amount": 50000, "receipt": "#test89", "notes": {"key1": "value3"} }

const payload = { url : "orders", data : option }

instance.api.post(payload).then(res=> console.log(res)).catch(err=> console.log(err))

Thank you, it seems working. Please look into the "Additional Information section".