简体   繁体   中英

How to Build Recurly.js Credit Card Form with Optional Data Included

We want to use recurly.js to process a credit card payment, and we want to include full address information and ip address of the user at the time that the token is originally submitted. It appears that the 'required' fields are automatically included with the token.

How do we get recurly.js to add the additional fields, like address, zip, ip address to the token so that they can be submitted for payment verification?

I presume that if we use the update function, this won't work because it will be too late (since the verification would likely have already gone in to the payment gateway).

Here are two fields, one 'required', one optional. The first field appears to be submitted with the token, the second one is not:

<input type="text" id="email" data-recurly="email" placeholder="Email">

<input type="text" id="address1" data-recurly="address1" placeholder="Card Billing Address 1">

Also, how is the user ip address added / handled?

Was not able to work this out from the recurly documentation or the github examples, none of which seem to use the optional fields like zip or ip address even though recurly lists them as 'STRONGLY RECOMMENDED'.

If the Address Requirement in the Recurly admin console (Configuration->Site Settings) is set at the default Full Address , then recurly.js will validate the form to determine if the address and zip are included. The IP address check is done implicitly and included in the billing information stored on the account.

After the required fields (based upon the Address Requirement of the configuration) have been validated on the recurly.js form as included, they are tokenized and passed to the Create Subscription API request which will pass the token to Recurly to be verified with the payment gateway.

An example of the Create Subscription API request here, https://dev.recurly.com/docs/create-subscription shows the Full Address information that would be included in the token for verification by the payment gateway.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM