#ferdinand-Paynow
1 messages · Page 1 of 1 (latest)
thank you @gleaming vale !
You can use this doc to get started with react integration https://stripe.com/docs/payments/accept-a-payment?platform=web&ui=elements&html-or-react=react
And you can call stripe.confirmPaynowPayment to display the QR code https://stripe.com/docs/payments/paynow/accept-a-payment?platform=web#confirm-payment-intent
thank you @gleaming vale but i got stuck when implemented
can you tell me a bit more?
yes. this is my code on react after following this tutorial https://stripe.com/docs/payments/paynow/accept-a-payment?platform=web#confirm-payment-intent
import React, { useEffect, useState } from 'react';
import { loadStripe } from "@stripe/stripe-js";
function Payment(props) {
//STRIPE PAYNOW
var response = fetch('/create-payment-intent-paynow').then(function(response) {
return response.json();
}).then(function(responseJson) {
var clientSecret = responseJson.client_secret;
// Call stripe.confirmPayNowPayment() with the client secret.
});
// Set your publishable key. Remember to change this to your live publishable key in production.
// See your keys here: https://dashboard.stripe.com/apikeys
var stripePaynow = loadStripe('pk_test_....');
var form = document.getElementById('payment-form-paynow');
form.addEventListener('submit', function(event) {
event.preventDefault();
// Set the clientSecret here you got in Step 2
stripePaynow.confirmPayNowPayment(
clientSecret,
).then((res) => {
if(res.paymentIntent.status === 'succeeded') {
// The user scanned the QR code
} else {
// The user closed the modal, cancelling payment
}
});
});
return (
<div>
<ul className="nav nav-tabs">
<li className="nav-item">
<a className="nav-link" aria-current="page" href="#" onClick={handleTabCC}>Credit Cart</a>
</li>
</ul>
<form id="payment-form-paynow">
<button type="submit" id="submit" ></button>
</form>
</div>
);
}
export default Payment;
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
but i got error
Which line is Payment.js 111? Is form null?
this code :
form.addEventListener('submit', function(event) {
Can you check if form is null?
Hi @fallen pivot just want to check in and see if your problem is resolved.