conekta / conekta-node

Node.js library for Conekta api calls
https://conekta.com
MIT License
39 stars 22 forks source link

Updating payment source without index #82

Closed kr05 closed 1 year ago

kr05 commented 5 years ago

I am trying to update a customer's payment source and according to the tutorial we have to use the following method:

conekta.Customer.find("cus_zzmjKsnM9oacyCwV3", function(err, customer) {
  customer.payment_sources.get(0).update({ exp_month: 11 },
  function(err, paymentSource) {
    console.log(paymentSource);
  });
});

My questions is...can we update a payment source using its ID instead of the array index? I tried passing the ID into the get method, but it throws an error. My second attempt was to store the index when creating the payment source, but unfortunately the index is not returned when creating a payment source using the createPaymentSource method. I would appreciate any pointers and suggestions, thanks!

javorosas commented 5 years ago

+1, this would be ideal

humbertowoody commented 5 years ago

+1, why is this not the default? D:

leofischer commented 4 years ago

+1, id would definitely make a lot more sense and there appears to be several issues related to the usability of payment source arrays. Am flagging this as an enhancement.