mirror of
https://github.com/plutov/paypal.git
synced 2025-01-23 18:31:03 +01:00
add DeletePlan()
This commit is contained in:
parent
b0bf27bc89
commit
b5d8cdd3e1
13
billing.go
13
billing.go
|
@ -73,6 +73,19 @@ func (c *Client) CreateBillingAgreement(a BillingAgreement) (*CreateAgreementRes
|
|||
return response, err
|
||||
}
|
||||
|
||||
// DeletePlan deletes a billing plan
|
||||
// Endpoint: PATCH /v1/payments/billing-plans/
|
||||
func (c *Client) DeletePlan(planID string) error {
|
||||
buf := bytes.NewBuffer([]byte("[{\"op\":\"replace\",\"path\":\"/\",\"value\":{\"state\":\"DELETED\"}}]"))
|
||||
req, err := http.NewRequest("PATCH", fmt.Sprintf("%s%s", c.APIBase, "/v1/payments/billing-plans/"+planID), buf)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
req.SetBasicAuth(c.ClientID, c.Secret)
|
||||
req.Header.Set("Authorization", "Bearer "+c.Token.Token)
|
||||
return c.SendWithAuth(req, nil)
|
||||
}
|
||||
|
||||
// ExecuteApprovedAgreement - Use this call to execute (complete) a PayPal agreement that has been approved by the payer.
|
||||
// Endpoint: POST /v1/payments/billing-agreements/token/agreement-execute
|
||||
func (c *Client) ExecuteApprovedAgreement(token string) (*ExecuteAgreementResponse, error) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user