代码拉取完成,页面将自动刷新
package paypal
import (
"context"
"encoding/json"
"fmt"
"net/http"
"gitee.com/LeeScott/gopay"
)
// 创建订阅计划(CreateBillingPlan)
// Code = 0 is success
// 文档:https://developer.paypal.com/docs/api/subscriptions/v1/#plans_create
func (c *Client) CreateBillingPlan(ctx context.Context, bm gopay.BodyMap) (ppRsp *CreateBillingRsp, err error) {
if err = bm.CheckEmptyError("product_id", "billing_cycles"); err != nil {
return nil, err
}
res, bs, err := c.doPayPalPost(ctx, bm, subscriptionCreate)
if err != nil {
return nil, err
}
ppRsp = &CreateBillingRsp{Code: Success}
ppRsp.Response = new(BillingDetail)
if err = json.Unmarshal(bs, ppRsp.Response); err != nil {
return nil, fmt.Errorf("[%w]: %v, bytes: %s", gopay.UnmarshalErr, err, string(bs))
}
if res.StatusCode != http.StatusCreated {
ppRsp.Code = res.StatusCode
ppRsp.Error = string(bs)
ppRsp.ErrorResponse = new(ErrorResponse)
_ = json.Unmarshal(bs, ppRsp.ErrorResponse)
}
return ppRsp, nil
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。