To facilitate PCI compliant credit card collections Fusebill provides a AJAX Transparent Redirect endpoint which you can use to securely capture customer’s credit cards. If you are adding the first payment method on a customer, it will be set to the default payment method automatically.
This API action is authenticated with a separate Public API Key. If you do not have that key, please contact Fusebill Support. The Public Key can only be used to authenticate the Transparent Redirect action.
Google reCAPTCHA required.
Fusebill leverages reCAPTCHA technology to ensure payment method data captured is provided by a human and to protect against bots and scripting.
We use Google reCAPTCHA V2 in order to accomplish this.
https://developers.google.com/recaptcha/intro
The basic workflow for how this is accomplished is as follows:
- Using Fusebill’s public site key, the client is presented with a captcha widget.
- The user then verifies that they are human, starting with a check box. The user may be presented with additional verification steps such as an image recognition task.
- The captcha widget then verifies with Google that the user is human, and returns a response token.
- That response token is then sent to Fusebill with the payment method data for our system to validate and verify.
Fusebill Environment
|
reCAPTCHA Public Site Key
|
---|---|
Staging (stg-payments.subscriptionplatform.com) |
6LcI_GwUAAAAAJZu0VvB68DdxNxb5ZcBIwAX7RVj |
Sandbox and Production (payments.subscriptionplatform.com) |
6LfVtGwUAAAAALHn9Ycaig9801f6lrPmouzuKF11 |
Create Credit Card Payment Method
Add Credit Card
Field Name
|
Details
|
Required
|
Type
|
---|---|---|---|
|
This is the Fusebill customer ID of the customer you wish to add the card to |
Yes |
Number |
|
This is your public API key. |
Yes |
String |
|
This is the credit card number. |
Yes |
Number |
|
The first name of the cardholder. |
Yes |
String |
|
The last name of the card holder. |
Yes |
String |
ExpirationMonth |
Expiration month on the credit card. |
Yes |
Number |
|
Expiration on the credit card. |
Yes |
Number |
|
The credit card verification number. |
Yes |
Number |
|
Recaptcha token response. |
Yes |
String |
riskToken |
WePay Risk token |
No+ |
String |
|
Client/Customer IP address |
No+ |
String |
|
Customer Email address |
No+ |
String |
|
First line of payment method address. |
No |
String |
address2 |
Second line of payment method address. |
No* |
String |
city |
City of the payment method |
No* |
String |
stateId |
State ID of the Payment method. |
No* |
Number |
|
Country ID of the payment method. |
No* |
Number |
|
PostalZip of the payment method |
No* |
String |
paymentCollectOptions |
Object that allows specifying an amount to collect when creating the card. Only works through Json |
No |
Object |
+
Denotes a field required for Fusebill Payments API Risk Fields
*
Denotes fields required for AVS and may be required by your account’s Gateway. These fields are also required if using Fusebill Payments accounts as AVS is mandatory.
Notes:- Address information can optionally be captured as well.
Sample Code
<!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>AJAX Transparent Redirect</title> http://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js var verifyCallback = function(response) { document.getElementById("mySubmit").disabled = false; $('input#recaptcha_token').val(response); }; var expCallback = function () { document.getElementById("mySubmit").disabled = true; grecaptcha.reset(); }; var onloadCallback = function() { grecaptcha.render('exampleWithCallback', { 'sitekey': '', 'callback': verifyCallback, 'expired-callback': expCallback }); }; function AJAXTransparentRedirect() { var dataString = 'CustomerId='+ $('input#CustomerId').val() + '&PublicApiKey=' + $('input#PublicApiKey').val() + '&SuccessUri='+$('input#SuccessUri').val() + '&FailUri='+$('input#FailUri').val() + '&CardNumber='+$('input#CardNumber').val() + '&FirstName='+$('input#FirstName').val() + '&LastName='+$('input#LastName').val() + '&ExpirationMonth='+$('input#ExpirationMonth').val() + '&ExpirationYear='+$('input#ExpirationYear').val() + '&makeDefault='+$('input#MakeDefault').val() + '&Cvv='+$('input#Cvv').val() + '&recaptcha=' + $('input#recaptcha_token').val(); alert(dataString); //Set up the request var request = $.ajax({ type: "POST", url: "https://stg-payments.subscriptionplatform.com/api/paymentsv2/", data: dataString }); //Set up the callback functions request.done(function (msg) { //$('#response').append("success
"); alert("success"); //document.location.replace = ''; }); request.fail(function (jqXHR) { // $('#response').append("failure
"); alert(parseAndBuildErrorMessage(jqXHR)); //document.location.replace = ''; expCallback(); }); } function htmlEscape(msg) { return document.createElement('span') .appendChild(document.createTextNode(msg)) .parentNode .innerHTML; } function buildErrorMessage (errors) { if (errors.length == 0) { return ""; } var message; if (errors.length > 1) { message = "
- ";
for (var i = 0; i " + htmlEscape(errors[i].Value) + "";
}
}
message += "
- ";
for (var i = 0; i " + htmlEscape(internalErrors[i]) + "";
}
message += "
Sample Response
{ "maskedCardNumber" : "************1111", "cardType" : "Visa", "expirationMonth" : 10, "expirationYear" : 23, "customerId" : 50975, "firstName" : "a", "lastName" : "a", "address1" : null, "address2" : null, "countryId" : null, "country" : "", "stateId" : null, "state" : "", "city" : null, "postalZip" : null, "makeDefault" : true, "id" : 5933, "uri" : null }
Fusebill Payments
When using Fusebill Payments as your gateway processing account, some additional processing and data is required.
These are the ClientIP and a Risk token.
Additional information is available here.