paypal支付,paypal js支付,paypal jq支付,paypal 沙盒支付,paypal支付简单案例demo
<!DOCTYPE html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<script
src="https://www.paypal.com/sdk/js?client-id=你的client-id">
</script>
</head>
<body>
<div id="paypal-button-container"></div>
<script>
paypal.Buttons({
createOrder: function(data, actions) {
return actions.order.create({
purchase_units: [{
amount: {
value: '0.01'
}
}]
});
},
onApprove: function(data, actions) {
return actions.order.capture().then(function(details) {
alert('Transaction completed by ' + details.payer.name.given_name);
});
}
}).render('#paypal-button-container');
</script>
</body>
client-id获取:
https://developer.paypal.com/developer/applications/
https://developer.paypal.com/developer/accounts/(没有账号先注册,这里是生产环境账户,下图是生产环境下账户下的三个测试i账户)
这个链接查看支付结果
https://www.sandbox.paypal.com/mep/dashboard