chargebee / chargebee-ruby

Ruby library for the Chargebee API.
https://apidocs.chargebee.com/docs/api?lang=ruby
MIT License
32 stars 60 forks source link

Can't get subscription after creation at once #58

Closed remy727 closed 1 year ago

remy727 commented 3 years ago

We could create a subscription without any errors. But when trying to get a subscription by customer id in a short time, we couldn't get the subscription. This happens sometimes.

# Create subscription
ChargeBee::Subscription.create_for_customer(chargebee_customer_id, params)

# Get subscription by customer id
list = ChargeBee::Subscription.list({"customer_id[is]" => chargebee_customer_id, limit: 1})
subscription = list.first.subscription # ERROR: undefined method `subscription' for nil:NilClass

I think there should be a delay on Chargebee and it should take few seconds to create a subscription.

What is the way to fix this issue and how long does it take to be created?

deadalice commented 2 years ago

This also happens sometimes with ChargeBee::Subscription.create_for_customer(chargebee_customer_id, params) as well: it just returns empty value.

cb-khushbubibay commented 1 year ago

Hi @remy727 and @deadalice I have conducted a test on the same scenario, where I created a customer and subscription simultaneously using the latest version of chargebee-ruby v2.27.1. Fortunately, I did not encounter the mentioned issue.

I kindly request you to update your chargebee-ruby version to v2.27.1 and attempt the process again. If the issue persists, please feel free to reopen this matter for further investigation.