forked from go-packages/paypal
Add Revise Subscription (#187)
* Add function revise subscription * Update README add revise subscription
This commit is contained in:
parent
98cae62470
commit
0f9d1cca16
|
@ -70,6 +70,7 @@
|
|||
* GET /v1/billing/subscriptions/**ID**
|
||||
* POST /v1/billing/subscriptions/**ID**/activate
|
||||
* POST /v1/billing/subscriptions/**ID**/cancel
|
||||
* POST /v1/billing/subscriptions/**ID**/revise
|
||||
* POST /v1/billing/subscriptions/**ID**/capture
|
||||
* POST /v1/billing/subscriptions/**ID**/suspend
|
||||
* GET /v1/billing/subscriptions/**ID**/transactions
|
||||
|
|
|
@ -10,6 +10,7 @@ type (
|
|||
SubscriptionBase struct {
|
||||
PlanID string `json:"plan_id"`
|
||||
StartTime *JSONTime `json:"start_time,omitempty"`
|
||||
EffectiveTime *JSONTime `json:"effective_time,omitempty"`
|
||||
Quantity string `json:"quantity,omitempty"`
|
||||
ShippingAmount *Money `json:"shipping_amount,omitempty"`
|
||||
Subscriber *Subscriber `json:"subscriber,omitempty"`
|
||||
|
@ -186,3 +187,19 @@ func (c *Client) GetSubscriptionTransactions(requestParams SubscriptionTransacti
|
|||
err = c.SendWithAuth(req, response)
|
||||
return response, err
|
||||
}
|
||||
|
||||
// Revise plan or quantity of subscription
|
||||
// Doc: https://developer.paypal.com/docs/api/subscriptions/v1/#subscriptions_revise
|
||||
// Endpoint: POST /v1/billing/subscriptions/{id}/revise
|
||||
func (c *Client) ReviseSubscription(subscriptionId string, reviseSubscription SubscriptionBase) (*SubscriptionDetailResp, error) {
|
||||
req, err := c.NewRequest(http.MethodPost, fmt.Sprintf("%s/v1/billing/subscriptions/%s/revise", c.APIBase, subscriptionId), reviseSubscription)
|
||||
response := &SubscriptionDetailResp{}
|
||||
if err != nil {
|
||||
return response, err
|
||||
}
|
||||
|
||||
req.Header.Add("Content-Type", "application/json")
|
||||
err = c.SendWithAuth(req, response)
|
||||
|
||||
return response, err
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user