Problems When Writing WebHook for Stripe Integration with FormStack

153 views Asked by At

I'm working on trying to write a script for Stripe integration on a FormStack form. This is what I have been able to come up with from Stripe API. I'm a little bit lost from here.

<?php
require_once('lib/Stripe.php'); 
Stripe::setApiKey("sk_test_jioajgiowoiagj");
Stripe_Customer::create(array
(
"number" => $cardnumber,
"exp_month" => $expmonth,
"exp_year" => $expyear,
"cvc" => $cvc, 
 "name"=> $name,
 "address_line1" => $address1,
 "address_line2"=> $address2,
 "address_city"=> $city,
 "ddress_state"=> $state,
 "address_zip"=> $zip,
 "address_country"=> $county,
));
?>
1

There are 1 answers

0
bgrambo On

Formstack dev here. What you're looking to accomplish is not possible with Formstack Webhooks. We sanitize the data sent via Webhook, so Stripe would be unable to process the credit card. You could potentially work around that (and the need for a Webhook in the first place) by using an Advanced HTML Embed Code to embed the form in your page, and replace the Form's submit property with the script you'd want to use.

However, if you do that, we would not be able to perform any server-side validation, and you would be responsible for the security of the data.

P.S. It's a really bad idea to show your API keys in example code.