Advertisement
Guest User

Untitled

a guest
Mar 23rd, 2018
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. ** Client Side **
  2.  
  3. stripe.createSource(card).then(function(result) {
  4. if (result.error) {
  5. formIsPending = false;
  6. // Inform the user if there was an error
  7. var errorElement = document.getElementById('card-errors');
  8. errorElement.textContent = result.error.message;
  9. } else {
  10. // Send the source to your server
  11. stripeSourceHandler(result.source);
  12. }
  13. });
  14.  
  15. ** Server Side **
  16.  
  17. $cardSource = \Stripe\Source::retrieve($stripeSource);
  18.  
  19. if (in_array($cardSource->card->three_d_secure, ['required', 'recommended', 'optional'])) {
  20. $success = $this->_process3DSecure($cardSource);
  21. } else {
  22. $success = $this->_processNormal($cardSource);
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement