방금 CMS에 PayPal Express Checkout 통합을 구현했습니다. 샌드 박스 ID를 사용하면 정상적으로 작동하지만 실제 환경에서는 고객이 페이팔 API 자격 증명을 시스템에 넣어야합니다. 페이팔 개발자 문서에서 익스체인지 체크 아웃 통합 코드에 고객 자격 증명을 통합 할 수있는 방법을 찾지 못했습니다.JS와의 PayPal Express Checkout 통합 : 생산 ID
누군가 저를 도와 줄 수 있습니까?
<div id='paypal-button'></div>
<script>
paypal.Button.render({
env: 'production', // Specify 'sandbox' for the test environment, 'production'
style: {
size: 'medium',
color: 'silver',
shape: 'rect'
},
client: {
sandbox: 'ASoNxxxxxxxxxxxxxxxxxxx',
production: '$customer_api'
},
payment: function(resolve, reject) {
// Set up the payment here, when the buyer clicks on the button
var env = this.props.env;
var client = this.props.client;
return paypal.rest.payment.create(env, client, {
'intent': 'sale',
'payer':{
'payer_info': {
'email': '$email',
'first_name': '$vorname',
'last_name': '$nachname',
'shipping_address': {
'line1': '$strasse',
'city': '$ort',
'postal_code': '$plz',
'country_code': '$land',
'recipient_name': '$firma'
}
}
},
transactions: [
{
amount: {
'total': '$total',
'currency': '$currency',
'details':{
'subtotal':'$total_netto',
'tax':'$tax',
'shipping':'$shipping',
}
},
},
],
});
},
commit: true,
onAuthorize: function(data, actions) {
return actions.payment.execute().then(function() {
location.href = '/shop/checkout/mode/4'
});
},
onCancel: function(data, actions) {
return actions.redirect();
},
onError: function(err) {
location.href = '/shop/checkout/mode/4'
}
}, '#paypal-button');
</script>