Repository: VictorAvelar/mollie-api-go
Pull request #351 (2024-03-15 19:57:21)

check subscriptions resource against api reference
<!--- Provide a general summary of your changes in the Title above -->

# Description

Ensures that the `subscriptions` resource delivers API parity. 

## Motivation and context

Ensures the library has full API parity.

## How has this been tested?

Please describe in detail how you tested your changes.

Include details of your testing environment, and the tests you ran to
see how your change affects other areas of the code, etc.

- [x] Unit tests added / updated
- [x] The tests run on docker (using `make test`)
- [ ] The required `test data` has been added / updated

If you are running the tests locally, please specify:

- OS: macos
- Go version 1.22

## Types of changes

What types of changes does your code introduce? Put an `x` in all the boxes that apply:

- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [x] Breaking change (fix or feature that would cause existing functionality to change)
- [ ] This change requires a documentation update

## Checklist

Go over all the following points, and put an `x` in all the boxes that apply.

Please, please, please, don't send your pull request until all of the boxes are ticked. Once your pull request is created, it will trigger a build on our continuous integration server to make sure your [tests and code style pass](https://help.github.com/articles/about-required-status-checks/).

- [x] I have read the **[CONTRIBUTING](CONTRIBUTING.md)** document.
- [x] My pull request addresses exactly one patch/feature.
- [x] I have created a branch for this patch/feature.
- [x] Each individual commit in the pull request is meaningful.
- [x] If my change requires a change to the documentation, I have updated it accordingly.

<!-- If you're unsure about any of these, don't hesitate to ask. We're here to help! -->



Patch:
diff --git a/docs/README.md b/docs/README.md
index fcc685d..3f2f07d 100644
--- a/docs/README.md
+++ b/docs/README.md
@@ -121,6 +121,7 @@ REST also implies a nice and clean structure for URLs or endpoints. This means y
 - [type CreatePreAuthorizedPaymentFields](<#CreatePreAuthorizedPaymentFields>)
 - [type CreateRecurrentPaymentFields](<#CreateRecurrentPaymentFields>)
 - [type CreateShipmentRequest](<#CreateShipmentRequest>)
+- [type CreateSubscription](<#CreateSubscription>)
 - [type Customer](<#Customer>)
 - [type CustomerLinks](<#CustomerLinks>)
 - [type CustomersList](<#CustomersList>)
@@ -162,6 +163,7 @@ REST also implies a nice and clean structure for URLs or endpoints. This means y
 - [type ListLinkedClientsOptions](<#ListLinkedClientsOptions>)
 - [type ListPaymentOptions](<#ListPaymentOptions>)
 - [type ListSettlementsOptions](<#ListSettlementsOptions>)
+- [type ListSubscriptionsOptions](<#ListSubscriptionsOptions>)
 - [type Locale](<#Locale>)
 - [type Mandate](<#Mandate>)
 - [type MandateDetails](<#MandateDetails>)
@@ -350,18 +352,18 @@ REST also implies a nice and clean structure for URLs or endpoints. This means y
   - [func \(d \*ShortDate\) MarshalJSON\(\) \(\[\]byte, error\)](<#ShortDate.MarshalJSON>)
   - [func \(d \*ShortDate\) UnmarshalJSON\(b \[\]byte\) error](<#ShortDate.UnmarshalJSON>)
 - [type Subscription](<#Subscription>)
+- [type SubscriptionAccessTokenFields](<#SubscriptionAccessTokenFields>)
 - [type SubscriptionLinks](<#SubscriptionLinks>)
-- [type SubscriptionList](<#SubscriptionList>)
-- [type SubscriptionListOptions](<#SubscriptionListOptions>)
 - [type SubscriptionStatus](<#SubscriptionStatus>)
+- [type SubscriptionsList](<#SubscriptionsList>)
 - [type SubscriptionsService](<#SubscriptionsService>)
-  - [func \(ss \*SubscriptionsService\) All\(ctx context.Context, opts \*SubscriptionListOptions\) \(res \*Response, sl \*SubscriptionList, err error\)](<#SubscriptionsService.All>)
-  - [func \(ss \*SubscriptionsService\) Create\(ctx context.Context, cID string, sc \*Subscription\) \(res \*Response, s \*Subscription, err error\)](<#SubscriptionsService.Create>)
-  - [func \(ss \*SubscriptionsService\) Delete\(ctx context.Context, cID, sID string\) \(res \*Response, s \*Subscription, err error\)](<#SubscriptionsService.Delete>)
-  - [func \(ss \*SubscriptionsService\) Get\(ctx context.Context, cID, sID string\) \(res \*Response, s \*Subscription, err error\)](<#SubscriptionsService.Get>)
-  - [func \(ss \*SubscriptionsService\) GetPayments\(ctx context.Context, cID, sID string, opts \*SubscriptionListOptions\) \(res \*Response, sl \*PaymentList, err error\)](<#SubscriptionsService.GetPayments>)
-  - [func \(ss \*SubscriptionsService\) List\(ctx context.Context, cID string, opts \*SubscriptionListOptions\) \(res \*Response, sl \*SubscriptionList, err error\)](<#SubscriptionsService.List>)
-  - [func \(ss \*SubscriptionsService\) Update\(ctx context.Context, cID, sID string, sc \*Subscription\) \(res \*Response, s \*Subscription, err error\)](<#SubscriptionsService.Update>)
+  - [func \(ss \*SubscriptionsService\) All\(ctx context.Context, opts \*ListSubscriptionsOptions\) \(res \*Response, sl \*SubscriptionsList, err error\)](<#SubscriptionsService.All>)
+  - [func \(ss \*SubscriptionsService\) Cancel\(ctx context.Context, customer, subscription string\) \(res \*Response, s \*Subscription, err error\)](<#SubscriptionsService.Cancel>)
+  - [func \(ss \*SubscriptionsService\) Create\(ctx context.Context, customer string, sc CreateSubscription\) \(res \*Response, s \*Subscription, err error\)](<#SubscriptionsService.Create>)
+  - [func \(ss \*SubscriptionsService\) Get\(ctx context.Context, customer, subscription string\) \(res \*Response, s \*Subscription, err error\)](<#SubscriptionsService.Get>)
+  - [func \(ss \*SubscriptionsService\) List\(ctx context.Context, customer string, opts \*ListSubscriptionsOptions\) \(res \*Response, sl \*SubscriptionsList, err error\)](<#SubscriptionsService.List>)
+  - [func \(ss \*SubscriptionsService\) ListPayments\(ctx context.Context, customer, subscription string, opts \*ListSubscriptionsOptions\) \(res \*Response, sl \*PaymentList, err error\)](<#SubscriptionsService.ListPayments>)
+  - [func \(ss \*SubscriptionsService\) Update\(ctx context.Context, customer, subscription string, sc UpdateSubscription\) \(res \*Response, s \*Subscription, err error\)](<#SubscriptionsService.Update>)
 - [type Subtotal](<#Subtotal>)
 - [type Terminal](<#Terminal>)
 - [type TerminalList](<#TerminalList>)
@@ -378,6 +380,7 @@ REST also implies a nice and clean structure for URLs or endpoints. This means y
 - [type UpdateOrder](<#UpdateOrder>)
 - [type UpdateOrderLine](<#UpdateOrderLine>)
 - [type UpdatePayment](<#UpdatePayment>)
+- [type UpdateSubscription](<#UpdateSubscription>)
 - [type UsedGiftCard](<#UsedGiftCard>)
 - [type UserAgentToken](<#UserAgentToken>)
 - [type VoucherContractor](<#VoucherContractor>)
@@ -2109,6 +2112,26 @@ type CreateShipmentRequest struct {
 }
 ```
 
+<a name="CreateSubscription"></a>
+## type [CreateSubscription](<https://github.com/VictorAvelar/mollie-api-go/blob/master/mollie/subscriptions.go#L23-L34>)
+
+CreateSubscription contains the fields that are required to create a subscription.
+
+```go
+type CreateSubscription struct {
+    Times       int           `json:"times,omitempty"`
+    Interval    string        `json:"interval,omitempty"`
+    Description string        `json:"description,omitempty"`
+    MandateID   string        `json:"mandateId,omitempty"`
+    WebhookURL  string        `json:"webhookUrl,omitempty"`
+    Amount      *Amount       `json:"amount,omitempty"`
+    StartDate   *ShortDate    `json:"startDate,omitempty"`
+    Method      PaymentMethod `json:"method,omitempty"`
+    Metadata    any           `json:"metadata,omitempty"`
+    SubscriptionAccessTokenFields
+}
+```
+
 <a name="Customer"></a>
 ## type [Customer](<https://github.com/VictorAvelar/mollie-api-go/blob/master/mollie/customers.go#L37-L47>)
 
@@ -2762,6 +2785,20 @@ type ListSettlementsOptions struct {
 }
 ```
 
+<a name="ListSubscriptionsOptions"></a>
+## type [ListSubscriptionsOptions](<https://github.com/VictorAvelar/mollie-api-go/blob/master/mollie/subscriptions.go#L99-L104>)
+
+ListSubscriptionsOptions holds query string parameters valid for subscription lists.
+
+```go
+type ListSubscriptionsOptions struct {
+    Testmode  bool   `url:"testmode,omitempty"`
+    Limit     int    `url:"limit,omitempty"`
+    From      string `url:"from,omitempty"`
+    ProfileID string `url:"profileId,omitempty"`
+}
+```
+
 <a name="Locale"></a>
 ## type [Locale](<https://github.com/VictorAvelar/mollie-api-go/blob/master/mollie/common_types.go#L89>)
 
@@ -5484,37 +5521,49 @@ func (d *ShortDate) UnmarshalJSON(b []byte) error
 UnmarshalJSON overrides the default unmarshal action for the Date struct, as we need links to be pointers to the time.Time struct.
 
 <a name="Subscription"></a>
-## type [Subscription](<https://github.com/VictorAvelar/mollie-api-go/blob/master/mollie/subscriptions.go#L34-L55>)
+## type [Subscription](<https://github.com/VictorAvelar/mollie-api-go/blob/master/mollie/subscriptions.go#L67-L87>)
 
 Subscription contains information about a customer subscription.
 
 ```go
 type Subscription struct {
+    Times           int                `json:"times,omitempty"`
+    TimesRemaining  int                `json:"timesRemaining,omitempty"`
     Resource        string             `json:"resource,omitempty"`
     ID              string             `json:"id,omitempty"`
+    Interval        string             `json:"interval,omitempty"`
+    Description     string             `json:"description,omitempty"`
     MandateID       string             `json:"mandateId,omitempty"`
-    Mode            Mode               `json:"mode,omitempty"`
-    CreatedAT       *time.Time         `json:"createdAt,omitempty"`
-    Status          SubscriptionStatus `json:"status,omitempty"`
+    WebhookURL      string             `json:"webhookUrl,omitempty"`
     Amount          *Amount            `json:"amount,omitempty"`
-    Times           int                `json:"times,omitempty"`
-    TimesRemaining  int                `json:"timesRemaining,omitempty"`
-    Interval        string             `json:"interval,omitempty"`
+    ApplicationFee  *ApplicationFee    `json:"applicationFee,omitempty"`
     StartDate       *ShortDate         `json:"startDate,omitempty"`
     NextPaymentDate *ShortDate         `json:"nextPaymentDate,omitempty"`
-    Description     string             `json:"description,omitempty"`
-    Method          PaymentMethod      `json:"method,omitempty"`
+    CreatedAT       *time.Time         `json:"createdAt,omitempty"`
     CanceledAt      *time.Time         `json:"canceledAt,omitempty"`
-    WebhookURL      string             `json:"webhookUrl,omitempty"`
-    Metadata        interface{}        `json:"metadata,omitempty"`
-    ApplicationFee  *ApplicationFee    `json:"applicationFee,omitempty"`
-    TestMode        bool               `json:"testmode,omitempty"`
+    Mode            Mode               `json:"mode,omitempty"`
+    Status          SubscriptionStatus `json:"status,omitempty"`
+    Method          PaymentMethod      `json:"method,omitempty"`
+    Metadata        any                `json:"metadata,omitempty"`
     Links           SubscriptionLinks  `json:"_links,omitempty"`
 }
 ```
 
+<a name="SubscriptionAccessTokenFields"></a>
+## type [SubscriptionAccessTokenFields](<https://github.com/VictorAvelar/mollie-api-go/blob/master/mollie/subscriptions.go#L37-L41>)
+
+SubscriptionAccessTokenFields contains the fields that are available when using an access token.
+
+```go
+type SubscriptionAccessTokenFields struct {
+    Testmode       bool            `json:"testmode,omitempty"`
+    ProfileID      string          `json:"profileId,omitempty"`
+    ApplicationFee *ApplicationFee `json:"applicationFee,omitempty"`
+}
+```
+
 <a name="SubscriptionLinks"></a>
-## type [SubscriptionLinks](<https://github.com/VictorAvelar/mollie-api-go/blob/master/mollie/subscriptions.go#L26-L31>)
+## type [SubscriptionLinks](<https://github.com/VictorAvelar/mollie-api-go/blob/master/mollie/subscriptions.go#L58-L64>)
 
 SubscriptionLinks contains several URL objects relevant to the subscription.
 
@@ -5522,41 +5571,14 @@ SubscriptionLinks contains several URL objects relevant to the subscription.
 type SubscriptionLinks struct {
     Self          *URL `json:"self,omitempty"`
     Customer      *URL `json:"customer,omitempty"`
+    Profile       *URL `json:"profile,omitempty"`
     Payments      *URL `json:"payments,omitempty"`
     Documentation *URL `json:"documentation,omitempty"`
 }
 ```
 
-<a name="SubscriptionList"></a>
-## type [SubscriptionList](<https://github.com/VictorAvelar/mollie-api-go/blob/master/mollie/subscriptions.go#L58-L64>)
-
-SubscriptionList describes the response for subscription list endpoints.
-
-```go
-type SubscriptionList struct {
-    Count    int `json:"count,omitempty"`
-    Embedded struct {
-        Subscriptions []*Subscription
-    }   `json:"_embedded,omitempty"`
-    Links PaginationLinks `json:"_links,omitempty"`
-}
-```
-
-<a name="SubscriptionListOptions"></a>
-## type [SubscriptionListOptions](<https://github.com/VictorAvelar/mollie-api-go/blob/master/mollie/subscriptions.go#L67-L71>)
-
-SubscriptionListOptions holds query string parameters valid for subscription lists.
-
-```go
-type SubscriptionListOptions struct {
-    From      string `url:"from,omitempty"`
-    Limit     int    `url:"limit,omitempty"`
-    ProfileID string `url:"profileId,omitempty"`
-}
-```
-
 <a name="SubscriptionStatus"></a>
-## type [SubscriptionStatus](<https://github.com/VictorAvelar/mollie-api-go/blob/master/mollie/subscriptions.go#L14>)
+## type [SubscriptionStatus](<https://github.com/VictorAvelar/mollie-api-go/blob/master/mollie/subscriptions.go#L11>)
 
 SubscriptionStatus contains references to valid subscription statuses.
 
@@ -5576,8 +5598,23 @@ const (
 )
 ```
 
+<a name="SubscriptionsList"></a>
+## type [SubscriptionsList](<https://github.com/VictorAvelar/mollie-api-go/blob/master/mollie/subscriptions.go#L90-L96>)
+
+SubscriptionsList describes the response for subscription list endpoints.
+
+```go
+type SubscriptionsList struct {
+    Count    int `json:"count,omitempty"`
+    Embedded struct {
+        Subscriptions []*Subscription
+    }   `json:"_embedded,omitempty"`
+    Links PaginationLinks `json:"_links,omitempty"`
+}
+```
+
 <a name="SubscriptionsService"></a>
-## type [SubscriptionsService](<https://github.com/VictorAvelar/mollie-api-go/blob/master/mollie/subscriptions.go#L11>)
+## type [SubscriptionsService](<https://github.com/VictorAvelar/mollie-api-go/blob/master/mollie/subscriptions.go#L107>)
 
 SubscriptionsService operates over subscriptions resource.
 
@@ -5586,76 +5623,76 @@ type SubscriptionsService service
 ```
 
 <a name="SubscriptionsService.All"></a>
-### func \(\*SubscriptionsService\) [All](<https://github.com/VictorAvelar/mollie-api-go/blob/master/mollie/subscriptions.go#L166-L170>)
+### func \(\*SubscriptionsService\) [All](<https://github.com/VictorAvelar/mollie-api-go/blob/master/mollie/subscriptions.go#L206-L210>)
 
 ```go
-func (ss *SubscriptionsService) All(ctx context.Context, opts *SubscriptionListOptions) (res *Response, sl *SubscriptionList, err error)
+func (ss *SubscriptionsService) All(ctx context.Context, opts *ListSubscriptionsOptions) (res *Response, sl *SubscriptionsList, err error)
 ```
 
 All retrieves all subscriptions, ordered from newest to oldest. By using an API key all the subscriptions created with the current website profile will be returned. In the case of an OAuth Access Token relies the website profile on the profileId field
 
 See: https://docs.mollie.com/reference/v2/subscriptions-api/list-all-subscriptions
 
-<a name="SubscriptionsService.Create"></a>
-### func \(\*SubscriptionsService\) [Create](<https://github.com/VictorAvelar/mollie-api-go/blob/master/mollie/subscriptions.go#L94-L98>)
+<a name="SubscriptionsService.Cancel"></a>
+### func \(\*SubscriptionsService\) [Cancel](<https://github.com/VictorAvelar/mollie-api-go/blob/master/mollie/subscriptions.go#L182-L186>)
 
 ```go
-func (ss *SubscriptionsService) Create(ctx context.Context, cID string, sc *Subscription) (res *Response, s *Subscription, err error)
+func (ss *SubscriptionsService) Cancel(ctx context.Context, customer, subscription string) (res *Response, s *Subscription, err error)
 ```
 
-Create stores a new subscription for a given customer
+Cancel cancels a subscription.
 
-See: https://docs.mollie.com/reference/v2/subscriptions-api/create-subscription
+See: https://docs.mollie.com/reference/v2/subscriptions-api/cancel-subscription
 
-<a name="SubscriptionsService.Delete"></a>
-### func \(\*SubscriptionsService\) [Delete](<https://github.com/VictorAvelar/mollie-api-go/blob/master/mollie/subscriptions.go#L142-L146>)
+<a name="SubscriptionsService.Create"></a>
+### func \(\*SubscriptionsService\) [Create](<https://github.com/VictorAvelar/mollie-api-go/blob/master/mollie/subscriptions.go#L134-L138>)
 
 ```go
-func (ss *SubscriptionsService) Delete(ctx context.Context, cID, sID string) (res *Response, s *Subscription, err error)
+func (ss *SubscriptionsService) Create(ctx context.Context, customer string, sc CreateSubscription) (res *Response, s *Subscription, err error)
 ```
 
-Delete cancels a subscription
+Create stores a new subscription for a given customer
 
-See: https://docs.mollie.com/reference/v2/subscriptions-api/cancel-subscription
+See: https://docs.mollie.com/reference/v2/subscriptions-api/create-subscription
 
 <a name="SubscriptionsService.Get"></a>
-### func \(\*SubscriptionsService\) [Get](<https://github.com/VictorAvelar/mollie-api-go/blob/master/mollie/subscriptions.go#L76>)
+### func \(\*SubscriptionsService\) [Get](<https://github.com/VictorAvelar/mollie-api-go/blob/master/mollie/subscriptions.go#L112-L116>)
 
 ```go
-func (ss *SubscriptionsService) Get(ctx context.Context, cID, sID string) (res *Response, s *Subscription, err error)
+func (ss *SubscriptionsService) Get(ctx context.Context, customer, subscription string) (res *Response, s *Subscription, err error)
 ```
 
 Get retrieves a customer's subscription
 
 See: https://docs.mollie.com/reference/v2/subscriptions-api/get-subscription
 
-<a name="SubscriptionsService.GetPayments"></a>
-### func \(\*SubscriptionsService\) [GetPayments](<https://github.com/VictorAvelar/mollie-api-go/blob/master/mollie/subscriptions.go#L210-L214>)
+<a name="SubscriptionsService.List"></a>
+### func \(\*SubscriptionsService\) [List](<https://github.com/VictorAvelar/mollie-api-go/blob/master/mollie/subscriptions.go#L228-L232>)
 
 ```go
-func (ss *SubscriptionsService) GetPayments(ctx context.Context, cID, sID string, opts *SubscriptionListOptions) (res *Response, sl *PaymentList, err error)
+func (ss *SubscriptionsService) List(ctx context.Context, customer string, opts *ListSubscriptionsOptions) (res *Response, sl *SubscriptionsList, err error)
 ```
 
-GetPayments retrieves all payments of a specific subscriptions of a customer
+List retrieves all subscriptions of a customer
 
-See: https://docs.mollie.com/reference/v2/subscriptions-api/list-subscriptions-payments
+See: https://docs.mollie.com/reference/v2/subscriptions-api/list-subscriptions
 
-<a name="SubscriptionsService.List"></a>
-### func \(\*SubscriptionsService\) [List](<https://github.com/VictorAvelar/mollie-api-go/blob/master/mollie/subscriptions.go#L188-L192>)
+<a name="SubscriptionsService.ListPayments"></a>
+### func \(\*SubscriptionsService\) [ListPayments](<https://github.com/VictorAvelar/mollie-api-go/blob/master/mollie/subscriptions.go#L250-L258>)
 
 ```go
-func (ss *SubscriptionsService) List(ctx context.Context, cID string, opts *SubscriptionListOptions) (res *Response, sl *SubscriptionList, err error)
+func (ss *SubscriptionsService) ListPayments(ctx context.Context, customer, subscription string, opts *ListSubscriptionsOptions) (res *Response, sl *PaymentList, err error)
 ```
 
-List retrieves all subscriptions of a customer
+ListPayments retrieves all payments of a specific subscriptions of a customer
 
-See: https://docs.mollie.com/reference/v2/subscriptions-api/list-subscriptions
+See: https://docs.mollie.com/reference/v2/subscriptions-api/list-subscriptions-payments
 
 <a name="SubscriptionsService.Update"></a>
-### func \(\*SubscriptionsService\) [Update](<https://github.com/VictorAvelar/mollie-api-go/blob/master/mollie/subscriptions.go#L120-L124>)
+### func \(\*SubscriptionsService\) [Update](<https://github.com/VictorAvelar/mollie-api-go/blob/master/mollie/subscriptions.go#L160-L164>)
 
 ```go
-func (ss *SubscriptionsService) Update(ctx context.Context, cID, sID string, sc *Subscription) (res *Response, s *Subscription, err error)
+func (ss *SubscriptionsService) Update(ctx context.Context, customer, subscription string, sc UpdateSubscription) (res *Response, s *Subscription, err error)
 ```
 
 Update changes fields on a subscription object
@@ -5937,6 +5974,26 @@ type UpdatePayment struct {
 }
 ```
 
+<a name="UpdateSubscription"></a>
+## type [UpdateSubscription](<https://github.com/VictorAvelar/mollie-api-go/blob/master/mollie/subscriptions.go#L44-L55>)
+
+UpdateSubscription contains the fields that are required to create a subscription.
+
+```go
+type UpdateSubscription struct {
+    Times       int           `json:"times,omitempty"`
+    Interval    string        `json:"interval,omitempty"`
+    Description string        `json:"description,omitempty"`
+    MandateID   string        `json:"mandateId,omitempty"`
+    WebhookURL  string        `json:"webhookUrl,omitempty"`
+    Amount      *Amount       `json:"amount,omitempty"`
+    StartDate   *ShortDate    `json:"startDate,omitempty"`
+    Method      PaymentMethod `json:"method,omitempty"`
+    Metadata    any           `json:"metadata,omitempty"`
+    SubscriptionAccessTokenFields
+}
+```
+
 <a name="UsedGiftCard"></a>
 ## type [UsedGiftCard](<https://github.com/VictorAvelar/mollie-api-go/blob/master/mollie/payment_details.go#L49-L53>)
 
diff --git a/mollie/subscriptions.go b/mollie/subscriptions.go
index bf7e0c8..afe9202 100644
--- a/mollie/subscriptions.go
+++ b/mollie/subscriptions.go
@@ -7,9 +7,6 @@ import (
 	"time"
 )
 
-// SubscriptionsService operates over subscriptions resource.
-type SubscriptionsService service
-
 // SubscriptionStatus contains references to valid subscription statuses.
 type SubscriptionStatus string
 
@@ -22,40 +19,75 @@ const (
 	SubscriptionStatusCompleted SubscriptionStatus = "completed"
 )
 
+// CreateSubscription contains the fields that are required to create a subscription.
+type CreateSubscription struct {
+	Times       int           `json:"times,omitempty"`
+	Interval    string        `json:"interval,omitempty"`
+	Description string        `json:"description,omitempty"`
+	MandateID   string        `json:"mandateId,omitempty"`
+	WebhookURL  string        `json:"webhookUrl,omitempty"`
+	Amount      *Amount       `json:"amount,omitempty"`
+	StartDate   *ShortDate    `json:"startDate,omitempty"`
+	Method      PaymentMethod `json:"method,omitempty"`
+	Metadata    any           `json:"metadata,omitempty"`
+	SubscriptionAccessTokenFields
+}
+
+// SubscriptionAccessTokenFields contains the fields that are available when using an access token.
+type SubscriptionAccessTokenFields struct {
+	Testmode       bool            `json:"testmode,omitempty"`
+	ProfileID      string          `json:"profileId,omitempty"`
+	ApplicationFee *ApplicationFee `json:"applicationFee,omitempty"`
+}
+
+// UpdateSubscription contains the fields that are required to create a subscription.
+type UpdateSubscription struct {
+	Times       int           `json:"times,omitempty"`
+	Interval    string        `json:"interval,omitempty"`
+	Description string        `json:"description,omitempty"`
+	MandateID   string        `json:"mandateId,omitempty"`
+	WebhookURL  string        `json:"webhookUrl,omitempty"`
+	Amount      *Amount       `json:"amount,omitempty"`
+	StartDate   *ShortDate    `json:"startDate,omitempty"`
+	Method      PaymentMethod `json:"method,omitempty"`
+	Metadata    any           `json:"metadata,omitempty"`
+	SubscriptionAccessTokenFields
+}
+
 // SubscriptionLinks contains several URL objects relevant to the subscription.
 type SubscriptionLinks struct {
 	Self          *URL `json:"self,omitempty"`
 	Customer      *URL `json:"customer,omitempty"`
+	Profile       *URL `json:"profile,omitempty"`
 	Payments      *URL `json:"payments,omitempty"`
 	Documentation *URL `json:"documentation,omitempty"`
 }
 
 // Subscription contains information about a customer subscription.
 type Subscription struct {
+	Times           int                `json:"times,omitempty"`
+	TimesRemaining  int                `json:"timesRemaining,omitempty"`
 	Resource        string             `json:"resource,omitempty"`
 	ID              string             `json:"id,omitempty"`
+	Interval        string             `json:"interval,omitempty"`
+	Description     string             `json:"description,omitempty"`
 	MandateID       string             `json:"mandateId,omitempty"`
-	Mode            Mode               `json:"mode,omitempty"`
-	CreatedAT       *time.Time         `json:"createdAt,omitempty"`
-	Status          SubscriptionStatus `json:"status,omitempty"`
+	WebhookURL      string             `json:"webhookUrl,omitempty"`
 	Amount          *Amount            `json:"amount,omitempty"`
-	Times           int                `json:"times,omitempty"`
-	TimesRemaining  int                `json:"timesRemaining,omitempty"`
-	Interval        string             `json:"interval,omitempty"`
+	ApplicationFee  *ApplicationFee    `json:"applicationFee,omitempty"`
 	StartDate       *ShortDate         `json:"startDate,omitempty"`
 	NextPaymentDate *ShortDate         `json:"nextPaymentDate,omitempty"`
-	Description     string             `json:"description,omitempty"`
-	Method          PaymentMethod      `json:"method,omitempty"`
+	CreatedAT       *time.Time         `json:"createdAt,omitempty"`
 	CanceledAt      *time.Time         `json:"canceledAt,omitempty"`
-	WebhookURL      string             `json:"webhookUrl,omitempty"`
-	Metadata        interface{}        `json:"metadata,omitempty"`
-	ApplicationFee  *ApplicationFee    `json:"applicationFee,omitempty"`
-	TestMode        bool               `json:"testmode,omitempty"`
+	Mode            Mode               `json:"mode,omitempty"`
+	Status          SubscriptionStatus `json:"status,omitempty"`
+	Method          PaymentMethod      `json:"method,omitempty"`
+	Metadata        any                `json:"metadata,omitempty"`
 	Links           SubscriptionLinks  `json:"_links,omitempty"`
 }
 
-// SubscriptionList describes the response for subscription list endpoints.
-type SubscriptionList struct {
+// SubscriptionsList describes the response for subscription list endpoints.
+type SubscriptionsList struct {
 	Count    int `json:"count,omitempty"`
 	Embedded struct {
 		Subscriptions []*Subscription
@@ -63,18 +95,26 @@ type SubscriptionList struct {
 	Links PaginationLinks `json:"_links,omitempty"`
 }
 
-// SubscriptionListOptions holds query string parameters valid for subscription lists.
-type SubscriptionListOptions struct {
-	From      string `url:"from,omitempty"`
+// ListSubscriptionsOptions holds query string parameters valid for subscription lists.
+type ListSubscriptionsOptions struct {
+	Testmode  bool   `url:"testmode,omitempty"`
 	Limit     int    `url:"limit,omitempty"`
+	From      string `url:"from,omitempty"`
 	ProfileID string `url:"profileId,omitempty"`
 }
 
+// SubscriptionsService operates over subscriptions resource.
+type SubscriptionsService service
+
 // Get retrieves a customer's subscription
 //
 // See: https://docs.mollie.com/reference/v2/subscriptions-api/get-subscription
-func (ss *SubscriptionsService) Get(ctx context.Context, cID, sID string) (res *Response, s *Subscription, err error) {
-	u := fmt.Sprintf("v2/customers/%s/subscriptions/%s", cID, sID)
+func (ss *SubscriptionsService) Get(ctx context.Context, customer, subscription string) (
+	res *Response,
+	s *Subscription,
+	err error,
+) {
+	u := fmt.Sprintf("v2/customers/%s/subscriptions/%s", customer, subscription)
 
 	res, err = ss.client.get(ctx, u, nil)
 	if err != nil {
@@ -91,15 +131,15 @@ func (ss *SubscriptionsService) Get(ctx context.Context, cID, sID string) (res *
 // Create stores a new subscription for a given customer
 //
 // See: https://docs.mollie.com/reference/v2/subscriptions-api/create-subscription
-func (ss *SubscriptionsService) Create(ctx context.Context, cID string, sc *Subscription) (
+func (ss *SubscriptionsService) Create(ctx context.Context, customer string, sc CreateSubscription) (
 	res *Response,
 	s *Subscription,
 	err error,
 ) {
-	uri := fmt.Sprintf("v2/customers/%s/subscriptions", cID)
+	uri := fmt.Sprintf("v2/customers/%s/subscriptions", customer)
 
 	if ss.client.HasAccessToken() && ss.client.config.testing {
-		sc.TestMode = true
+		sc.Testmode = true
 	}
 
 	res, err = ss.client.post(ctx, uri, sc, nil)
@@ -117,12 +157,12 @@ func (ss *SubscriptionsService) Create(ctx context.Context, cID string, sc *Subs
 // Update changes fields on a subscription object
 //
 // See: https://docs.mollie.com/reference/v2/subscriptions-api/update-subscription
-func (ss *SubscriptionsService) Update(ctx context.Context, cID, sID string, sc *Subscription) (
+func (ss *SubscriptionsService) Update(ctx context.Context, customer, subscription string, sc UpdateSubscription) (
 	res *Response,
 	s *Subscription,
 	err error,
 ) {
-	u := fmt.Sprintf("v2/customers/%s/subscriptions/%s", cID, sID)
+	u := fmt.Sprintf("v2/customers/%s/subscriptions/%s", customer, subscription)
 
 	res, err = ss.client.patch(ctx, u, sc, nil)
 	if err != nil {
@@ -136,15 +176,15 @@ func (ss *SubscriptionsService) Update(ctx context.Context, cID, sID string, sc
 	return
 }
 
-// Delete cancels a subscription
+// Cancel cancels a subscription.
 //
 // See: https://docs.mollie.com/reference/v2/subscriptions-api/cancel-subscription
-func (ss *SubscriptionsService) Delete(ctx context.Context, cID, sID string) (
+func (ss *SubscriptionsService) Cancel(ctx context.Context, customer, subscription string) (
 	res *Response,
 	s *Subscription,
 	err error,
 ) {
-	u := fmt.Sprintf("v2/customers/%s/subscriptions/%s", cID, sID)
+	u := fmt.Sprintf("v2/customers/%s/subscriptions/%s", customer, subscription)
 
 	res, err = ss.client.delete(ctx, u, nil)
 	if err != nil {
@@ -163,9 +203,9 @@ func (ss *SubscriptionsService) Delete(ctx context.Context, cID, sID string) (
 // In the case of an OAuth Access Token relies the website profile on the profileId field
 //
 // See: https://docs.mollie.com/reference/v2/subscriptions-api/list-all-subscriptions
-func (ss *SubscriptionsService) All(ctx context.Context, opts *SubscriptionListOptions) (
+func (ss *SubscriptionsService) All(ctx context.Context, opts *ListSubscriptionsOptions) (
 	res *Response,
-	sl *SubscriptionList,
+	sl *SubscriptionsList,
 	err error,
 ) {
 	u := "v2/subscriptions"
@@ -185,12 +225,12 @@ func (ss *SubscriptionsService) All(ctx context.Context, opts *SubscriptionListO
 // List retrieves all subscriptions of a customer
 //
 // See: https://docs.mollie.com/reference/v2/subscriptions-api/list-subscriptions
-func (ss *SubscriptionsService) List(ctx context.Context, cID string, opts *SubscriptionListOptions) (
+func (ss *SubscriptionsService) List(ctx context.Context, customer string, opts *ListSubscriptionsOptions) (
 	res *Response,
-	sl *SubscriptionList,
+	sl *SubscriptionsList,
 	err error,
 ) {
-	u := fmt.Sprintf("v2/customers/%s/subscriptions", cID)
+	u := fmt.Sprintf("v2/customers/%s/subscriptions", customer)
 
 	res, err = ss.list(ctx, u, opts)
 	if err != nil {
@@ -204,15 +244,19 @@ func (ss *SubscriptionsService) List(ctx context.Context, cID string, opts *Subs
 	return
 }
 
-// GetPayments retrieves all payments of a specific subscriptions of a customer
+// ListPayments retrieves all payments of a specific subscriptions of a customer
 //
 // See: https://docs.mollie.com/reference/v2/subscriptions-api/list-subscriptions-payments
-func (ss *SubscriptionsService) GetPayments(ctx context.Context, cID, sID string, opts *SubscriptionListOptions) (
+func (ss *SubscriptionsService) ListPayments(
+	ctx context.Context,
+	customer, subscription string,
+	opts *ListSubscriptionsOptions,
+) (
 	res *Response,
 	sl *PaymentList,
 	err error,
 ) {
-	u := fmt.Sprintf("v2/customers/%s/subscriptions/%s/payments", cID, sID)
+	u := fmt.Sprintf("v2/customers/%s/subscriptions/%s/payments", customer, subscription)
 
 	res, err = ss.list(ctx, u, opts)
 	if err != nil {


Test patch:
diff --git a/mollie/subscriptions_test.go b/mollie/subscriptions_test.go
index a44bfd6..9c5491c 100644
--- a/mollie/subscriptions_test.go
+++ b/mollie/subscriptions_test.go
@@ -113,7 +113,7 @@ func TestSubscriptionsService_Create(t *testing.T) {
 	type args struct {
 		ctx          context.Context
 		customer     string
-		subscription *Subscription
+		subscription CreateSubscription
 	}
 	cases := []struct {
 		name    string
@@ -128,7 +128,7 @@ func TestSubscriptionsService_Create(t *testing.T) {
 			args{
 				context.Background(),
 				"cst_stTC2WHAuS",
-				&Subscription{
+				CreateSubscription{
 					Amount: &Amount{
 						Currency: "EUR",
 						Value:    "100.00",
@@ -154,7 +154,7 @@ func TestSubscriptionsService_Create(t *testing.T) {
 			args{
 				context.Background(),
 				"cst_stTC2WHAuS",
-				&Subscription{
+				CreateSubscription{
 					Amount: &Amount{
 						Currency: "EUR",
 						Value:    "100.00",
@@ -181,7 +181,7 @@ func TestSubscriptionsService_Create(t *testing.T) {
 			args{
 				context.Background(),
 				"cst_stTC2WHAuS",
-				&Subscription{
+				CreateSubscription{
 					Amount: &Amount{
 						Currency: "EUR",
 						Value:    "100.00",
@@ -199,7 +199,7 @@ func TestSubscriptionsService_Create(t *testing.T) {
 			args{
 				context.Background(),
 				"cst_stTC2WHAuS",
-				&Subscription{
+				CreateSubscription{
 					Amount: &Amount{
 						Currency: "EUR",
 						Value:    "100.00",
@@ -217,7 +217,7 @@ func TestSubscriptionsService_Create(t *testing.T) {
 			args{
 				context.Background(),
 				"cst_stTC2WHAuS",
-				&Subscription{
+				CreateSubscription{
 					Amount: &Amount{
 						Currency: "EUR",
 						Value:    "100.00",
@@ -261,7 +261,7 @@ func TestSubscriptionsService_Update(t *testing.T) {
 		ctx          context.Context
 		customer     string
 		sid          string
-		subscription *Subscription
+		subscription UpdateSubscription
 	}
 	cases := []struct {
 		name    string
@@ -277,7 +277,7 @@ func TestSubscriptionsService_Update(t *testing.T) {
 				context.Background(),
 				"cst_stTC2WHAuS",
 				"sub_rVKGtNd6s3",
-				&Subscription{
+				UpdateSubscription{
 					Amount: &Amount{
 						Currency: "EUR",
 						Value:    "100.00",
@@ -304,7 +304,7 @@ func TestSubscriptionsService_Update(t *testing.T) {
 				context.Background(),
 				"cst_stTC2WHAuS",
 				"sub_rVKGtNd6s3",
-				&Subscription{
+				UpdateSubscription{
 					Amount: &Amount{
 						Currency: "EUR",
 						Value:    "100.00",
@@ -332,7 +332,7 @@ func TestSubscriptionsService_Update(t *testing.T) {
 				context.Background(),
 				"cst_stTC2WHAuS",
 				"sub_rVKGtNd6s3",
-				&Subscription{
+				UpdateSubscription{
 					Amount: &Amount{
 						Currency: "EUR",
 						Value:    "100.00",
@@ -351,7 +351,7 @@ func TestSubscriptionsService_Update(t *testing.T) {
 				context.Background(),
 				"cst_stTC2WHAuS",
 				"sub_rVKGtNd6s3",
-				&Subscription{
+				UpdateSubscription{
 					Amount: &Amount{
 						Currency: "EUR",
 						Value:    "100.00",
@@ -370,7 +370,7 @@ func TestSubscriptionsService_Update(t *testing.T) {
 				context.Background(),
 				"cst_stTC2WHAuS",
 				"sub_rVKGtNd6s3",
-				&Subscription{
+				UpdateSubscription{
 					Amount: &Amount{
 						Currency: "EUR",
 						Value:    "100.00",
@@ -406,7 +406,7 @@ func TestSubscriptionsService_Update(t *testing.T) {
 	}
 }
 
-func TestSubscriptionsService_Delete(t *testing.T) {
+func TestSubscriptionsService_Cancel(t *testing.T) {
 	setEnv()
 	defer unsetEnv()
 
@@ -510,7 +510,7 @@ func TestSubscriptionsService_Delete(t *testing.T) {
 			c.pre()
 			tMux.HandleFunc(fmt.Sprintf("/v2/customers/%s/subscriptions/%s", c.args.customer, c.args.sid), c.handler)
 
-			res, m, err := tClient.Subscriptions.Delete(c.args.ctx, c.args.customer, c.args.sid)
+			res, m, err := tClient.Subscriptions.Cancel(c.args.ctx, c.args.customer, c.args.sid)
 			if c.wantErr {
 				assert.NotNil(t, err)
 				assert.EqualError(t, err, c.err.Error())
@@ -530,7 +530,7 @@ func TestSubscriptionsService_List(t *testing.T) {
 	type args struct {
 		ctx      context.Context
 		customer string
-		options  *SubscriptionListOptions
+		options  *ListSubscriptionsOptions
 	}
 	cases := []struct {
 		name    string
@@ -565,7 +565,7 @@ func TestSubscriptionsService_List(t *testing.T) {
 			args{
 				context.Background(),
 				"cst_stTC2WHAuS",
-				&SubscriptionListOptions{
+				&ListSubscriptionsOptions{
 					Limit: 10,
 				},
 			},
@@ -635,7 +635,7 @@ func TestSubscriptionsService_List(t *testing.T) {
 				assert.EqualError(t, err, c.err.Error())
 			} else {
 				assert.Nil(t, err)
-				assert.IsType(t, &SubscriptionList{}, m)
+				assert.IsType(t, &SubscriptionsList{}, m)
 				assert.IsType(t, &http.Response{}, res.Response)
 			}
 		})
@@ -648,7 +648,7 @@ func TestSubscriptionsService_All(t *testing.T) {
 
 	type args struct {
 		ctx     context.Context
-		options *SubscriptionListOptions
+		options *ListSubscriptionsOptions
 	}
 	cases := []struct {
 		name    string
@@ -681,7 +681,7 @@ func TestSubscriptionsService_All(t *testing.T) {
 			"list subscriptions with options works as expected.",
 			args{
 				context.Background(),
-				&SubscriptionListOptions{
+				&ListSubscriptionsOptions{
 					Limit: 10,
 				},
 			},
@@ -748,7 +748,7 @@ func TestSubscriptionsService_All(t *testing.T) {
 				assert.EqualError(t, err, c.err.Error())
 			} else {
 				assert.Nil(t, err)
-				assert.IsType(t, &SubscriptionList{}, m)
+				assert.IsType(t, &SubscriptionsList{}, m)
 				assert.IsType(t, &http.Response{}, res.Response)
 			}
 		})
@@ -763,7 +763,7 @@ func TestSubscriptionsService_GetPayments(t *testing.T) {
 		ctx          context.Context
 		customer     string
 		subscription string
-		options      *SubscriptionListOptions
+		options      *ListSubscriptionsOptions
 	}
 	cases := []struct {
 		name    string
@@ -800,7 +800,7 @@ func TestSubscriptionsService_GetPayments(t *testing.T) {
 				context.Background(),
 				"cst_stTC2WHAuS",
 				"sub_rVKGtNd6s3",
-				&SubscriptionListOptions{
+				&ListSubscriptionsOptions{
 					Limit: 10,
 				},
 			},
@@ -867,7 +867,7 @@ func TestSubscriptionsService_GetPayments(t *testing.T) {
 			c.pre()
 			tMux.HandleFunc(fmt.Sprintf("/v2/customers/%s/subscriptions/%s/payments", c.args.customer, c.args.subscription), c.handler)
 
-			res, m, err := tClient.Subscriptions.GetPayments(c.args.ctx, c.args.customer, c.args.subscription, c.args.options)
+			res, m, err := tClient.Subscriptions.ListPayments(c.args.ctx, c.args.customer, c.args.subscription, c.args.options)
 			if c.wantErr {
 				assert.NotNil(t, err)
 				assert.EqualError(t, err, c.err.Error())