From a0d03ecb0d1751e98a5761e67aadcfa505ae732a Mon Sep 17 00:00:00 2001 From: Rami Date: Mon, 1 Jun 2020 20:02:18 +0200 Subject: [PATCH] Fixes response from CreateSubscription (#155) --- subscription.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/subscription.go b/subscription.go index b420dce..9af205c 100644 --- a/subscription.go +++ b/subscription.go @@ -33,6 +33,7 @@ type ( SubscriptionBase SubscriptionDetails BillingInfo BillingInfo `json:"billing_info,omitempty"` // not found in documentation + SharedResponse } SubscriptionCaptureResponse struct { @@ -85,9 +86,10 @@ func (self *Subscription) GetUpdatePatch() []Patch { // CreateSubscriptionPlan creates a subscriptionPlan // Doc: https://developer.paypal.com/docs/api/subscriptions/v1/#subscriptions_create // Endpoint: POST /v1/billing/subscriptions -func (c *Client) CreateSubscription(newSubscription SubscriptionBase) (*Subscription, error) { +func (c *Client) CreateSubscription(newSubscription SubscriptionBase) (*SubscriptionDetailResp, error) { req, err := c.NewRequest(http.MethodPost, fmt.Sprintf("%s%s", c.APIBase, "/v1/billing/subscriptions"), newSubscription) - response := &Subscription{} + req.Header.Add("Prefer", "return=representation") + response := &SubscriptionDetailResp{} if err != nil { return response, err }