|
 |
|
สอบทราบเรื่องการใช้ paypal ส่วนของ Express Checkout Client-Side REST |
|
 |
|
|
 |
 |
|
พอดีผมต้องทำเว็บลงทะเบียน แล้วมีการจ่ายค่าลงทะเบียนเป็น ระดับต่างๆ เช่น คนทั่วไปกับนักศึกษา ราคาต่างกัน
แล้วจะให้ส่งค่า ID ของ user เข้า paypal ตรงไหนครับ (ทีไม่เกี่ยวข้องกับIDของpaypal)
ผมใช้php
<script src="https://www.paypalobjects.com/api/checkout.js"></script>
<div id="paypal-button-container"></div>
<script>
// Render the PayPal button
paypal.Button.render({
// Set your environment
env: 'sandbox', // sandbox | production
// Specify the style of the button
style: {
layout: 'vertical', // horizontal | vertical
size: 'medium', // medium | large | responsive
shape: 'rect', // pill | rect
color: 'gold' // gold | blue | silver | black
},
// Specify allowed and disallowed funding sources
//
// Options:
// - paypal.FUNDING.CARD
// - paypal.FUNDING.CREDIT
// - paypal.FUNDING.ELV
funding: {
allowed: [ paypal.FUNDING.CARD, paypal.FUNDING.CREDIT ],
disallowed: [ ]
},
// PayPal Client IDs - replace with your own
// Create a PayPal app: https://developer.paypal.com/developer/applications/create
client: {
sandbox: 'AZDxjDScFpQtjWTOUtWKbyN_bDt4OgqaF4eYXlewfBP4-8aqX3PiV8e1GWU6liB2CUXlkA59kJXE7M6R',
production: '<insert production client id>'
},
payment: function(data, actions) {
return actions.payment.create({
payment: {
transactions: [
{
amount: { total: '<?php echo $priec ;?>', currency: 'THB' }
}
]
}
});
},
onAuthorize: function(data, actions) {
return actions.payment.execute().then(function() {
window.alert('Payment Complete!');
});
}
}, '#paypal-button-container');
</script>
Tag : PHP

|
|
 |
 |
 |
 |
Date :
2018-02-11 23:08:29 |
By :
tonbee159 |
View :
868 |
Reply :
1 |
|
 |
 |
 |
 |
|
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ลงทะเบียน apps ก่อน
// Create a PayPal app: https://developer.paypal.com/developer/applications/create
แล้วนำ อิฐ ที่ได้มาสร้างกำแพงต่อใน line 41
|
 |
 |
 |
 |
Date :
2020-08-02 21:27:50 |
By :
PhrayaDev |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|
|

|
Load balance : Server 03
|