I have this html code:
<form id="payment-form">
<div class="form-row">
<label for="name">
Name
</label>
<input id="name" name="name" required>
</div>
<div class="form-row">
<label for="email">
Email
</label>
<input id="email" name="email" required>
</div>
<button id="submit-button">Pay with OXXO</button>
</form>
<!-- Used to display form errors. -->
<div id="error-message" role="alert"></div>
<!-- Success UI for Oxxo -->
<div class="sr-result-oxxo hidden">
<h1>¡Gracias! Solo falta un paso más:</h1>
<div class="sr-instructions">
<p>
Instrucciones para realizar el pago en OXXO:
<p>1. Entregue el voucher con el código de barras a la persona en la caja de cualquier tienda OXXO para que ésta lo escanee.</p>
<p>2. Proporcione el monto en efectivo a la persona en la caja.</p>
<p>3. Una vez completado su pago, guarde el recibo para sus archivos.</p>
<p>4. Para cualquier duda o aclaración, contacte al comerciante.</p>
</p>
</div>
<table class="sr-tabular-info">
<tr>
<th>Monto</th>
<th>Fecha de expiración</th>
</tr>
<tr>
<td><span class="order-amount"></span></td>
<td><span class="oxxo-expiry-date"></span></td>
</tr>
</table>
<img width="150px" src="https://cdn.glitch.com/4b07d8fe-0ac6-478d-9303-5ed5d5c1220d%2Foxxo.png?v=1571866932777" alt="OXXO logo">
<div class="oxxo-display"></div>
</div>
secret.php
<?php
require_once('stripe-lib/init.php');
\Stripe\Stripe::setApiKey('sk_test_API_KEY');
$intent = \Stripe\PaymentIntent::create([
"amount" => 1099,
"currency" => "mxn",
"payment_method_types" => ["oxxo"]
]);
echo json_encode(array('client_secret' => $intent->client_secret));
?>
pay_oxxo.js
var stripe = Stripe('pk_test_API_KEY');
var form = document.getElementById('payment-form');
form.addEventListener('submit', function(event) {
event.preventDefault();
form.addEventListener('submit', function(event) {
event.preventDefault();
$.post("secret.php",{},function(data){
var client_Secret = jQuery.parseJSON(data);
var clientSecret = client_Secret.client_secret;
stripe.confirmOxxoPayment(
clientSecret,
{
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;
}
});
});
});
});
I am using the stripe api to generate vouchers to pay in oxxo, if it generates a voucher for me but it generates it in English, the question is how to make the text put it in Spanish because the div
one with the class sr-result-oxxo
that contains the translation of the text displayed in the payment voucher for oxxo.
You can set the voucher language at https://dashboard.stripe.com/settings/emails :
Once configured, this language will be used for the coupon. You can also configure the demo to not show the Stripe voucher and build your own by indicating
{handleActions: false}
: