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

Integration with Stripe - difficult?

Thread began 4/12/2017 1:55 pm by Nathon Jones Web Design | Last modified 5/16/2019 2:04 pm by Ray Borduin | 3474 views | 12 replies |

Nathon Jones Web Design

Integration with Stripe - difficult?

My client is using Stripe and wants to integrate this with their site www.dreamcargalaxy.com.
In the documentation, https://stripe.com/docs/checkout/tutorial, it gives the following code to use on your site.

<form action="/your-server-side-code" method="POST">
<script
src="https://checkout.stripe.com/checkout.js" class="stripe-button"
data-key="testkeyvalue"
data-amount="999"
data-name="Dream Car Holdings Limited"
data-description="Widget"
data-image="https://stripe.com/img/documentation/checkout/marketplace.png"
data-locale="auto"
data-zip-code="true"
data-currency="gbp">
</script>
</form>



What should we be inserting for the "/your-server-side-code" action value for the form?

Also, we edited the form to include the eCart Grand Total as follows:

<form action="/your-server-side-code" method="POST">
<script
src="https://checkout.stripe.com/checkout.js" class="stripe-button"
data-key="testkeyvalue"
data-amount="<?php echo $cartDC->GrandTotal(); ?>"
data-name="Dream Car Holdings Limited"
data-description="Widget"
data-image="https://stripe.com/img/documentation/checkout/marketplace.png"
data-locale="auto"
data-zip-code="true"
data-currency="gbp">
</script>
</form>



...but instead of inserting £48.00 it inserted £0.48! You can view that on our view cart page at:
http://www.dreamcargalaxy.com/view-cart.php

User account information provided privately below. Thank you.
NJ

Sign in to reply to this post

Nathon Jones Web Design

As follows...

Sign in to reply to this post

Ray BorduinWebAssist

data-amount="<?php echo $cartDC->GrandTotal() * 100; ?>"

Sign in to reply to this post
Did this help? Tips are appreciated...

Nathon Jones Web Design

Why is it converting the amount?

Sign in to reply to this post

Ray BorduinWebAssist

Some payment gateways have you pass the amount in pennies instead of dollars.... stripe must be one of those.

Sign in to reply to this post
Did this help? Tips are appreciated...

Nathon Jones Web Design

I'm running this in test mode at the moment and when you enter the Stripe test card details to complete a purchase, it processes the payment and then attempts to jump you to whatever page is specified in the action in the form:

<form action="/your-server-side-code" method="POST">



So, I need to basically direct it to a page on the site that will save an authorisation key, they are called "tokens" I believe but I've no idea how Stripe posts them back to whatever page it is that we choose to redirect people to.

I'm not clear what order I should have this in now, in particular the Save Order to Database and Order Details to Database behaviours which we will need in order to store the order details for customer to be able to review. This will need adjusted to include a field for the token sent by Stripe, right?

Would appreciate any advice you could offer. Thank you.
NJ

Sign in to reply to this post

Ray BorduinWebAssist

I'm not that familiar with Stripe, so I don't know.

You can probably use

php:
<?php

var_dump
($_POST);
?>



to see what variables are returned.

Sign in to reply to this post
Did this help? Tips are appreciated...

Nathon Jones Web Design

How do I carry over all of the cart information - items, discounts, sub-total, grand total - to the page specified in the action of the Stripe form?

Sign in to reply to this post

Ray BorduinWebAssist

You can use the cart bindings to insert those values in the appropriate places.

What I always do when integrating a new payment gateway is:

1) I use their examples to get it working outside of the shopping cart
2) I copy/paste from ecart bindings to get the values from the cart instead
3) I copy/paste the form bindings to get the purchaser and card information coming from the form

Sign in to reply to this post
Did this help? Tips are appreciated...

Curtis

Curtis

Hi ray, just letting you know that ecart is working amazing after you helping me last week with the ipconfig issues. I do have a question, I am integrating with stripe also. I have it under control except I wanted to use the php code that is in my checkout page and as referenced above i added *100:

<?php echo WA_eCart_DisplayMoney($ampkart, $ampkart->GrandTotal()*100); ?>

Can you help me with how I can remove the dollar sign and convert it from a floating point number to a integer in this php code, so it won't display:
$50.00, it will only display: 5000

Thank you.
Curtis

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...