close ad
Databridge V2 with MySQLi support IS Now Available!
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Stripe Integration with eCart

Thread began 1/15/2019 4:22 pm by eric284736 | Last modified 2/06/2019 2:12 pm by Ray Borduin | 60 views | 11 replies |

eric284736

Stripe Integration with eCart

Hi Ray,

We did a Stripe payment processor setup about 2 or 3 years ago on a Premier support session and I needed to update a line of code.

The original line was setup like this:

name: $('#Last_Name').val() + " - reunion-donation"

I need to capture the full name of the customer so would I change the code to this:

name: $('#Last_Name, #First_Name').val() + " - reunion-donation"

Please advise.

thx
Eric

Sign in to reply to this post

eric284736

Here is the whole section of code


<script type="text/javascript">
// this identifies your website in the createToken call below
Stripe.setPublishableKey('pk_live_***********************************');
function stripeResponseHandler(status, response) {
if (response.error) {
// re-enable the submit button
$('#Payment_submit').removeAttr("disabled");
// show the errors on the form
$(".payment-errors").html(response.error.message);
} else {
var form$ = $("#Payment_NewFromBlank_Default");
// token contains id, last4, and card type
var token = response['id'];
// insert the token into the form so it gets submitted to the server

form$.append("<input type='hidden' name='stripeToken' value='" + token + "' />");
// and submit
form$.get(0).submit();
}
}
$(document).ready(function() {
$("#Payment_NewFromBlank_Default").submit(function(event) {
document.MM_returnValue = false;
// disable the submit button to prevent repeated clicks
$('#Payment_submit').attr("disabled", "disabled");
// createToken returns immediately - the supplied callback submits the form if there are no errors
Stripe.createToken({
number: $('#Card_Number').val(),
cvc: $('#Card_CVV').val(),
exp_month: $('#Card_Exp_Month').val(),
exp_year: $('#Card_Exp_Year').val(),
address_line1: $('#Address_1').val(),
address_city: $('#City').val(),
address_state: $('#State').val(),
address_zip: $('#Country').val(),
address_country: $('#Postal_Code').val(),
name: $('#Last_Name, #First_Name').val() + " - reunion-donation"
}, stripeResponseHandler);
return false; // submit from callback
});
});
</script>

Sign in to reply to this post

Ray BorduinWebAssist

name: $('#Last_Name).val() + " " + $(#First_Name').val() + " - reunion-donation"

Sign in to reply to this post

eric284736

Thanks Ray!!

Sign in to reply to this post

eric284736

Hi Ray,

I have one more question about this integration and if it needs to be a premiere support ticket let me know.

Stripe has a metadata field which we could use to capture the orderID and it would make matching orders much easier.

How do I capture the orderID from this statement:

if (isset($_SESSION[$ConditionalQuery->SaveAs])) $ConditionalQuery->addFilter("OrderID", "=", "d", $_SESSION[$ConditionalQuery->SaveAs]);


and apply it to the script:

$(document).ready(function() {
$("#Payment_NewFromBlank_Default").submit(function(event) {
document.MM_returnValue = false;
// disable the submit button to prevent repeated clicks
$('#Payment_submit').attr("disabled", "disabled");
// createToken returns immediately - the supplied callback submits the form if there are no errors
Stripe.createToken({
number: $('#Card_Number').val(),
cvc: $('#Card_CVV').val(),
exp_month: $('#Card_Exp_Month').val(),
exp_year: $('#Card_Exp_Year').val(),
address_line1: $('#Address_1').val(),
address_city: $('#City').val(),
address_state: $('#State').val(),
address_zip: $('#Country').val(),
address_country: $('#Postal_Code').val(),
name: $('#Last_Name, #First_Name').val() + " - reunion-donation"
}, stripeResponseHandler);
return false; // submit from callback
});
});
</script>


Would it be this

metadata: $('#OrderID').val(),

or is it different because that is a session variable?

thx
Eric

Sign in to reply to this post

Ray BorduinWebAssist

Can I see a copy of the page? I think it would be something like:


metadata: "<?php echo($_SESSION["eventcart_OrderID"]); ?>",

Sign in to reply to this post

eric284736

see pm

Sign in to reply to this post

Ray BorduinWebAssist

Please attach the actual page next time so I can open it with Dreamweaver, it will be much easier for me to read.

I think the right line of code would be:


metadata: "<?php echo($_SESSION["eventcart_OrderID"]); ?>",

Sign in to reply to this post

eric284736

I did attach the page in a zip file. Thanks I will give this a try. Thanks Ray!!

Sign in to reply to this post

eric284736

Hi Ray,

I added the line but when the Submit button is clicked there is no response. Page is attached.

thx
Eric

Sign in to reply to this post
loading

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...