mirror of
https://github.com/plutov/paypal.git
synced 2025-01-23 10:21:03 +01:00
#33 Send only Plan ID when create agreement
This commit is contained in:
parent
f48535a92e
commit
b12ee60c90
|
@ -42,7 +42,7 @@ func (c *Client) CreateBillingPlan(plan BillingPlan) (*CreateBillingResp, error)
|
||||||
return response, err
|
return response, err
|
||||||
}
|
}
|
||||||
|
|
||||||
// Activates a billing plan
|
// ActivatePlan activates a billing plan
|
||||||
// By default, a new plan is not activated
|
// By default, a new plan is not activated
|
||||||
// Endpoint: PATCH /v1/payments/billing-plans/
|
// Endpoint: PATCH /v1/payments/billing-plans/
|
||||||
func (c *Client) ActivatePlan(planID string) error {
|
func (c *Client) ActivatePlan(planID string) error {
|
||||||
|
@ -56,9 +56,14 @@ func (c *Client) ActivatePlan(planID string) error {
|
||||||
return c.SendWithAuth(req, nil)
|
return c.SendWithAuth(req, nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Creates an agreement for specified plan
|
// CreateBillingAgreement creates an agreement for specified plan
|
||||||
// Endpoint: POST /v1/payments/billing-agreements
|
// Endpoint: POST /v1/payments/billing-agreements
|
||||||
func (c *Client) CreateBillingAgreement(a BillingAgreement) (*CreateAgreementResp, error) {
|
func (c *Client) CreateBillingAgreement(a BillingAgreement) (*CreateAgreementResp, error) {
|
||||||
|
// PayPal needs only ID, so we will remove all fields except Plan ID
|
||||||
|
a.Plan = BillingPlan{
|
||||||
|
ID: a.Plan.ID,
|
||||||
|
}
|
||||||
|
|
||||||
req, err := c.NewRequest("POST", fmt.Sprintf("%s%s", c.APIBase, "/v1/payments/billing-agreements"), a)
|
req, err := c.NewRequest("POST", fmt.Sprintf("%s%s", c.APIBase, "/v1/payments/billing-agreements"), a)
|
||||||
response := &CreateAgreementResp{}
|
response := &CreateAgreementResp{}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user