Skip to main content

Open Gardens Test

const swiftCheckoutClient = new window.SumUp.SwiftCheckout( 'sup_pk_15L78BEN6sSCWVr3Bq2zcRbuhrdl5ZZAO', ); const paymentRequest = swiftCheckoutClient.paymentRequest({ total: { label: 'One Shoe', amount: { value: '100.0', }, }, shippingOptions: [ { id: 'post', label: 'postal service', amount: { currency: 'EUR', value: '0.00' }, description: 'free post', }, ], }); const buttons = swiftCheckoutClient.elements(); buttons.onSubmit((paymentMethodEvent) => { paymentRequest .show(paymentMethodEvent) .then((paymentResponse) => { console.log(paymentResponse.details); // Create your order and a checkout const checkoutId = 'c463bf5e-d397-4bca-9d2e-a4e04f668b1c'; return swiftCheckoutClient.processCheckout(checkoutId, paymentResponse); }) .then((result) => { if (result.status === 'PAID') { window.location.href = '/thankyou'; } else { console.error( 'It was not possible to process the checkout', result.message, ); } }) .catch((error) => { if ( error instanceof SumUp.SwiftCheckout.Errors.PaymentRequestCancelledError ) { console.error('Cancelled by the user'); } else { throw error; } }); }); paymentRequest.canMakePayment().then((isAvailable) => { if (isAvailable) { paymentRequest.availablePaymentMethods().then((paymentMethods) => { buttons.mount({ paymentMethods, container: document.querySelector('#express-checkout-container'), }); }); } else { console.error('No payment method is available.'); } });