- Posts: 13212
- Thank you received: 1723
Stripe elements styling
- Dang Thuc Dam
-
- Offline
- Administrator
-
Less
More
5 years 2 weeks ago #136682
by Dang Thuc Dam
Replied by Dang Thuc Dam on topic Stripe elements styling
I am still support my product, but in this case, i don't have solution to change structure of Stripe Card Elements Form.
Dam
Dam
Please Log in or Create an account to join the conversation.
- Dave B
-
- Offline
- Platinum Member
-
5 years 2 weeks ago #136683
by Dave B
Replied by Dave B on topic Stripe elements styling
There is a solution. Stripe has told me and so has this user, you can change it. We cannot. Only you can help us.
Please Log in or Create an account to join the conversation.
- Dang Thuc Dam
-
- Offline
- Administrator
-
Less
More
- Posts: 13212
- Thank you received: 1723
5 years 2 weeks ago #136685
by Dang Thuc Dam
Replied by Dang Thuc Dam on topic Stripe elements styling
What did Stripe told you?
Dam
Dam
Please Log in or Create an account to join the conversation.
- Dave B
-
- Offline
- Platinum Member
-
5 years 2 weeks ago #136686
by Dave B
Replied by Dave B on topic Stripe elements styling
- Russell Leigh
- Topic Author
- Offline
- Senior Member
-
Less
More
- Posts: 63
- Thank you received: 1
5 years 2 weeks ago #136690
by Russell Leigh
Replied by Russell Leigh on topic Stripe elements styling
Dave, to add padding you can do like
```
.jd-container .StripeElement {
poadding: 1rem;
}
```
The code to create individual elements is as so...
HTML
```
@extends('layouts.app')
@section('content')
@include('auth.registration-steps', )
<div class="row justify-content-center">
<div class="col-md-8">
<h2>{{ __('Payment') }}</h2>
<form method="POST" action="{{ route('subscriptions.store') }}">
<div class="card">
<div class="card-body">
<h3 class="text-center mb-3">Annual Membership</h3>
@csrf
<input type="hidden" name="paymentMethod" id="paymentMethod" value="">
<input type="hidden" name="subscriber" id="subscriber" value="{{ $subscriber->id }}">
@include('users._partials.price-options')
<hr>
<div class="row justify-content-center">
<div class="col-md-6">
<div class="stripe-elements mb-3">
{{-- <h5>Card details</h5>--}}
<div class="form-group">
<label for="card-holder-name">Card holder name</label>
<input type="text" name="card-holder-name" id="card-holder-name"
placeholder="Name on card" class="field"
value="{{ $subscriber->user->name }}" required>
</div>
<div class="form-group">
<label for="card-number">Card number</label>
<div id="card-number" class="field empty"></div>
</div>
<div class="row">
<div class="col-md-6">
<div class="form-group">
<label for="card-expiry">Expiry</label>
<div id="card-expiry" class="field empty"></div>
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label for="card-cvc">Security code</label>
<div id="card-cvc" class="field empty"></div>
</div>
</div>
</div>
</div>
<img src="{{ asset('images/card-logos-small.png') }}" alt="">
</div>
</div>
{{-- <div class="row justify-content-center">--}}
{{-- <div class="col d-flex justify-content-center">--}}
{{-- <img src="{{ asset('images/card-logos.png') }}" alt="" style="max-width:300px;">--}}
{{-- </div>--}}
{{-- </div>--}}
</div>
</div>
<div class="form-group mt-5">
<div class="text-center">
<button type="button" class="btn btn-primary btn-lg" id="stripe-submit-button"
data-secret="{{ $intent->client_secret }}" data-customer=""
data-stripe-key="{{ config('services.stripe.key') }}">
{{ __('Pay now') }}
</button>
</div>
</div>
</form>
</div>
</div>
@endsection
```
JS
```
import Loader from "./Loader";
class StripeForm {
constructor() {
const self = this;
this.cardButton = document.getElementById('stripe-submit-button');
const stripeKey = process.env.MIX_STRIPE_KEY;
if (this.cardButton) {
const stripe = Stripe(this.cardButton.dataset.stripeKey);
const elements = stripe.elements();
// const cardElement = elements.create('card');
// cardElement.mount('#card-element');
let elementStyles = {
base: {
// color: '#32325d',
// fontFamily: '"Helvetica Neue", Helvetica, sans-serif',
fontSmoothing: 'antialiased',
fontSize: '16px',
// '::placeholder': {
// color: '#aab7c4'
// }
},
// invalid: {
// color: '#fa755a',
// iconColor: '#fa755a'
// }
};
var elementClasses = {
focus: 'focus',
empty: 'empty',
invalid: 'invalid',
};
var cardNumber = elements.create('cardNumber', {
style: elementStyles,
classes: elementClasses,
});
cardNumber.mount('#card-number');
var cardExpiry = elements.create('cardExpiry', {
style: elementStyles,
classes: elementClasses,
});
cardExpiry.mount('#card-expiry');
var cardCvc = elements.create('cardCvc', {
style: elementStyles,
classes: elementClasses,
});
cardCvc.mount('#card-cvc');
const cardHolderName = document.getElementById('card-holder-name');
this.cardButton.addEventListener('click', async (e) => {
this.cardButton.disabled = true;
if (!cardHolderName.value) {
alert("The Card holder name field is required!");
return false;
}
Loader.loading();
// var el = elements.getElement('cardNumber');
// console.log(el);
var cardElement = {
exp_month: '',
exp_year: '',
number: '',
cvc: '',
};
// console.log(cardElement);
const {paymentMethod, error} = await stripe.createPaymentMethod(
'card', cardNumber, {
billing_details: {name: cardHolderName.value}
}
);
if (error) {
// Display "error.message" to the user...
console.log(error);
Loader.loading(false);
alert(error.message);
this.cardButton.disabled = false;
} else {
var paymentMethodInput = document.getElementById('paymentMethod');
paymentMethodInput.value = JSON.stringify(paymentMethod);
this.cardButton.form.submit();
// The card has been verified successfully...
}
});
}
}
checkReady() {
console.log('Stripe elements mounted');
}
}
export default StripeForm;
```
This is from a Laravel app so will need to be adjusted to fit but hopefully you can work it out from that and the documentation links I have provided
```
.jd-container .StripeElement {
poadding: 1rem;
}
```
The code to create individual elements is as so...
HTML
```
@extends('layouts.app')
@section('content')
@include('auth.registration-steps', )
<div class="row justify-content-center">
<div class="col-md-8">
<h2>{{ __('Payment') }}</h2>
<form method="POST" action="{{ route('subscriptions.store') }}">
<div class="card">
<div class="card-body">
<h3 class="text-center mb-3">Annual Membership</h3>
@csrf
<input type="hidden" name="paymentMethod" id="paymentMethod" value="">
<input type="hidden" name="subscriber" id="subscriber" value="{{ $subscriber->id }}">
@include('users._partials.price-options')
<hr>
<div class="row justify-content-center">
<div class="col-md-6">
<div class="stripe-elements mb-3">
{{-- <h5>Card details</h5>--}}
<div class="form-group">
<label for="card-holder-name">Card holder name</label>
<input type="text" name="card-holder-name" id="card-holder-name"
placeholder="Name on card" class="field"
value="{{ $subscriber->user->name }}" required>
</div>
<div class="form-group">
<label for="card-number">Card number</label>
<div id="card-number" class="field empty"></div>
</div>
<div class="row">
<div class="col-md-6">
<div class="form-group">
<label for="card-expiry">Expiry</label>
<div id="card-expiry" class="field empty"></div>
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label for="card-cvc">Security code</label>
<div id="card-cvc" class="field empty"></div>
</div>
</div>
</div>
</div>
<img src="{{ asset('images/card-logos-small.png') }}" alt="">
</div>
</div>
{{-- <div class="row justify-content-center">--}}
{{-- <div class="col d-flex justify-content-center">--}}
{{-- <img src="{{ asset('images/card-logos.png') }}" alt="" style="max-width:300px;">--}}
{{-- </div>--}}
{{-- </div>--}}
</div>
</div>
<div class="form-group mt-5">
<div class="text-center">
<button type="button" class="btn btn-primary btn-lg" id="stripe-submit-button"
data-secret="{{ $intent->client_secret }}" data-customer=""
data-stripe-key="{{ config('services.stripe.key') }}">
{{ __('Pay now') }}
</button>
</div>
</div>
</form>
</div>
</div>
@endsection
```
JS
```
import Loader from "./Loader";
class StripeForm {
constructor() {
const self = this;
this.cardButton = document.getElementById('stripe-submit-button');
const stripeKey = process.env.MIX_STRIPE_KEY;
if (this.cardButton) {
const stripe = Stripe(this.cardButton.dataset.stripeKey);
const elements = stripe.elements();
// const cardElement = elements.create('card');
// cardElement.mount('#card-element');
let elementStyles = {
base: {
// color: '#32325d',
// fontFamily: '"Helvetica Neue", Helvetica, sans-serif',
fontSmoothing: 'antialiased',
fontSize: '16px',
// '::placeholder': {
// color: '#aab7c4'
// }
},
// invalid: {
// color: '#fa755a',
// iconColor: '#fa755a'
// }
};
var elementClasses = {
focus: 'focus',
empty: 'empty',
invalid: 'invalid',
};
var cardNumber = elements.create('cardNumber', {
style: elementStyles,
classes: elementClasses,
});
cardNumber.mount('#card-number');
var cardExpiry = elements.create('cardExpiry', {
style: elementStyles,
classes: elementClasses,
});
cardExpiry.mount('#card-expiry');
var cardCvc = elements.create('cardCvc', {
style: elementStyles,
classes: elementClasses,
});
cardCvc.mount('#card-cvc');
const cardHolderName = document.getElementById('card-holder-name');
this.cardButton.addEventListener('click', async (e) => {
this.cardButton.disabled = true;
if (!cardHolderName.value) {
alert("The Card holder name field is required!");
return false;
}
Loader.loading();
// var el = elements.getElement('cardNumber');
// console.log(el);
var cardElement = {
exp_month: '',
exp_year: '',
number: '',
cvc: '',
};
// console.log(cardElement);
const {paymentMethod, error} = await stripe.createPaymentMethod(
'card', cardNumber, {
billing_details: {name: cardHolderName.value}
}
);
if (error) {
// Display "error.message" to the user...
console.log(error);
Loader.loading(false);
alert(error.message);
this.cardButton.disabled = false;
} else {
var paymentMethodInput = document.getElementById('paymentMethod');
paymentMethodInput.value = JSON.stringify(paymentMethod);
this.cardButton.form.submit();
// The card has been verified successfully...
}
});
}
}
checkReady() {
console.log('Stripe elements mounted');
}
}
export default StripeForm;
```
This is from a Laravel app so will need to be adjusted to fit but hopefully you can work it out from that and the documentation links I have provided
Please Log in or Create an account to join the conversation.
- Dang Thuc Dam
-
- Offline
- Administrator
-
Less
More
- Posts: 13212
- Thank you received: 1723
5 years 2 weeks ago #136700
by Dang Thuc Dam
Replied by Dang Thuc Dam on topic Stripe elements styling
You can send the link of your Donation form here, i can debug the CSS and let you know the custom CSS to push the Stripe Card Elements form for you.
Dam
Dam
Please Log in or Create an account to join the conversation.
- Dave B
-
- Offline
- Platinum Member
-
5 years 1 week ago #136782
by Dave B
Replied by Dave B on topic Stripe elements styling
Dam, why can't you fix this for all of us to have a better looking form?
Please Log in or Create an account to join the conversation.
- Dang Thuc Dam
-
- Offline
- Administrator
-
Less
More
- Posts: 13212
- Thank you received: 1723
5 years 1 week ago #136783
by Dang Thuc Dam
Replied by Dang Thuc Dam on topic Stripe elements styling
Hi
1. It doesn't happen on all sites, so i won't add it into core of Joom Donation. For example, on Joom Donation demo site: joomdonationdemo.com/donation/donate/donate-single-campaign , you won't see the same CSS issue with your site.
2. I just need to see the link of your Donation form, no need Super admin account.
Dam
1. It doesn't happen on all sites, so i won't add it into core of Joom Donation. For example, on Joom Donation demo site: joomdonationdemo.com/donation/donate/donate-single-campaign , you won't see the same CSS issue with your site.
2. I just need to see the link of your Donation form, no need Super admin account.
Dam
Please Log in or Create an account to join the conversation.
- Dave B
-
- Offline
- Platinum Member
-
5 years 1 week ago - 5 years 1 week ago #136784
by Dave B
Replied by Dave B on topic Stripe elements styling
Last edit: 5 years 1 week ago by Dave B.
Please Log in or Create an account to join the conversation.
- Dang Thuc Dam
-
- Offline
- Administrator
-
Less
More
- Posts: 13212
- Thank you received: 1723
5 years 1 week ago #136785
by Dang Thuc Dam
Replied by Dang Thuc Dam on topic Stripe elements styling
Go to Joom Donation Configuration -> Tab: Custom CSS and add
#stripe-card-form
{
padding-top:20px !important;
}
Good luck
Dam
#stripe-card-form
{
padding-top:20px !important;
}
Good luck
Dam
Please Log in or Create an account to join the conversation.
Moderators: Dang Thuc Dam, Dang Dam
Support
Documentation
Information
Copyright © 2025 Joomla Extensions by Joomdonation. All Rights Reserved.
joomdonation.com is not affiliated with or endorsed by the Joomla! Project or Open Source Matters.
The Joomla! name and logo is used under a limited license granted by Open Source Matters the trademark holder in the United States and other countries.
The Joomla! name and logo is used under a limited license granted by Open Source Matters the trademark holder in the United States and other countries.