我到处搜索了很多,但没有找到我的问题的答案。
我不能让它工作。我的 PayPal 按钮使用快速结账服务器端 Rest,但我测试了客户端,这很容易,而且可以工作。
我正在使用 CodeIgniter 所以这是我的代码。
这是我的视图文件夹中的 javascript 代码。CREATE_URL并EXECUTE_URL转到控制器。
paypal.Button.render({
env: 'sandbox', // sandbox | production
// Show the buyer a 'Pay Now' button in the checkout flow
commit: true,
// payment() is called when the button is clicked
payment: function() {
// Set up a url on your server to create the payment
var CREATE_URL = '/projects/createurl';
// Make a call to your server to set up the payment
return paypal.request.post(CREATE_URL)
.then(function(res) { …Run Code Online (Sandbox Code Playgroud)