以下代码客户端部分的此代码我必须添加生产密钥和客户端令牌。
<script>
// Render the PayPal button
paypal.Button.render({
// Pass in the Braintree SDK
braintree: braintree,
// Pass in your Braintree authorization key
client: {
sandbox: paypal.request.get('/demo/checkout/api/braintree/client-token/'),
production: '<insert production auth key>'
},
// Set your environment
env: 'sandbox', // sandbox | production
// Wait for the PayPal button to be clicked
payment: function(data, actions) {
// Make a call to create the payment
return actions.payment.create({
payment: {
transactions: [
{
amount: { total: '10', currency: 'USD' }
}
]
}
});
},
// Wait for the payment to be authorized by the customer
onAuthorize: function(data, actions) {
return actions.payment.tokenize().then(function(data) {
console.log('Braintree nonce:', data.nonce);
});
}
}, '#paypal-button-container');
</script>
如何从paypal express沙箱获取客户端ID和秘密身份验证,因为 我必须在下面的代码中添加它们。
client: {
sandbox: paypal.request.get('/demo/checkout/api/braintree/client-token/'),
production: '<insert production auth key>'
},
我已输入我们的沙箱应用验证密钥和ID我收到错误。
答案 0 :(得分:0)
如果您的生产凭据不正确,您将无法打开PayPal Light框。
您的代码应与此类似:(下面列出的Sandbox和Production Client ID来自演示页面作为示例):
https://developer.paypal.com/demo/checkout/#/pattern/client -
client: {
sandbox: 'AZDxjDScFpQtjWTOUtWKbyN_bDt4OgqaF4eYXlewfBP4-8aqX3PiV8e1GWU6liB2CUXlkA59kJXE7M6R',
production: 'AZDxjDScFpQtjWTOUtWKbyN_bDt4OgqaF4eYXlewfBP4-8aqX3PiV8e1GWU6liB2CUXlkA59kJXE7M6R'
},
以下是获取沙盒和Live Client ID的步骤: