php - Perform a Stripe transaction without JS to retrieve token -


i trying perform stripe transaction without use of javascript. possibly curl cannot figure out header using v2 api.

<form action="" method="post" id="payment-form">   <span class="payment-errors"></span>    <div class="form-row">     <label>       <span>card number</span>       <input type="text" size="20" data-stripe="number"/>     </label>   </div>    <div class="form-row">     <label>       <span>cvc</span>       <input type="text" size="4" data-stripe="cvc"/>     </label>   </div>    <div class="form-row">     <label>       <span>expiration (mm/yyyy)</span>       <input type="text" size="2" data-stripe="exp-month"/>     </label>     <span> / </span>     <input type="text" size="4" data-stripe="exp-year"/>   </div>    <button type="submit">submit payment</button> </form>    <?php require '../stripe-php/init.php';  //this next line wrong $post = 'client_secret=['sk_07c5ukidqx'].'&grant_type=authorization_code&code='.$_get['code']; $ch = curl_init(); curl_setopt($ch,curlopt_url, $system['stipe']['token_url']); curl_setopt($ch,curlopt_postfields, $post); curl_setopt($ch, curlopt_ssl_verifypeer, 0); curl_setopt($ch, curlopt_returntransfer, 1); $result = curl_exec($ch); curl_close($ch);  $decode = json_decode($result);  \stripe\stripe::setapikey("my_secret"); \stripe\charge::create(array(     "amount" => 500,     "currency" => "usd",     "source" => $decode[2], // totally guessing value in element #2    "description" => "charge test@example.com"  )); 

?>

most of issue getting token. of stripe docs using stripe.js , not using javascript.

how stripe token php variable without use of javascript can use basic transaction?

stripe doesn't require server pci compliant when using stripe.js.

if have web form accept credit card data, want card token created stripe. credit card info never intended sent on wire sever. why form fields in code have no name attribute (name-less fields not submitted). this thing.

if insist on not using stripe.js, api docs on creating charge state

the source provide must either token, ones returned stripe.js, or a associative array containing user's credit card details

'amount'   => 200, // $2.00, 'currency' => 'usd', 'source'   => [     'object'    => 'card',     'number'    => '...'     'exp_month' => '...',     'exp_year'  => '...',     'cvc'       => '...', ] 

remove stripe.js, put name attributes on form, , use charge::create() method without preceeding curl stuff.

i have mention, if unclear basics of api makes credit card processing dead simple, very worried how exposing myself potential lawsuit letting credit card data touch servers.


Comments

Popular posts from this blog

OpenCV OpenCL: Convert Mat to Bitmap in JNI Layer for Android -

android - org.xmlpull.v1.XmlPullParserException: expected: START_TAG {http://schemas.xmlsoap.org/soap/envelope/}Envelope -

python - How to remove the Xframe Options header in django? -