Checkout
// Set your publishable key. Remember to switch to your live publishable key in production!Stripe('pk_test_51InVaQLFHogQ3kokBVNdjKj3pd2QqW4xaJlu7ESkzmUOzQo8tPXSWYXkjGZkVw2dyZjaYQe2no1huvLgCr1J9I4W00KQN3noCZ'); var form = document.getElementById('payment-form'); // See your keys here: https://dashboard.stripe.com/apikeys var stripe = form.addEventListener('submit', function(event) { event.preventDefault(); stripe.confirmOxxoPayment( '{{PAYMENT_INTENT_CLIENT_SECRET}}', { payment_method: { billing_details: { name: document.getElementById('name').value, email: document.getElementById('email').value, }, }, }) // Stripe.js will open a modal to display the OXXO voucher to your customer .then(function(result) { // This promise resolves when the customer closes the modal if (result.error) { // Display error to your customer var errorMsg = document.getElementById('error-message'); errorMsg.innerText = result.error.message; } }); });
// Set your secret key. Remember to switch to your live secret key in production. // See your keys here: https://dashboard.stripe.com/apikeys \Stripe\Stripe::setApiKey('pk_test_51InVaQLFHogQ3kokBVNdjKj3pd2QqW4xaJlu7ESkzmUOzQo8tPXSWYXkjGZkVw2dyZjaYQe2no1huvLgCr1J9I4W00KQN3noCZ'); $intent = \Stripe\PaymentIntent::create([ "amount" => 600, "currency" => "mxn", "payment_method_types" => ["oxxo"] ]); // Send the intent.client_secret back to the client so you can use it in later steps. var response = fetch('/secret').then(function(response) { return response.json(); }).then(function(responseJson) { var clientSecret = responseJson.client_secret; // Call stripe.confirmOxxoPayment() with the client secret. });