![]() This task involves at least three features to implement, and will allow us to talk about both datetime arguments to the API and datetime properties of objects returned from the API. “if at all.” → It’s possible the property on the Subscription that represents when it was canceled is null (if it is not canceled).“they know when the subscription was canceled” → we need to render the date and time that the subscription was canceled.“if the user retrieves a Subscription from the API” → this is a different feature for the retrieve endpoint.“when they want the Subscription to cancel” → the new date and time should be stored somewhere so that we can use it in a new background job that will cancel subscriptions.“users can pass a date and time in the future” → we need to receive the date and time from the user as an argument to the API.“While creating or updating a Subscription with the API” → this feature will need to work for both create and update endpoints.While creating or updating a Subscription with the API, users can pass a date and time in the future when they want the Subscription to cancel and if the user retrieves a Subscription from the API, they know when the subscription was canceled if at all. They are building complex workarounds with cron jobs and would rather tell Stripe when the Subscription should be canceled. Users report that one of their challenges is canceling subscriptions at a later date. Imagine you want to add a new feature to a Subscriptions API. Today you’ll learn the design patterns Stripe engineers use when adding date and time fields to the API. When adding new features to an API, its important to refer to existing patterns so that we can provide a predictable interface. Part of a good developer experience is consistency, whether that’s in the design of the path names (all being either snake_case or kebab-case) or every entity having an id property with its unique identifier. APIs are built for developers to use - and successful APIs are designed with developer experience in mind.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |