{"templateId":"markdown","sharedDataIds":{"sidebar":"sidebar-sidebars.yaml"},"props":{"metadata":{"markdoc":{"tagList":["code-walkthrough","step","admonition"]},"redocly_category":"Documentation","type":"markdown"},"seo":{"title":"Tokenize payments made using Apple Pay","description":"Learn how to use the FramePay library to tokenize payments made using Apple Pay.","siteUrl":"https://www.rebilly.com","image":"/assets/rebillysocial.94fb32fc280c9e84b963c440ec462771d25f4e6fdaaa6c59de41e8135113b46b.db81178d.png","lang":"en-US","llmstxt":{"hide":false,"sections":[{"title":"Table of contents","includeFiles":["**/*"],"excludeFiles":[]}],"excludeFiles":[]}},"dynamicMarkdocComponents":[],"compilationErrors":[],"ast":{"$$mdtype":"Tag","name":"article","attributes":{},"children":[{"$$mdtype":"Tag","name":"CodeWalkthrough","attributes":{"__idx":1,"preview":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Complete the payment flow using this test card number: ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["4111 1111 1111 1111"]},"."," ","Use any future expiration date and any 3 digits for the CVC number."," ","For more test cards, see ",{"$$mdtype":"Tag","name":"a","attributes":{"href":"/docs/tutorials/test-payment-cards"},"children":["Test cards, IBANs, and ACH details"]},"."]},{"$$mdtype":"Tag","name":"iframe","attributes":{"style":{"marginBottom":"8px","height":"675px","width":"100%"},"frameBorder":"0","height":"350","scrolling":"no","src":"/examples/framepay-example-apple-pay.html"},"children":[]}],"filters":{},"filesets":[{"files":[{"path":"docs/dev-docs/_code-samples/setup-apple-pay/example.html","content":["<!doctype html>","<html>","    <head>",{"start":3,"condition":{"steps":["include-framepay-stylesheet"]},"children":["        <link href=\"https://framepay.rebilly.com/framepay.css\" rel=\"stylesheet\" />"]},{"start":6,"condition":{"steps":["include-framepay-script"]},"children":["        <script src=\"https://framepay.rebilly.com/framepay.js\"></script>"]},"        <script src=\"./client.js\" defer></script>","    </head>","    <body>","        <form>",{"start":13,"condition":{"steps":["include-html-mounting-points"]},"children":["            <div id=\"apple-pay-mount\"></div>"]},"        </form>","    </body>","</html>",""],"metadata":{"steps":["include-framepay-stylesheet","include-framepay-script","include-html-mounting-points"]},"basename":"example.html","language":"html"}],"downloadAssociatedFiles":[]},{"files":[{"path":"docs/dev-docs/_code-samples/setup-apple-pay/client.js","content":[{"start":0,"condition":{"steps":["initialize"]},"children":["Framepay.initialize({",{"start":2,"condition":{"steps":["rebilly-data"]},"children":["    publishableKey: \"pk_sandbox_123\",","    organizationId: \"org-123\",","    websiteId: \"website-123\","]},{"start":7,"condition":{"steps":["transaction-data"]},"children":["    transactionData: {","        currency: \"USD\",","        amount: 10,","        label: \"Demo purchase label\",","        lineItems: [","            {","                label: \"Subtotal\",","                amount: \"8.70\",","            },","            {","                label: \"Tax\",","                amount: \"1.30\",","            },","        ],","    },"]},"});"]},{"start":26,"condition":{"steps":["mount-apple-pay-button"]},"children":["Framepay.on(\"ready\", function () {","    const applePay = Framepay.applePay.mount(\"#apple-pay-mount\");","});"]},{"start":31,"condition":{"steps":["listen-for-payment-token"]},"children":["Framepay.on(\"token-ready\", (data) => {","    console.log(\"Payment token:\", data);","});"]},""],"metadata":{"steps":["initialize","rebilly-data","transaction-data","mount-apple-pay-button","listen-for-payment-token"]},"basename":"client.js","language":"javascript"}],"downloadAssociatedFiles":[]}],"steps":[{"id":"include-framepay-stylesheet","heading":"Include the FramePay stylesheet"},{"id":"include-framepay-script","heading":"Include the FramePay script"},{"id":"include-html-mounting-points","heading":"Include the HTML mounting points"},{"id":"initialize","heading":"Initialize"},{"id":"rebilly-data","heading":"Rebilly data"},{"id":"transaction-data","heading":"Transaction data"},{"id":"mount-apple-pay-button","heading":"Mount the Apple Pay button"},{"id":"listen-for-payment-token","heading":"Listen for the generated payment token"}],"inputs":{},"toggles":{}},"children":[{"$$mdtype":"Tag","name":"Heading","attributes":{"level":1,"id":"tokenize-payments-made-using-apple-pay","__idx":0},"children":["Tokenize payments made using Apple Pay"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["This guide describes how to use the FramePay JavaScript library to tokenize payments made using Apple Pay."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["If you want to use Apple Pay inside an iOS application, ",{"$$mdtype":"Tag","name":"a","attributes":{"href":"/contact/"},"children":["contact us"]},"."]},{"$$mdtype":"Tag","name":"details","attributes":{},"children":[{"$$mdtype":"Tag","name":"summary","attributes":{},"children":["Prerequisites"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["To complete this guide, you must have an organization ID, a website ID, and a publishable API key."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["You must also have a payment gateway configured in your Rebilly account."," ","For sandbox testing, the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["TestProcessor"]}," gateway is pre-configured."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["If you already have your IDs and API key, continue to ",{"$$mdtype":"Tag","name":"a","attributes":{"href":"#step-1-initial-setup"},"children":["Step 1: Initial setup"]},"."," ","If you do not, see ",{"$$mdtype":"Tag","name":"a","attributes":{"href":"/docs/dev-docs/set-up-environment"},"children":["Set up your environment"]},"."]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"step-1-initial-setup","__idx":1},"children":["Step 1: Initial setup"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Set up the FramePay library and create the necessary HTML structure."]},{"$$mdtype":"Tag","name":"CodeStep","attributes":{"id":"include-framepay-stylesheet","heading":"Include the FramePay stylesheet"},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Add the default styles for the FramePay library elements on the page."]}]},{"$$mdtype":"Tag","name":"CodeStep","attributes":{"id":"include-framepay-script","heading":"Include the FramePay script"},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Expose the FramePay library in the global JS scope as ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Framepay"]},"."]}]},{"$$mdtype":"Tag","name":"CodeStep","attributes":{"id":"include-html-mounting-points","heading":"Include the HTML mounting points"},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Specify an empty HTML element where the FramePay library will mount the Apple Pay button."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Add a new HTML element with a unique ID to your checkout form."]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"step-2-configure-framepay","__idx":2},"children":["Step 2: Configure FramePay"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["This step describes the basic configuration needed to mount the Apple Pay button."]},{"$$mdtype":"Tag","name":"CodeStep","attributes":{"id":"initialize","heading":"Initialize"},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Create a configuration object and initialize the FramePay library."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["For more information, see ",{"$$mdtype":"Tag","name":"a","attributes":{"href":"/docs/dev-docs/framepay-configuration-reference/"},"children":["FramePay configuration reference"]},"."]}]},{"$$mdtype":"Tag","name":"CodeStep","attributes":{"id":"rebilly-data","heading":"Rebilly data"},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Provide your publishable API key, organization ID, and website ID to connect with the Rebilly API."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["For more information, see ",{"$$mdtype":"Tag","name":"a","attributes":{"href":"/docs/dev-docs/setup-apple-pay#prerequisites"},"children":["Prerequisites"]},"."]}]},{"$$mdtype":"Tag","name":"CodeStep","attributes":{"id":"transaction-data","heading":"Transaction data"},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Provide the transaction data."," ","Apple Pay requires ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["amount"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["currency"]},", and ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["label"]}," values."]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"step-3-get-the-payment-token","__idx":3},"children":["Step 3: Get the payment token"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Mount the FramePay library onto your page and listen for a payment token."]},{"$$mdtype":"Tag","name":"Admonition","attributes":{"type":"warning"},"children":[{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The initial transaction must use the payment token, not a payment instrument, to pass Apple Pay authentication parameters."]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["After completing a transaction with the token, the payment instrument is returned and can be reused."]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Apple Pay authentication parameters are not persisted to the payment instrument, but the gateway retains reference to the initial customer-facing transaction."]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Creating a payment instrument from the token only includes basic card data (device PAN, expiration)."]}]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["For more information, see ",{"$$mdtype":"Tag","name":"a","attributes":{"href":"/docs/dev-docs/api/transactions/posttransaction/#!t=request&path=paymentInstruction"},"children":["Payment instruction"]},"."]}]},{"$$mdtype":"Tag","name":"CodeStep","attributes":{"id":"mount-apple-pay-button","heading":"Mount the Apple Pay button"},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Mount the Apple Pay button in the container element."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"a","attributes":{"href":"/docs/dev-docs/events/#ready"},"children":["Framepay.on('ready', ...)"]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"a","attributes":{"href":"/docs/dev-docs/framepay-global-reference/#apple-pay-namespace"},"children":["Framepay.applePay.mount(...)"]}]}]},{"$$mdtype":"Tag","name":"CodeStep","attributes":{"id":"listen-for-payment-token","heading":"Listen for the generated payment token"},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["When a customer completes the Apple Pay flow, Rebilly creates a payment token."," ","Listen for the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["token-ready"]}," event to retrieve it."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["At this point you can use the token for other operations, for example to create a payment instrument or transaction."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"a","attributes":{"href":"/docs/dev-docs/events/#token-ready"},"children":["Framepay.on('token-ready', ...)"]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"related-topics","__idx":4},"children":["Related topics"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"a","attributes":{"href":"/docs/dev-docs/apple-pay-testing"},"children":["Apple Pay testing"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"a","attributes":{"href":"/docs/dev-docs/framepay-configuration-reference/#applepay"},"children":["Configuration reference"]}]}]}]}]},"headings":[{"value":"Tokenize payments made using Apple Pay","id":"tokenize-payments-made-using-apple-pay","depth":1},{"value":"Step 1: Initial setup","id":"step-1-initial-setup","depth":2},{"value":"Step 2: Configure FramePay","id":"step-2-configure-framepay","depth":2},{"value":"Step 3: Get the payment token","id":"step-3-get-the-payment-token","depth":2},{"value":"Related topics","id":"related-topics","depth":2}],"frontmatter":{"seo":{"title":"Tokenize payments made using Apple Pay","description":"Learn how to use the FramePay library to tokenize payments made using Apple Pay."},"markdown":{"toc":{"hide":true}},"redirects":{"/docs/content/dev-docs/tutorial/setup-apple-pay/":{},"/docs/content/concepts-and-features/tutorial/setup-apple-pay/":{},"/docs/concepts-and-features/tutorial/setup-apple-pay/":{}},"excludeFromSearch":true,"footer":{"hide":true}},"lastModified":"2026-03-24T10:16:15.000Z","pagePropGetterError":{"message":"","name":""}},"slug":"/docs/dev-docs/setup-apple-pay","userData":{"isAuthenticated":false,"teams":["anonymous"]},"isPublic":true}