Skip to main content

Apple Pay in QuickStream

Apple Pay allows customers to make purchases using a credit or debit card from their Apple wallet. As a business, accepting Apple Pay makes it easy and secure for your customers to make purchases on mobile and desktop websites using Touch ID or Face ID.

Fast

Use QuickStream to accept Apple Pay on the web as a payment method to your own payment page by creating a Payment Request button using the QuickStream REST API.

Secure

Every payment is securely authenticated with Touch ID, Face ID or passcode.

Seamless

Offer a one-click payment experience to your customers without them having to manually enter credit card or shipping details.

Getting started

To accept Apple Pay as a payment method in QuickStream, you must integrate with the QuickStream REST API and register each domain you would like to accept Apple Pay payments on. Follow these steps:

  1. Sign in to QuickStream to Configure Apple Pay.
  2. Follow the instructions to register your domains and download your domain verification file.
  3. Integrate with QuickStream REST API and create a Payment Request Button.
  4. Create a payment using the REST API by providing a singleUseTokenId returned by the Payment Request Button module.

View the technical guide

Reporting

Use these methods to find Apple Pay transactions made through QuickStream:

Refunds

Refund Apple Pay transactions using QuickStream portal and the REST API.

Surcharging

Surcharging works the same as normal card payments. The Apple Pay credential (i.e. DPAN or FPAN) is sent to QuickStream and QuickStream calculates the surcharge based on the Card Scheme Surcharging configuration that can be set in the QuickStream portal.

Read more about surcharging.

Settlement and response codes

Supported browsers

Apple Pay is supported on browsers and devices compatible with the Payment Request Button.

Apple Pay with QuickStream REST API

Our QuickStream REST API allows you to create a Payment Request Button in your payment form with QuickStream-API.js.

Getting started

This page explains how to add Apple Pay to your existing QuickStream REST API integration. If you haven't done this integration yet, refer to our API reference and the QuickStream-API.js library reference.

Before starting your Apple Pay integration:

  1. Make sure that you have received your Publishable and Secret REST API keys for our QuickStream REST API.
  2. Register each domain via which you will accept Apple Pay payments and follow the instructions.
  3. Create a payment form that you want to add an Apple Pay button to. Your payment form is a webpage that you will display to your customers when they choose their payment method.
  4. Serve your application over HTTPS. This is required for test and production environments. You can use a service like ngrok to do this.
  5. Set up your back-end implementation to take a payment using the Transactions API.

How to implement Apple Pay in your payment form

  1. Add the QuickStream-API.js library to your payment form.

    <script type="text/javascript" src="https://api.quickstream.westpac.com.au/rest/v1/quickstream-api-1.0.min.js"></script>
  2. Add the Payment Request Button Container to your payment form that will drop-in the Apple Pay button on supported Apple devices.

    <div data-quickstream-api="paymentRequestButtonContainer"></div>
  3. Initialise QuickStream-API.js with your Publishable API key for your QuickStream facility.

    QuickstreamAPI.init( {
      publishableApiKey: "PUBLISHABLE_API_KEY"
    } );
  4. Create the PaymentRequestConfigObject for your customer.

    var config = {
     supplierBusinessCode: "SUPPLIER_CODE", // This is required
     details: {
       total: {
         label: "Your company name",
         amount: {
           value: "10.00",
           currency: "AUD"
         }
       }
     }
    };
  5. Create the Payment Request Button with the PaymentRequestConfigObject.

    Handle errors or retrieve the singleUseTokenId property from the PaymentRequestResponseObject.

    QuickstreamAPI.paymentRequestButton.createButton(config, function(errors, paymentResponse) {
        if (errors) {
            // Handle errors here
        } else {
            console.log("singleUseTokenId is " + paymentResponse.singleUseTokenId);
    
            // perform the payment on your server here before calling below.
            paymentResponse.complete("success");
        }
    });

Take a payment

  1. After obtaining the singleUseTokenId pass this to your server.

  2. From your server, request POST /v1/transactions using your Secret REST API key, specifying:

    • singleUseTokenId: The paymentResponse.singleUseTokenId from the createButton function.
    POST / HTTP/1.1
    Host: https://api.quickstream.westpac.com.au/rest/v1/transactions
    Authorization: Basic A8d8sdk938damcheyt7=
    Idempotency-Key: a8f4bd70-5435-11ea-8d77-2e728ce88125
    Content-Type: application/json
    
    {
        "transactionType" : "PAYMENT",
        "singleUseTokenId": "dec2075f-da92-49df-8a92-f7e494f89c22",
        "supplierBusinessCode": "SUPPLIER_CODE",
        "principalAmount": 10.00,
        "currency" : "AUD",
        "eci": "INTERNET",
        "ipAddress" : "192.168.1.1"
    }

    See Process a transaction using a single-use-token for more.

    The response contains the result of the payment.

(Optional) Surcharging

Surcharging works the same as normal card payments. The Apple Pay credential (DPAN) is sent to QuickStream and QuickStream calculates the surcharge based on your Card Scheme Surcharging configuration.

QuickStream does not know the card before the user approves the payment sheet meaning it cannot calculate and show the total amount to the user before it is approved.

By default, the payment sheet for Apple Pay will show <Supplier Business Name> (surcharge may be added) when surcharging is configured for a supplier business.

You can change this label to display whatever you want during:

  • the initialisation of the payment sheet
  • the onShippingAddressChange event
  • the onShippingOptionChange event

See the details.total.label property.

If you want to show the surcharge amount, you may be able to use multiple line items.

(Optional) Multiple line items

You can provide the details.displayItems property which is an array of amount line items.

If you have configured all card schemes to have the same surcharge amount, you can calculate and provide the surcharge value earlier in the flow than usual.

details: {
  displayItems: [
    {
      label: "Service 1",
      amount: { currency: "AUD", value: "6.00" }
    },
    {
      label: "Service 2",
      amount: { currency: "AUD", value: "4.00" }
    },
    {
      label: "Surcharge",
      amount: { currency: "AUD", value: "1.00" }
    }
  ],
  total: {
    label: "Total amount",
    amount: { currency: "AUD", value: "11.00" }
  }
}

Present the result

Use the status that you received in your transaction response to present the result to your payer by updating the Payment Sheet using the PaymentRequestResponseObject complete function.

QuickstreamAPI.paymentRequestButton.createButton(config, function(errors, paymentResponse) {
    if (errors) {
        // Handle errors here
    } else {
        // provide success or fail to present the result to the client
        paymentResponse.complete("success");
    }
});

Testing Apple Pay with QuickStream

The QuickStream test environment is linked to the Apple Pay test environment. You can test the payment process using the Apple Pay Sandbox Testing page.

Refer to:

Go Live

Once you are ready to go live you must:

  1. Create an Apple account to add real cards to your Apple Wallet. You cannot use test cards in Production.
  2. Sign in to QuickStream and register each domain via which you will accept Apple Pay payments and follow the instructions verify your domain with Apple Pay.
  3. Complete your integration with the QuickStream REST API in the production environment.

See also

Westpac Privacy Statement

Privacy Statement (for individuals whose personal information may be collected - in this clause referred to as "you"). All personal information we collect about you is collected, used and disclosed by us in accordance with our Privacy Statement which is available at Privacy Statement or by calling us through your relationship manager or Westpac representative. Our Privacy Statement also provides information about how you can access and correct your personal information and make a complaint. You do not have to provide us with any personal information but, if you don't, we may not be able to process an application or a request for a product or service.