close ad
Install the LAtest Updates to Work with CC 2017 and CC 2018
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 4:55 pm by Nathon Jones Web Design | Last modified 4/26/2017 12:14 pm by Ray Borduin | 204 views | 8 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

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

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

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

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