Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Note

Please ensure you have followed the steps outlined in Domain Verification for Apple Pay before implementing Apple Pay.

To process Apple Pay request, the ccElement and apElement must be rendered on the page. The customer name and email must be filled in. When the Apple Pay button is clicked, the customer will be prompted to pick a card from their Apple wallet and authorise the payment. Once authorised, Apple will respond with a Apple Pay payment token. This generated payment token is automatically inserted into the payment form, then the whole form with the payment token is submitted.

Noteinfo

The Apple Pay button will only be enabled on iOS devices.

In a PHP implementation, your payment page may look like this:

Code Block
...
<body>
    <form method="POST" action="process" id="payment">
        @csrf
        {!! $ccElement !!}
        <input type="hidden" id="merchant_data" name="merchant_data" value="{\"order_id\": \"12345\"}" />
        <button type="submit">Submit</button>
    </form>
    <form method="POST" action="apProcess" id="apPayment">
        @csrf
        {!! $apElement !!}
        <input type="hidden" id="merchant_data" name="merchant_data" value="{\"order_id\": \"12345\"}" />
        <button type="submit">Submit</button>
    </form>
</body>

 


Elements

These are the elements that were fetched from the Intents resource. Specifically the ccElement and apElement.

Code Block
{!! $ccElement !!}
{!! $apElement !!}

Merchant Data Element

This is an optional element, which is hidden. It can be used to send important order or customer details that should be linked to the transaction. The value should be json string with double quotes delimited by backslashes.

Code Block
<input type="hidden" id="merchant_data" name="merchant_data" value="{\"order_id\": \"12345\"}" />