chargebee / chargebee-ruby

Ruby library for the Chargebee API.

Home Page:https://apidocs.chargebee.com/docs/api?lang=ruby

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Can't get subscription after creation at once

remy727 opened this issue · comments

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?

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

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.