Quantcast
Channel: Square Developer Forums - Latest topics
Viewing all articles
Browse latest Browse all 1326

Square Web Payments SDK Apple pay valid instance but no button

$
0
0

Having trouble the the payments SDK. Google is working fine however Apple pay is not displaying the apple pay button even after successfull initiation. Its not producing any errors so I am lost.

The #apple-pay-button html element remains empty.

Init method, within document.ready

    // Initialize Apple Pay
     try {
        // Initialize Apple Pay (no attach needed)
        const applePayInstance = await payments.applePay(paymentRequest);

        jQuery('#apple-pay-button').on('click', async function (e) {
            e.preventDefault();
            await handleTokenizationAndVerification(applePayInstance, 'Apple Pay');
        });
    } catch (error) {
        console.error('Failed to initialize Apple Pay:', error);
    }

I get a valid applepay instance with this, but no button.
Payment request object:

{
  "requestShippingContact": true,
  "requestEmailAddress": true,
  "requestBillingContact": true,
  "countryCode": "AU",
  "currencyCode": "AUD",
  "shippingOptions": [
    {
      "id": "flat_rate:1",
      "label": "Flat rate",
      "amount": "15.00"
    },
    {
      "id": "pickup_location:0",
      "label": "Pickup (Melbourne)",
      "amount": "0.00"
    },
    {
      "id": "free_shipping:2",
      "label": "Free shipping",
      "amount": "0.00"
    }
  ],
  "total": {
    "label": "SWS (via WooCommerce)",
    "amount": "114.00",
    "pending": false
  }
}

Feel free to test yourself, Cart – SquareSync for Woo
Objects/instances are logged to console

2 posts - 2 participants

Read full topic


Viewing all articles
Browse latest Browse all 1326

Trending Articles