mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Square payments
This commit is contained in:
parent
82a0a311cd
commit
5c8976a50f
@ -32,27 +32,30 @@
|
||||
const appId = "{{ $gateway->company_gateway->getConfigField('applicationId') }}";
|
||||
const locationId = "{{ $gateway->company_gateway->getConfigField('locationId') }}";
|
||||
|
||||
async function initializeCard(payments) {
|
||||
const card = await payments.card();
|
||||
await card.attach('#card-container');
|
||||
return card;
|
||||
}
|
||||
async function initializeCard(payments) {
|
||||
const card = await payments.card();
|
||||
await card.attach('#card-container');
|
||||
return card;
|
||||
}
|
||||
|
||||
document.addEventListener('DOMContentLoaded', async function () {
|
||||
if (!window.Square) {
|
||||
throw new Error('Square.js failed to load properly');
|
||||
}
|
||||
const payments = window.Square.payments(appId, locationId);
|
||||
let card;
|
||||
try {
|
||||
card = await initializeCard(payments);
|
||||
} catch (e) {
|
||||
console.error('Initializing Card failed', e);
|
||||
return;
|
||||
}
|
||||
document.addEventListener('DOMContentLoaded', async function () {
|
||||
|
||||
if (!window.Square) {
|
||||
throw new Error('Square.js failed to load properly');
|
||||
}
|
||||
|
||||
const payments = window.Square.payments(appId, locationId);
|
||||
let card;
|
||||
|
||||
try {
|
||||
card = await initializeCard(payments);
|
||||
} catch (e) {
|
||||
console.error('Initializing Card failed', e);
|
||||
return;
|
||||
}
|
||||
|
||||
// Step 5.2: create card payment
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
@endsection
|
Loading…
x
Reference in New Issue
Block a user