mirror of
https://github.com/plutov/paypal.git
synced 2025-01-23 02:11:02 +01:00
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**
|
* GET /v1/billing/subscriptions/**ID**
|
||||||
* POST /v1/billing/subscriptions/**ID**/activate
|
* POST /v1/billing/subscriptions/**ID**/activate
|
||||||
* POST /v1/billing/subscriptions/**ID**/cancel
|
* POST /v1/billing/subscriptions/**ID**/cancel
|
||||||
|
* POST /v1/billing/subscriptions/**ID**/revise
|
||||||
* POST /v1/billing/subscriptions/**ID**/capture
|
* POST /v1/billing/subscriptions/**ID**/capture
|
||||||
* POST /v1/billing/subscriptions/**ID**/suspend
|
* POST /v1/billing/subscriptions/**ID**/suspend
|
||||||
* GET /v1/billing/subscriptions/**ID**/transactions
|
* GET /v1/billing/subscriptions/**ID**/transactions
|
||||||
|
|
|
@ -10,6 +10,7 @@ type (
|
||||||
SubscriptionBase struct {
|
SubscriptionBase struct {
|
||||||
PlanID string `json:"plan_id"`
|
PlanID string `json:"plan_id"`
|
||||||
StartTime *JSONTime `json:"start_time,omitempty"`
|
StartTime *JSONTime `json:"start_time,omitempty"`
|
||||||
|
EffectiveTime *JSONTime `json:"effective_time,omitempty"`
|
||||||
Quantity string `json:"quantity,omitempty"`
|
Quantity string `json:"quantity,omitempty"`
|
||||||
ShippingAmount *Money `json:"shipping_amount,omitempty"`
|
ShippingAmount *Money `json:"shipping_amount,omitempty"`
|
||||||
Subscriber *Subscriber `json:"subscriber,omitempty"`
|
Subscriber *Subscriber `json:"subscriber,omitempty"`
|
||||||
|
@ -186,3 +187,19 @@ func (c *Client) GetSubscriptionTransactions(requestParams SubscriptionTransacti
|
||||||
err = c.SendWithAuth(req, response)
|
err = c.SendWithAuth(req, response)
|
||||||
return response, err
|
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