WorldPay JSON API技术问询:futurepayID与可重用token是否一致?
Hey there! Great question—let me clear this up for you since WorldPay's docs can be a bit ambiguous at times.
Short answer: Yes, the futurepayID is exactly the same as the reusable token returned by the API.
When you set the reusable parameter to true in your integration (which you've already done correctly in your code), the obj.token value you receive in the callback is the futurepayID. This token serves as the unique identifier for the saved payment method, allowing you to initiate future payments without requiring the customer to re-enter their payment details every time.
Looking at your code snippet, you're already capturing this token correctly:
<script type='text/javascript'> window.onload = function() { Worldpay.useTemplateForm({ 'clientKey':"xxx", 'form':'paymentForm', 'saveButton':false, 'paymentSection':'paymentSection', 'display':'inline', 'reusable':true, 'callback': function(obj) { if (obj && obj.token) { var _el = document.createElement('input'); _el.value = obj.token; _el.type = 'hidden'; _el.name = 'token'; document.getElementById('paymentForm').appendChild(_el); document.getElementById('paymentForm').submit(); } } }); } </script>
You can safely pass this token as the futurepayID when handling repeat payment requests for your client. If you want to double-verify, you can test a repeat payment using this token—if it successfully pulls up the saved payment method, that confirms they're one and the same.
内容的提问来源于stack exchange,提问作者Jo Driscoll

