mirror of
https://github.com/plutov/paypal.git
synced 2025-01-23 02:11:02 +01:00
CreateBillingPlan definition
This commit is contained in:
parent
f12db62995
commit
e033a62fe2
36
billing.go
36
billing.go
|
@ -1,3 +1,37 @@
|
|||
package paypalsdk
|
||||
|
||||
import ()
|
||||
import (
|
||||
"fmt"
|
||||
"time"
|
||||
)
|
||||
|
||||
type (
|
||||
// CreateBillingResp struct
|
||||
CreateBillingResp struct {
|
||||
ID string `json:"id,omitempty"`
|
||||
State string `json:"state,omitempty"`
|
||||
PaymentDefinitions []PaymentDefinition `json:"payment_definitions,omitempty"`
|
||||
MerchantPreferences MerchantPreferences `json:"merchant_preferences,omitempty"`
|
||||
CreateTime time.Time `json:"create_time,omitempty"`
|
||||
UpdateTime time.Time `json:"update_time,omitempty"`
|
||||
Links []Link `json:"links,omitempty"`
|
||||
}
|
||||
)
|
||||
|
||||
// CreateBillingPlan creates a billing plan in Paypal
|
||||
// Endpoint: POST /v1/payments/billing-plans
|
||||
func (c *Client) CreateBillingPlan(plan BillingPlan) (*CreateBillingResp, error) {
|
||||
req, err := c.NewRequest("POST", fmt.Sprintf("%s%s", c.APIBase, "/v1/payments/billing-plans"), plan)
|
||||
if err != nil {
|
||||
return &CreateBillingResp{}, err
|
||||
}
|
||||
|
||||
response := &CreateBillingResp{}
|
||||
|
||||
err = c.SendWithAuth(req, response)
|
||||
if err != nil {
|
||||
return response, err
|
||||
}
|
||||
|
||||
return response, nil
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user