pub struct SubscriptionsClient<'a> { /* private fields */ }Expand description
Subscription endpoints. Obtain one from RazorpayClient::subscriptions.
Implementations§
Source§impl<'a> SubscriptionsClient<'a>
impl<'a> SubscriptionsClient<'a>
Sourcepub async fn create(
&self,
params: CreateSubscriptionParams,
) -> Result<Subscription, RazorpayError>
pub async fn create( &self, params: CreateSubscriptionParams, ) -> Result<Subscription, RazorpayError>
Create a subscription — POST /v1/subscriptions.
The returned Subscription::short_url is where the customer authorizes
recurring charges; nothing is billed until they do.
Sourcepub async fn fetch(&self, id: &str) -> Result<Subscription, RazorpayError>
pub async fn fetch(&self, id: &str) -> Result<Subscription, RazorpayError>
Fetch one subscription by id — GET /v1/subscriptions/{id}.
Sourcepub async fn all(
&self,
options: ListOptions,
) -> Result<Collection<Subscription>, RazorpayError>
pub async fn all( &self, options: ListOptions, ) -> Result<Collection<Subscription>, RazorpayError>
List subscriptions — GET /v1/subscriptions.
Sourcepub async fn cancel(
&self,
id: &str,
at_cycle_end: bool,
) -> Result<Subscription, RazorpayError>
pub async fn cancel( &self, id: &str, at_cycle_end: bool, ) -> Result<Subscription, RazorpayError>
Cancel a subscription — POST /v1/subscriptions/{id}/cancel.
at_cycle_end of true lets the customer keep access through the period
they already paid for; false cancels immediately.
Sourcepub async fn pause(&self, id: &str) -> Result<Subscription, RazorpayError>
pub async fn pause(&self, id: &str) -> Result<Subscription, RazorpayError>
Pause a subscription — POST /v1/subscriptions/{id}/pause.
Charging stops until resume; the schedule is not extended.
Sourcepub async fn resume(&self, id: &str) -> Result<Subscription, RazorpayError>
pub async fn resume(&self, id: &str) -> Result<Subscription, RazorpayError>
Resume a paused subscription — POST /v1/subscriptions/{id}/resume.
Sourcepub async fn edit(
&self,
id: &str,
notes: Notes,
) -> Result<Subscription, RazorpayError>
pub async fn edit( &self, id: &str, notes: Notes, ) -> Result<Subscription, RazorpayError>
Replace a subscription’s notes — PATCH /v1/subscriptions/{id}.
Sourcepub async fn invoices(
&self,
id: &str,
) -> Result<Collection<Invoice>, RazorpayError>
pub async fn invoices( &self, id: &str, ) -> Result<Collection<Invoice>, RazorpayError>
List invoices raised for a subscription — GET /v1/invoices?subscription_id={id}.