--In the case of SPA, the button is no longer displayed after the second time due to the phenomenon that the webpay script is not read every time. --Solution: Add the following code
$scope.init = function() {
window.WebPay = void(0);
window.WebPayCheckoutHelper = void(0);
}
――I couldn't find the difference between the two keys for a long time. --publick_key: key to display checkout helper button on templete side --secret_key: The key to be passed as a request parameter on the server side when making a payment with the acquired customer_id or token (don't show it)
--I want to set the key by judging the following on the server side --In production, "data-key =" live_public_234u32942342 ... " --In the local environment, "data-key =" test_public_jfi443of34f ... "
I thought that I could do it as follows, but I was able to go hard coding, but when the server processing runs, the script processing is executed first and an error occurs without the key
<script class="webpay-button"
data-key="[[form_data.webpay_key]]"
data-lang="ja"
data-partial="true"
data-text="Enter card information"
data-submit-text="Card information input completed"
src="https://checkout.webpay.jp/v3/"</script>
The solution is to set data-key = "[[form_data.webpay_key]]" before getting the key on the server.
――Isn't webpay very suitable for SPA?
As mentioned above, I had a problem with webpay cooperation.