How to add card details and generate stripe token using Relation manager form?

Hello, I am using stripe-php to add card information to Stripe and using card details relation manager for customers. I am able to add the card details in the self hosted form but Stripe requires us to generate token by sending card details using their Javascript api which I can send by dispatching the Livewire event but I am not able to set the value for the token field with the class card_token on the form after getting response from Stripe. Please let me know how can I generate the token, validate it and set the token as value for card_token textinput before submitting the form. Thank you
4 Replies
mohdaftab
mohdaftab3mo ago
Here is the custom.js file code document.addEventListener('livewire:init', () => { Livewire.on('generate-stripe-token', (event) => { // stripe token generate process here console.log("test"); token = "token here"; // get the token from stripe document.getElementsByClassName("card_token")[0].value = token; }); });
mohdaftab
mohdaftab3mo ago
Here is the CreateAction
No description
mohdaftab
mohdaftab3mo ago
and the form
No description
mohdaftab
mohdaftab3mo ago
Please someone help with this issue.
Want results from more Discord servers?
Add your server