Subscriptions allow you to charge a customer on a recurring basis. It ties a customer to a particular plan.
To create a Subscription use:
- Create Options: StripeSubscriptionCreateOptions
- Response: StripeSubscriptionCreateResponse
- Errors: StripeError
To update a Subscription use:
- Update Options: StripeSubscriptionUpdateOptions
- Response: StripeSubscriptionUpdateResponse
- Errors: StripeError
To retrieve a Subscription use:
- Response: StripeSubscriptionRetrieveResponse
- Errors: StripeError
To cancel a Subscription use:
- Response: StripeSubscriptionCancelResponse
- Errors: StripeError
Note: When cancelling a subscription, you can add an optional parameter to determine whether the subscription will end inmediately or after the next billing period. By default, this parameter is false.
&CancelAtPeriodEnd = true //true if you want to charge one last time (at period end)
&StripeSDKMain.CancelSubscription(&Api_Key,&SubscriptionId,&CancelAtPeriodEnd,&Response,&Errors,&ErrorCode)
if &ErrorCode = 0
&StripeSubscriptionCancelResponse.FromJson(&Response)
Msg(&StripeSubscriptionCancelResponse.ToJson())
else
&StripeError.FromJson(&Errors)
Msg(&StripeError.ToJson())
EndIf