[英]PayPal JavaScript SDK: How to change the 'Buy Now' button to 'Pay Now'?
我正在使用最新版本的 PayPal JavaScript SDK (而不是已棄用的checkout.js
)以及我的付款頁面的智能按鈕。 當 PayPal 在底部顯示信用卡/借記卡數據輸入表單時,我希望它顯示“立即付款”而不是“立即購買” ,我該怎么做?
我按照這個示例進行操作,但它僅將主按鈕更改為“使用 PayPal 付款”以及“信用卡/借記卡”按鈕,但藍色的“立即購買”仍顯示在表單下方:
paypal.Buttons({
style: {
layout: 'vertical',
color: 'gold',
shape: 'rect',
label: 'pay' // I changed to 'pay' instead
}
}).render('#paypal-button-container');
我什至按照本指南將commit=true
參數添加到 SDK 但沒有運氣:
<script src="https://www.paypal.com/sdk/js?client-id=YOUR_CLIENT_ID&commit=true"></script>
以下是我的完整代碼,以備不時之需:
paypal.Buttons({
style: {
layout: 'vertical',
color: 'gold',
shape: 'rect',
label: "pay"
},
createOrder: function (data, actions) {
// This function sets up the details of the transaction, including the amount and line item details.
return actions.order.create({
purchase_units: [{
amount: {
currency_code: "MYR",
value: "1.00"
}
}],
application_context: {
shipping_preference: "NO_SHIPPING"
}
});
},
onApprove: function (data, actions) {
// This function captures the funds from the transaction.
return actions.order.capture()
.then(function (details) {
// This function shows a transaction success message to your buyer.
alert('Transaction completed by ' + details.payer.name.given_name);
});
}
}).render('#gPayContainer');
//This function displays Smart Payment Buttons on your web page.
任何建議將不勝感激,謝謝!
正如@Preston PHX 評論的那樣,無論是立即付款還是立即購買,它都是由PayPal翻譯的語言環境。 看看下面的截圖,如果選擇 England(默認),按鈕文本是Buy Now :
However, when Malaysia is selected (and only AFTER the country selection dropdown list is losing the focus), the button text changes to Pay Now :
我們不知道為什么 PayPal 會這樣翻譯以及背后的必要性,因為:
label
for the style
object to pay
, PayPal changes the main gold button label to Pay with PayPal
and not Buy with PayPal
anyway.因此,現在的解決方案是針對馬來西亞 select馬來西亞的付款人,以免在支付非商品商品時被按鈕 label 混淆。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.