これは可能ですが、サーバー側のプログラミングを行う必要があります。プログラムで「暗号化されたボタン」を作成し、PayPalに送信します。
私のストアページhttps://secure.entrian.com/store/store.html - それはいくつかの情報を要求し、それをサーバに送信して暗号化されたボタンにし、それをPayPalに提出します。
$license_name
と$quantity
は私が求めるてるフィールドであり、formgen.py
はPayPalのマニュアルに従ってOpenSSLを使用して要求を構築し、署名するサーバー側のPythonスクリプトここではJavaScriptが、次のようになります。
$paypal_form.submit(function() {
var response = $.ajax({
type: "GET",
url: 'formgen.py?' + serialize({
licenseName: $license_name.val(),
quantity: $quantity.val()
}),
async: false
}).responseText;
if (response.indexOf('PKCS7') >= 0) {
$encrypted.val(response);
} else {
$payment_errors.text(response).show(easing_duration);
return false;
}
return true;
}
フォームは、この(かなり単純化)のようになります。フォームがPayPalに提出される前に<input name="encrypted" ...>
は、AJAXの応答が移入されることを
<form id="paypal-form" action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_s-xclick">
<input type="hidden" name="upload" value="1">
<input type="hidden" id="encrypted" name="encrypted" value="">
<button id="buynow" class="submit-button btn" type="submit">Buy Now</button>
</form>
。