mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Add support for Apple Pay
This commit is contained in:
parent
cde68a54e0
commit
b159037969
@ -105,6 +105,40 @@
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@elseif (! empty($accountGateway) && $accountGateway->getApplePayEnabled())
|
||||
<script type="text/javascript" src="https://js.stripe.com/v3/"></script>
|
||||
<script type="text/javascript">
|
||||
// https://stripe.com/docs/stripe-js/elements/payment-request-button
|
||||
var stripe = Stripe('{{ $accountGateway->getPublishableStripeKey() }}');
|
||||
var paymentRequest = stripe.paymentRequest({
|
||||
country: '{{ $invoice->client->getCountryCode() }}',
|
||||
currency: '{{ strtolower($invoice->client->getCurrencyCode()) }}',
|
||||
total: {
|
||||
label: '{{ trans('texts.invoice') . ' ' . $invitation->invoice->invoice_number }}',
|
||||
amount: {{ $invitation->invoice->getRequestedAmount() * 100 }},
|
||||
},
|
||||
});
|
||||
|
||||
var elements = stripe.elements();
|
||||
var prButton = elements.create('paymentRequestButton', {
|
||||
paymentRequest: paymentRequest,
|
||||
});
|
||||
|
||||
$(function() {
|
||||
// Check the availability of the Payment Request API first.
|
||||
paymentRequest.canMakePayment().then(function(result) {
|
||||
if (result) {
|
||||
// do nothing
|
||||
} else {
|
||||
console.log('not supported');
|
||||
$('#paymentButtons ul.dropdown-menu li').last().remove();
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
@endif
|
||||
@stop
|
||||
|
||||
|
@ -19,6 +19,11 @@
|
||||
var elements = stripe.elements();
|
||||
var prButton = elements.create('paymentRequestButton', {
|
||||
paymentRequest: paymentRequest,
|
||||
style: {
|
||||
paymentRequestButton: {
|
||||
height: '44px',
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
$(function() {
|
||||
@ -69,10 +74,14 @@
|
||||
|
||||
<p> </p>
|
||||
|
||||
<center>
|
||||
<div class="row">
|
||||
<div class="col-md-1 col-md-offset-4">
|
||||
{!! Button::normal(strtoupper(trans('texts.cancel')))->large()->asLinkTo($invitation->getLink()) !!}
|
||||
|
||||
<div id="payment-request-button"></div>
|
||||
</center>
|
||||
</div>
|
||||
<div class="col-md-1">
|
||||
<div id="payment-request-button" style="padding-left:20px;width:250px;"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@stop
|
||||
|
Loading…
x
Reference in New Issue
Block a user