我在创建订阅计划时遇到错误。当我单击按钮时,弹出窗口立即关闭并显示此错误。 我该如何修复这个错误?
错误:
{
"name": "NOT_AUTHORIZED",
"message": "Authorization failed due to insufficient permissions.",
"debug_id": "f745284410b5f",
"details": [
{
"issue": "Unauthorised Access",
"description": "Billing Plan Override is not allowed due to insufficient permissions."
}
],
"links": [
{
"href": "https://developer.paypal.com/docs/api/v1/billing/subscriptions#NOT_AUTHORIZED",
"rel": "information_link",
"method": "GET"
}
]
}
我的代码:(使用@paypal/react-paypal-js库)
const createSubscription = (data: any, actions: any) => {
console.log('planId create', planId);
return actions.subscription
.create({
plan_id: planId,
custom_id: storeId,
plan: {
billing_cycles: [
{
pricing_scheme: {
fixed_price: {
currency_code: 'USD',
value: price,
},
},
sequence: 1,
total_cycles: 1,
},
],
taxes: {
percentage: '0',
inclusive: true,
},
},
})
<PayPalButtons
forceReRender={[price, planId, JSON.stringify(dataPurchase)]}
createSubscription={createSubscription}
onApprove={onApprove}
onError={(error) => {
console.log('Error:', error);
}}
onCancel={(order) => {
console.log('reject payment', order);
}}
style={{
shape: 'pill',
layout: 'vertical',
label: 'subscribe',
}}
/>
如果在函数 actions.subscription.create({...}) 没有计划参数(不覆盖),一切仍然运行良好
我想使用自定义计划创建计费计划。
我们的一些客户也遇到同样的问题。 联系 PayPal 支持后,我们收到以下消息:PayPal 阻止 actions.subscription.create({...}) 如果计划被推翻.. 没有事先沟通。
你找到解决办法了吗?