{"templateId":"markdown","sharedDataIds":{"sidebar":"sidebar-guides/sidebars.yaml"},"props":{"metadata":{"markdoc":{"tagList":["sub-heading","admonition","br","details","required","tabs","tab"]},"type":"markdown"},"seo":{"title":"Installation","description":"Transform your commerce with PXP's unified platform—seamless payments, real-time insights, and global growth in one powerful integration.","lang":"en-UK","siteUrl":"https://developer.pxp.io","llmstxt":{"hide":false,"sections":[{"title":"Table of contents","includeFiles":["**/*"],"excludeFiles":[]}],"excludeFiles":[]}},"dynamicMarkdocComponents":[],"compilationErrors":[],"ast":{"$$mdtype":"Tag","name":"article","attributes":{},"children":[{"$$mdtype":"Tag","name":"Heading","attributes":{"level":1,"id":"installation","__idx":0},"children":["Installation"]},{"$$mdtype":"Tag","name":"SubHeading","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Install the iOS SDK library and start using components in your project."]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"before-you-start","__idx":1},"children":["Before you start"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Make sure you have Xcode 14.0 or later with iOS deployment target 13.0 or later."]},{"$$mdtype":"Tag","name":"Admonition","attributes":{"type":"info"},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["PayPal payouts require iOS 14.0 or later. If you plan to use payout features, set your iOS deployment target to 14.0 or higher."]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"step-1-install-the-ios-sdk-library","__idx":2},"children":["Step 1: Install the iOS SDK library"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["To get started, download the latest version of the iOS SDK from GitHub repository."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["To install it using the Swift Package Manager:"]},{"$$mdtype":"Tag","name":"ol","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Open your Xcode project."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Go to ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["File"]}," > ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Add Package Dependencies"]},"."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Enter the SDK repository URL."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Select the version range or specific version."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Click ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Add Package"]},"."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Select your target and click ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Add Package"]},"."]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"step-2-get-your-api-credentials","__idx":3},"children":["Step 2: Get your API credentials"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["To initialise the SDK, you'll need to send authenticated requests to the PXP API."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["To get your credentials:"]},{"$$mdtype":"Tag","name":"ol","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["In the ",{"$$mdtype":"Tag","name":"a","attributes":{"href":"https://portal.pxp.io","target":"_blank"},"children":["Unity Portal"]},", go to ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Merchant setup > Merchant groups"]},"."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Select a merchant group."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Click the ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Inbound calls"]}," tab."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Copy the ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Client ID"]}," in the top-right corner."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Click ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["New token"]},"."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Choose a number of days before token expiry. For example, ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["30"]},"."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Click ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Save"]}," to confirm. Your token is now created."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Copy the token ID and token value. Make sure to keep these confidential to protect the integrity of your authentication process."]}]},{"$$mdtype":"Tag","name":"Admonition","attributes":{"type":"info"},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["As best practice, we recommend regularly generating and implementing new tokens."]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"step-3-get-the-session-data","__idx":4},"children":["Step 3: Get the session data"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Now that you have your credentials, you're ready to send an API request to the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["sessions"]}," endpoint. This allows you to retrieve the transaction session data from the back-end, so you can supply it when you initialise the SDK."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Our platform uses HMAC (Hash-based Message Authentication Code) with SHA256 for authentication to ensure secure communication and data integrity. This method involves creating a signature by hashing your request data with a secret key, which must then be included in the HTTP headers of your API request."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["To create the HMAC signature, you need to prepare a string that includes four parts:"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["A timestamp, in ",{"$$mdtype":"Tag","name":"a","attributes":{"target":"_blank","href":"https://en.wikipedia.org/wiki/Unix_time"},"children":["Unix format"]},". For example, ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["1754701373"]},"."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["A unique request ID, in GUID format. For example, ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["ce244054-b372-42c2-9102-f0d976db69f6"]},"."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["The request path, which is ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["api/v1/sessions"]},"."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["The request body. For example:",{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"json","header":{"controls":{"copy":{}}},"source":"{\n   \"merchant\": \"MERCHANT-1\",\n   \"site\": \"SITE-1\",\n   \"sessionTimeout\": 120,\n   \"merchantTransactionId\": \"0ce72cfd-014d-4256-a006-a56601b2ffc4\",\n   \"amounts\": {\n     \"currencyCode\": \"EUR\",\n     \"transactionValue\": 20\n   },\n   \"transactionMethod\": {\n     \"intent\": {\n       \"card\": \"authorisation\",\n       \"paypal\": \"authorisation\"\n     }\n   }\n}\n","lang":"json"},"children":[]}]}]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"align":"left","data-label":"Parameter"},"children":["Parameter"]},{"$$mdtype":"Tag","name":"th","attributes":{"align":"left","data-label":"Description"},"children":["Description"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["merchant"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["string (≤ 20 characters)"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Required","attributes":{},"children":[]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["Your unique merchant identifier, as assigned by PXP. You can find it in the ",{"$$mdtype":"Tag","name":"a","attributes":{"href":"https://portal.pxp.io","target":"_blank"},"children":["Unity Portal"]},", by going to ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Merchant setup > Merchants"]}," and checking the ",{"$$mdtype":"Tag","name":"em","attributes":{},"children":["Merchant ID"]}," column or by clicking on a merchant and checking the ",{"$$mdtype":"Tag","name":"em","attributes":{},"children":["General information"]}," section."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["site"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["string (≤ 20 characters)"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Required","attributes":{},"children":[]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["Your unique site identifier, as assigned by PXP. You can find it in the ",{"$$mdtype":"Tag","name":"a","attributes":{"href":"https://portal.pxp.io","target":"_blank"},"children":["Unity Portal"]},", by going to ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Merchant setup > Sites"]}," and checking the ",{"$$mdtype":"Tag","name":"em","attributes":{},"children":["Site ID"]}," column or by clicking on a site and checking the ",{"$$mdtype":"Tag","name":"em","attributes":{},"children":["General information"]}," section."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["merchantTransactionId"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["string (≤ 50 characters)"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Required","attributes":{},"children":[]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["A unique identifier of your choice that represents this transaction."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["sessionTimeout"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["number"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Required","attributes":{},"children":[]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["The duration of the session, in minutes."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["amounts"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["object"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Required","attributes":{},"children":[]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["Details about the transaction amount."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["amounts.currencyCode"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["string (3 characters)"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Required","attributes":{},"children":[]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["The currency code associated with the transaction, in ISO 4217 format. See ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/guides/checkout/components/supported-currencies"},"children":["Supported payment currencies"]},"."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["amounts.transactionValue"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["number"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Required","attributes":{},"children":[]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["The transaction amount. The numbers after the decimal will be zero padded if they are less than the expected ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["currencyCode"]}," exponent. For example, GBP 1.1 = GBP 1.10, EUR 1 = EUR 1.00, or BHD 1.3 = 1.300. The transaction will be rejected if numbers after the decimal are greater than the expected ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["currencyCode"]}," exponent (e.g., GBP 1.234), or if a decimal is supplied when the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["currencyCode"]}," of the exponent does not require it (e.g., JPY 1.0)."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["transactionMethod"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["object"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Required","attributes":{},"children":[]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["Details about the transaction method and intent."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["transactionMethod.intent"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["object"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Required","attributes":{},"children":[]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["The payment intent for each payment method type."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["transactionMethod.intent.card"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["string"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["The intent for card or Apple Pay transactions.",{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},"Possible values:",{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["authorisation"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["purchase"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["verification"]}]}]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["transactionMethod.intent.paypal"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["string"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["The intent for PayPal transactions.",{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},"Possible values:",{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["authorisation"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["purchase"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["payout"]}]}]}]}]}]}]}]},{"$$mdtype":"Tag","name":"Admonition","attributes":{"type":"info"},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["For PayPal payouts, use ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["\"payout\""]}," as the intent value. Payout transactions have different requirements than payment transactions. See ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/guides/checkout/components/ios/paypal/payouts/how-it-works"},"children":["PayPal Payouts"]}," for more details."]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Put these four parts together following this format: ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["\"{timestamp}{requestId}{requestPath}{requestBody}\""]},". The result should look something like this:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"json","header":{"controls":{"copy":{}}},"source":"1754701373ce244054-b372-42c2-9102-f0d976db69f6api/v1/sessions{\n  \"merchant\": \"MERCHANT-1\",\n  \"site\": \"SITE-1\",\n  \"sessionTimeout\": 120,\n  \"merchantTransactionId\": \"0ce72cfd-014d-4256-a006-a56601b2ffc4\",\n  \"amounts\": {\n    \"currencyCode\": \"EUR\",\n    \"transactionValue\": 20\n  },\n  \"transactionMethod\": {\n    \"intent\": {\n      \"card\": \"authorisation\",\n      \"paypal\": \"authorisation\"\n    }\n  }\n}\n","lang":"json"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Use your token ID to encrypt this data structure by SHA256. You can find your token ID in the ",{"$$mdtype":"Tag","name":"a","attributes":{"href":"https://portal.pxp.io","target":"_blank"},"children":["Unity Portal"]},". Here's an example of an ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["hmacSignature"]}," after you've encrypted the data:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"json","header":{"controls":{"copy":{}}},"source":"1DE2DFC390D7CD746A972140F26846AFA81CF85F5A0BAABA95DBC95301795EA6\n","lang":"json"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["You can now put together your ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Authorization"]}," header. It follows this format: ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["PXP-UST1 {tokenId}:{timestamp}:{hmacSignature}"]},". For example:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"header":{"controls":{"copy":{}}},"source":"\"PXP-UST1 9aac6071-38d0-4545-9d2f-15b936af6d7f:1754701373:1DE2DFC390D7CD746A972140F26846AFA81CF85F5A0BAABA95DBC95301795EA6\"\n"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Lastly, send your request to the Sessions API. You'll need to add a request ID of your choice and include your client ID, which you can find in the ",{"$$mdtype":"Tag","name":"a","attributes":{"href":"https://portal.pxp.io","target":"_blank"},"children":["Unity Portal"]},"."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Here's a full example of what your request might look like:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"curl","header":{"controls":{"copy":{}}},"source":"curl -i -X POST \\\n  'https://api-services.pxp.io/api/v1/sessions' \\\n  -H 'Authorization: \"PXP-UST1 9aac6071-38d0-4545-9d2f-15b936af6d7f:1754701373:1DE2DFC390D7CD746A972140F26846AFA81CF85F5A0BAABA95DBC95301795EA6\"' \\\n  -H 'X-Request-Id: \"550e8400-e29b-41d4-a716-446655440000\"' \\\n  -H 'X-Client-Id: \"f47ac10b-58cc-4372-a567-0e02b2c3d479\"' \\\n  -H 'Content-Type: application/json' \\\n  -d '{\n  \"merchant\": \"MERCHANT-1\",\n  \"site\": \"SITE-1\",\n  \"sessionTimeout\": 120,\n  \"merchantTransactionId\": \"0ce72cfd-014d-4256-a006-a56601b2ffc4\",\n  \"amounts\": {\n    \"currencyCode\": \"EUR\",\n    \"transactionValue\": 20\n  },\n  \"transactionMethod\": {\n    \"intent\": {\n      \"card\": \"authorisation\",\n      \"paypal\": \"authorisation\"\n    }\n  }\n}'\n","lang":"curl"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["If your request is successful, you'll receive a ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["200"]}," response containing the session data."]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"json","header":{"controls":{"copy":{}}},"source":"{\n  \"sessionId\": \"c5f0799b-0839-43ce-abc5-5b462a98f250\",\n  \"hmacKey\": \"904bc42395d4af634e2fd48ee8c2c7f52955a1da97a3aa3d82957ff12980a7bb\",\n  \"encryptionKey\": \"20d175a669ad3f8c195c9c283fc86155\",\n  \"sessionExpiry\": \"2025-05-19T13:39:20.3843454Z\",\n  \"allowedFundingTypes\": {\n    \"cards\": [\n      \"Visa\",\n      \"Diners\",\n      \"Mastercard\",\n      \"AmericanExpress\"\n    ],\n    \"wallets\": {\n      \"paypal\": {\n        \"allowedFundingOptions\": [\n          \"paylater\", \n          \"paypal\"\n        ],\n        \"merchantId\": \"ST9US6Q5XW2KN\"\n      },\n      \"applepay\": {\n        \"merchantId\": \"merchant.com.yourcompany.store\"\n      }\n    }\n  }\n}\n","lang":"json"},"children":[]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"align":"left","data-label":"Parameter"},"children":["Parameter"]},{"$$mdtype":"Tag","name":"th","attributes":{"align":"left","data-label":"Description"},"children":["Description"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["sessionId"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["string (UUID)"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["The unique identifier for the newly-created session."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["hmacKey"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["string"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["The HMAC key generated for securing session communications."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["encryptionKey"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["string"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["A key used for encrypting sensitive session data during communication."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["sessionExpiry"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["string"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["The timestamp indicating when the session will expire, in ISO 8601 format."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["allowedFundingTypes"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["object"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["Details about the funding types allowed for this session.",{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},"Possible values:",{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["cards"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["wallets"]}]}]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["allowedFundingTypes.cards"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["array of strings or null"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["The list of supported card schemes."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["allowedFundingTypes.wallets"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["object or null"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["Details about the supported digital wallets."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["allowedFundingTypes.wallets.paypal"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["object or null"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["PayPal wallet configuration."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["allowedFundingTypes.wallets.paypal.allowedFundingOptions"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["array of strings"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["The list of PayPal funding options available. Possible values: ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["paypal"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["paylater"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["credit"]},"."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["allowedFundingTypes.wallets.paypal.merchantId"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["string"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["The PayPal merchant ID associated with this session."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["allowedFundingTypes.wallets.applepay"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["object or null"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["Apple Pay wallet configuration."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["allowedFundingTypes.wallets.applepay.merchantId"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["string"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["The Apple Pay merchant ID to be used for this session."]}]}]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"step-4-configure-your-ios-project","__idx":5},"children":["Step 4: Configure your iOS project"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Depending on which payment methods you plan to support, you'll need to configure your Xcode project accordingly."]},{"$$mdtype":"Tag","name":"Tabs","attributes":{"size":"medium"},"children":[{"$$mdtype":"Tag","name":"div","attributes":{"label":"Apple Pay","disable":false},"children":[{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"add-required-capabilities","__idx":6},"children":["Add required capabilities"]},{"$$mdtype":"Tag","name":"ol","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["In Xcode, select your project target."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Go to the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Signing & Capabilities"]}," tab."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Click ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["+ Capability"]}," and add:",{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Apple Pay"]},": Required for Apple Pay functionality."]}]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"configure-your-merchant-id","__idx":7},"children":["Configure your merchant ID"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["In the Apple Pay capability section, add your merchant ID:"]},{"$$mdtype":"Tag","name":"ol","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Click the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["+"]}," button under ",{"$$mdtype":"Tag","name":"em","attributes":{},"children":["Merchant IDs"]},"."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Enter your merchant ID (e.g., ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["merchant.com.yourcompany.store"]},"). Ensure it matches exactly with your Apple Developer Console configuration."]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"update-infoplist","__idx":8},"children":["Update Info.plist"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Add the following entries to your ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Info.plist"]},":"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"xml","header":{"controls":{"copy":{}}},"source":"<key>NSAppTransportSecurity</key>\n<dict>\n    <key>NSAllowsArbitraryLoads</key>\n    <false/>\n    <key>NSAllowsArbitraryLoadsInWebContent</key>\n    <false/>\n</dict>\n","lang":"xml"},"children":[]}]},{"$$mdtype":"Tag","name":"div","attributes":{"label":"PayPal","disable":false},"children":[{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"get-your-paypal-credentials","__idx":9},"children":["Get your PayPal credentials"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["To use PayPal payments, you'll need a PayPal client ID. You can obtain this by:"]},{"$$mdtype":"Tag","name":"ol","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Logging in to the ",{"$$mdtype":"Tag","name":"a","attributes":{"href":"https://developer.paypal.com/","target":"_blank"},"children":["PayPal Developer Dashboard"]},"."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Creating or selecting an application."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Copying your client ID from the application details."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Make sure to use the sandbox client ID for testing and production client ID for live transactions."]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"update-infoplist-1","__idx":10},"children":["Update Info.plist"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Add the following entries to your ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Info.plist"]},":"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"xml","header":{"controls":{"copy":{}}},"source":"<key>NSAppTransportSecurity</key>\n<dict>\n    <key>NSAllowsArbitraryLoads</key>\n    <false/>\n    <key>NSAllowsArbitraryLoadsInWebContent</key>\n    <false/>\n</dict>\n","lang":"xml"},"children":[]},{"$$mdtype":"Tag","name":"Admonition","attributes":{"type":"info"},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Unlike Apple Pay, PayPal doesn't require any special Xcode capabilities."]}]}]},{"$$mdtype":"Tag","name":"div","attributes":{"label":"Both","disable":false},"children":[{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"add-required-capabilities-for-apple-pay","__idx":11},"children":["Add required capabilities for Apple Pay"]},{"$$mdtype":"Tag","name":"ol","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["In Xcode, select your project target."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Go to the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Signing & Capabilities"]}," tab."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Click ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["+ Capability"]}," and add ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Apple Pay"]},"."]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"configure-your-apple-pay-merchant-id","__idx":12},"children":["Configure your Apple Pay merchant ID"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["In the Apple Pay capability section, add your merchant ID:"]},{"$$mdtype":"Tag","name":"ol","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Click the ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["+"]}," button under ",{"$$mdtype":"Tag","name":"em","attributes":{},"children":["Merchant IDs"]},"."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Enter your merchant ID (e.g., ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["merchant.com.yourcompany.store"]},"). Ensure it matches exactly with your Apple Developer Console configuration."]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"get-your-paypal-credentials-1","__idx":13},"children":["Get your PayPal credentials"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["To use PayPal payments, you'll need a PayPal client ID:"]},{"$$mdtype":"Tag","name":"ol","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Log in to the ",{"$$mdtype":"Tag","name":"a","attributes":{"href":"https://developer.paypal.com/","target":"_blank"},"children":["PayPal Developer Dashboard"]},"."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Create or select an application."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Copy your client ID from the application details."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Make sure to use the sandbox client ID for testing and production client ID for live transactions."]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"update-infoplist-2","__idx":14},"children":["Update Info.plist"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Add the following entries to your ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Info.plist"]},":"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"xml","header":{"controls":{"copy":{}}},"source":"<key>NSAppTransportSecurity</key>\n<dict>\n    <key>NSAllowsArbitraryLoads</key>\n    <false/>\n    <key>NSAllowsArbitraryLoadsInWebContent</key>\n    <false/>\n</dict>\n","lang":"xml"},"children":[]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"step-5-initialise-the-sdk-and-create-components","__idx":15},"children":["Step 5: Initialise the SDK and create components"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["To initialise the SDK, you need to pass the session data from Step 3 back to your iOS application, along with details about the environment, owner ID and type, merchant shopper ID, and transaction data."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Once the SDK is initialised, you can create payment components for your desired payment methods."]},{"$$mdtype":"Tag","name":"Tabs","attributes":{"size":"medium"},"children":[{"$$mdtype":"Tag","name":"div","attributes":{"label":"Apple Pay","disable":false},"children":[{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"swift","header":{"controls":{"copy":{}}},"source":"import UIKit\nimport PXPCheckoutSDK\n\nclass ViewController: UIViewController {\n    \n    private var pxpCheckout: PxpCheckout?\n    private var applePayComponent: ApplePayButtonComponent?\n    \n    override func viewDidLoad() {\n        super.viewDidLoad()\n        Task {\n            await initialiseTheSDK()\n        }\n    }\n    \n    private func initialiseTheSDK() async {\n        do {\n            // 1. Get the session data from the back-end\n            let sessionData = try await getSessionDataFromBackend()\n            \n            // 2. Create checkout configuration\n            let config = CheckoutConfig(\n                environment: .test,\n                session: sessionData,\n                transactionData: TransactionData(\n                    amount: Decimal(25.00),\n                    currency: \"USD\",\n                    entryType: .ecom,\n                    intent: TransactionIntentData(\n                        card: .authorisation,\n                        paypal: nil\n                    ),\n                    merchantTransactionId: UUID().uuidString,\n                    merchantTransactionDate: { Date() }\n                ),\n                merchantShopperId: \"Shopper_01\",\n                ownerType: \"merchantGroup\",\n                ownerId: \"Unity\",\n                kountDisabled: false // OPTIONAL: Set to true to disable Kount fraud detection\n            )\n            \n            // 3. Initialise the SDK\n            let pxpCheckoutSdk = try PxpCheckout.initialize(config: config)\n            self.pxpCheckout = pxpCheckoutSdk\n            \n            setupApplePayComponent()\n            \n        } catch {\n            showError(\"Failed to initialise SDK: \\(error.localizedDescription)\")\n        }\n    }\n    \n    private func setupApplePayComponent() {\n        guard let pxpCheckout = pxpCheckout else { return }\n        \n        // Create Apple Pay component configuration\n        let config = ApplePayButtonComponentConfig()\n        config.countryCode = \"US\"\n        config.currencyCode = \"USD\"\n        config.supportedNetworks = [.visa, .masterCard, .amex, .discover]\n        config.merchantCapabilities = [.threeDSecure]\n        config.buttonType = .buy\n        config.buttonStyle = .black\n        config.requiredBillingContactFields = [.postalAddress, .name, .emailAddress]\n        config.requiredShippingContactFields = [.postalAddress, .name, .phoneNumber]\n        \n        // Required: Set the total payment amount\n        config.totalPaymentItem = ApplePayPaymentSummaryItem(\n            amount: Decimal(25.00),\n            type: .final,\n            label: \"Your Store Name\"\n        )\n        \n        // Set up callbacks on config\n        config.onPreAuthorisation = { [weak self] in\n            return self?.handlePreAuthorisation() ?? ApplePayTransactionInitData()\n        }\n        \n        config.onPostAuthorisation = { [weak self] submitResult, applePayResult in\n            self?.handlePostAuthorisation(submitResult: submitResult, applePayResult: applePayResult)\n        }\n        \n        config.onError = { [weak self] error in\n            self?.showError(\"Apple Pay error: \\(error.errorMessage)\")\n        }\n        \n        config.onCancel = { [weak self] error in\n            print(\"Apple Pay cancelled: \\(error.errorMessage)\")\n        }\n        \n        // Create the component\n        do {\n            let component = try pxpCheckout.create(.applePayButton, componentConfig: config)\n            applePayComponent = component as? ApplePayButtonComponent\n            \n            // Use buildContent() in SwiftUI to render\n            // applePayComponent?.buildContent()\n        } catch {\n            showError(\"Failed to create Apple Pay component: \\(error.localizedDescription)\")\n        }\n    }\n    \n    private func handlePreAuthorisation() -> ApplePayTransactionInitData {\n        return ApplePayTransactionInitData(\n            riskScreeningData: RiskScreeningData(\n                performRiskScreening: true,\n                deviceSessionId: generateDeviceSessionId(),\n                userIp: \"192.168.1.100\",\n                account: RiskScreeningAccount(\n                    id: \"user_12345678\",\n                    creationDateTime: \"2024-01-15T10:30:00.000Z\"\n                ),\n                items: [\n                    RiskScreeningItem(\n                        price: 25.00,\n                        quantity: 1,\n                        category: \"General\"\n                    )\n                ],\n                fulfillments: [\n                    RiskScreeningFulfillment(\n                        type: .shipped,\n                        recipientPerson: RiskScreeningRecipientPerson(\n                            phoneNumber: \"+1234567890\"\n                        )\n                    )\n                ]\n            )\n        )\n    }\n    \n    private func handlePostAuthorisation(submitResult: BaseSubmitResult, applePayResult: ApplePayResult) {\n        if let merchantResult = submitResult as? MerchantSubmitResult {\n            print(\"Payment success: \\(merchantResult.systemTransactionId)\")\n            // Handle successful payment\n        } else if let failedResult = submitResult as? FailedSubmitResult {\n            showError(\"Payment failed: \\(failedResult.errorReason ?? \"\")\")\n        }\n    }\n    \n    private func getSessionDataFromBackend() async throws -> SessionData {\n        // Implement your backend session request here\n        // This should match the curl request shown above\n        fatalError(\"Implement session data retrieval from your backend\")\n    }\n    \n    private func showError(_ message: String) {\n        DispatchQueue.main.async {\n            let alert = UIAlertController(title: \"Error\", message: message, preferredStyle: .alert)\n            alert.addAction(UIAlertAction(title: \"OK\", style: .default))\n            self.present(alert, animated: true)\n        }\n    }\n    \n    private func generateDeviceSessionId() -> String {\n        // Generate a unique device session ID for fraud screening\n        // This should be implemented based on your fraud prevention provider's requirements\n        return UUID().uuidString\n    }\n}\n","lang":"swift"},"children":[]}]},{"$$mdtype":"Tag","name":"div","attributes":{"label":"PayPal","disable":false},"children":[{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"swift","header":{"controls":{"copy":{}}},"source":"import SwiftUI\nimport PXPCheckoutSDK\n\nstruct PayPalPaymentView: View {\n    @State private var pxpCheckout: PxpCheckout?\n    @State private var paypalComponent: BaseComponent?\n    @State private var isLoading = true\n    @State private var errorMessage: String?\n    \n    var body: some View {\n        VStack(spacing: 16) {\n            if isLoading {\n                ProgressView(\"Initialising PayPal...\")\n            } else if let component = paypalComponent {\n                component.buildContent()\n                    .frame(height: 50)\n            } else if let error = errorMessage {\n                Text(\"Error: \\(error)\")\n                    .foregroundColor(.red)\n            }\n        }\n        .padding()\n        .onAppear {\n            createPayPalComponent()\n        }\n    }\n    \n    private func createPayPalComponent() {\n        Task {\n            do {\n                // 1. Get the session data from the back-end\n                let sessionData = try await getSessionDataFromBackend()\n                \n                // 2. Initialise the SDK\n                let transactionData = TransactionData(\n                    amount: Decimal(25.00),\n                    currency: \"USD\",\n                    entryType: .ecom,\n                    intent: TransactionIntentData(\n                        card: nil,\n                        paypal: .authorisation\n                    ),\n                    merchantTransactionId: \"tx-\\(UUID().uuidString)\",\n                    merchantTransactionDate: { Date() }\n                )\n                \n                let checkoutConfig = CheckoutConfig(\n                    environment: .test,\n                    session: sessionData,\n                    transactionData: transactionData,\n                    merchantShopperId: \"Shopper_01\",\n                    ownerId: \"Unity\",\n                    kountDisabled: false // OPTIONAL: Set to true to disable Kount fraud detection\n                )\n                \n                let pxpCheckout = try PxpCheckout.initialize(config: checkoutConfig)\n                self.pxpCheckout = pxpCheckout\n                \n                // 3. Create PayPal component\n                let config = PayPalButtonComponentConfig()\n                config.fundingSource = .paypal\n                config.payeeEmailAddress = \"merchant@example.com\"\n                config.paymentDescription = \"Order #12345\"\n                \n                // Event handlers\n                config.onApprove = { approvalData in\n                    print(\"Payment successful - Order ID: \\(approvalData.orderID)\")\n                    // Handle successful payment\n                }\n                \n                config.onError = { error in\n                    print(\"Payment error: \\(error.errorMessage)\")\n                    // Show error message to user\n                }\n                \n                config.onCancel = { error in\n                    print(\"Payment cancelled by user\")\n                    // Handle cancellation\n                }\n                \n                let component = try pxpCheckout.create(\n                    .paypalButton,\n                    componentConfig: config\n                )\n                \n                await MainActor.run {\n                    paypalComponent = component\n                    isLoading = false\n                }\n            } catch {\n                await MainActor.run {\n                    errorMessage = error.localizedDescription\n                    isLoading = false\n                }\n            }\n        }\n    }\n    \n    private func getSessionDataFromBackend() async throws -> SessionData {\n        // Implement your backend session request here\n        // This should match the curl request shown in Step 3\n        fatalError(\"Implement session data retrieval from your backend\")\n    }\n}\n","lang":"swift"},"children":[]}]},{"$$mdtype":"Tag","name":"div","attributes":{"label":"Both","disable":false},"children":[{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"swift","header":{"controls":{"copy":{}}},"source":"import SwiftUI\nimport PXPCheckoutSDK\n\nstruct PaymentView: View {\n    @State private var pxpCheckout: PxpCheckout?\n    @State private var applePayComponent: ApplePayButtonComponent?\n    @State private var paypalComponent: BaseComponent?\n    @State private var isLoading = true\n    @State private var errorMessage: String?\n    \n    var body: some View {\n        VStack(spacing: 20) {\n            Text(\"Choose Payment Method\")\n                .font(.headline)\n            \n            if isLoading {\n                ProgressView(\"Initialising payment methods...\")\n            } else {\n                // Apple Pay Button\n                if let applePay = applePayComponent {\n                    VStack(alignment: .leading) {\n                        Text(\"Apple Pay\")\n                            .font(.subheadline)\n                        applePay.buildContent()\n                            .frame(height: 50)\n                    }\n                }\n                \n                // PayPal Button\n                if let paypal = paypalComponent {\n                    VStack(alignment: .leading) {\n                        Text(\"PayPal\")\n                            .font(.subheadline)\n                        paypal.buildContent()\n                            .frame(height: 50)\n                    }\n                }\n                \n                if let error = errorMessage {\n                    Text(\"Error: \\(error)\")\n                        .foregroundColor(.red)\n                }\n            }\n        }\n        .padding()\n        .onAppear {\n            initializePaymentComponents()\n        }\n    }\n    \n    private func initializePaymentComponents() {\n        Task {\n            do {\n                // 1. Get the session data from the back-end\n                let sessionData = try await getSessionDataFromBackend()\n                \n                // 2. Initialise the SDK\n                let transactionData = TransactionData(\n                    amount: Decimal(25.00),\n                    currency: \"USD\",\n                    entryType: .ecom,\n                    intent: TransactionIntentData(\n                        card: .authorisation,\n                        paypal: .authorisation\n                    ),\n                    merchantTransactionId: \"tx-\\(UUID().uuidString)\",\n                    merchantTransactionDate: { Date() }\n                )\n                \n                let checkoutConfig = CheckoutConfig(\n                    environment: .test,\n                    session: sessionData,\n                    transactionData: transactionData,\n                    merchantShopperId: \"Shopper_01\",\n                    ownerId: \"Unity\",\n                    kountDisabled: false // OPTIONAL: Set to true to disable Kount fraud detection\n                )\n                \n                let pxpCheckout = try PxpCheckout.initialize(config: checkoutConfig)\n                self.pxpCheckout = pxpCheckout\n                \n                // 3. Create Apple Pay component\n                let applePayConfig = ApplePayButtonComponentConfig()\n                applePayConfig.countryCode = \"US\"\n                applePayConfig.currencyCode = \"USD\"\n                applePayConfig.supportedNetworks = [.visa, .masterCard, .amex]\n                applePayConfig.merchantCapabilities = [.threeDSecure]\n                applePayConfig.buttonType = .buy\n                applePayConfig.buttonStyle = .black\n                \n                // Required: Set the total payment amount\n                applePayConfig.totalPaymentItem = ApplePayPaymentSummaryItem(\n                    amount: Decimal(25.00),\n                    type: .final,\n                    label: \"Your Store Name\"\n                )\n                \n                applePayConfig.onPostAuthorisation = { submitResult, applePayResult in\n                    handleApplePayResult(submitResult: submitResult, applePayResult: applePayResult)\n                }\n                \n                let applePayComponent = try pxpCheckout.create(.applePayButton, componentConfig: applePayConfig)\n                \n                // 4. Create PayPal component\n                let paypalConfig = PayPalButtonComponentConfig()\n                paypalConfig.fundingSource = .paypal\n                paypalConfig.payeeEmailAddress = \"merchant@example.com\"\n                paypalConfig.paymentDescription = \"Order #12345\"\n                \n                paypalConfig.onApprove = { approvalData in\n                    handlePayPalSuccess(approvalData)\n                }\n                \n                let paypal = try pxpCheckout.create(\n                    .paypalButton,\n                    componentConfig: paypalConfig\n                )\n                \n                await MainActor.run {\n                    self.applePayComponent = applePayComponent as? ApplePayButtonComponent\n                    paypalComponent = paypal\n                    isLoading = false\n                }\n            } catch {\n                await MainActor.run {\n                    errorMessage = error.localizedDescription\n                    isLoading = false\n                }\n            }\n        }\n    }\n    \n    private func handleApplePayResult(submitResult: BaseSubmitResult, applePayResult: ApplePayResult) {\n        if let merchantResult = submitResult as? MerchantSubmitResult {\n            print(\"Apple Pay payment success: \\(merchantResult.systemTransactionId)\")\n            // Handle successful Apple Pay payment\n        } else if let failedResult = submitResult as? FailedSubmitResult {\n            print(\"Apple Pay payment failed: \\(failedResult.errorReason ?? \"\")\")\n        }\n    }\n    \n    private func handlePayPalSuccess(_ approvalData: PayPalApprovalData) {\n        print(\"PayPal payment successful: \\(approvalData.orderID)\")\n        // Handle successful PayPal payment\n    }\n    \n    private func getSessionDataFromBackend() async throws -> SessionData {\n        // Implement your backend session request here\n        // This should match the curl request shown in Step 3\n        fatalError(\"Implement session data retrieval from your backend\")\n    }\n}\n","lang":"swift"},"children":[]}]}]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Parameter"},"children":["Parameter"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Description"},"children":["Description"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["environment"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["Environment"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Required","attributes":{},"children":[]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The environment type.",{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},"Possible values:",{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":[".test"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":[".live"]}]}]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["session"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["SessionData"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Required","attributes":{},"children":[]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Details about the checkout session."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["transactionData"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["TransactionData"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Required","attributes":{},"children":[]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Details about the transaction."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["transactionData.amount"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["Decimal"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Required","attributes":{},"children":[]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The transaction amount (e.g., ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Decimal(25.00)"]},")."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["transactionData.currency"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["String"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Required","attributes":{},"children":[]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The currency code associated with the transaction, in ISO 4217 format (e.g., \"USD\", \"EUR\", \"GBP\")."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["transactionData.entryType"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["EntryType"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Required","attributes":{},"children":[]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The entry type.",{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},"Possible values:",{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":[".ecom"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":[".moto"]}]}]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["transactionData.intent"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["TransactionIntentData"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Required","attributes":{},"children":[]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The transaction intent data containing separate intents for different payment methods. Both parameters are optional - you can specify only the payment method you need.",{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},"Use ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["TransactionIntentData(card: CardIntentType?, paypal: PayPalIntentType?)"]},".",{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},"Card intent values:",{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":[".authorisation"]}," - Pre-authorise funds for later capture"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":[".estimatedAuthorisation"]}," - Pre-auth with estimated amount"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":[".purchase"]}," - Standard immediate payment"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":[".payout"]}," - Send funds to cardholder"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":[".verification"]}," - Verify card without charging"]}]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},"PayPal intent values:",{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":[".authorisation"]}," - Pre-authorise funds for later capture"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":[".purchase"]}," - Standard immediate payment"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":[".payout"]}," - Send funds to PayPal account holder (requires ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["paypalConfig"]},")"]}]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},"Example for payout-only: ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["TransactionIntentData(card: nil, paypal: .payout)"]},".",{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/guides/checkout/components/ios/apple-pay/how-it-works#supported-transaction-intents"},"children":["Learn more about intents"]},"."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["transactionData.merchantTransactionId"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["string"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Required","attributes":{},"children":[]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["A unique identifier for this transaction."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["transactionData.merchantTransactionDate"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["() -> Date"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Required","attributes":{},"children":[]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["A closure that returns the date and time of the transaction. Use ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["{ Date() }"]}," for current date."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["transactionData.cardAcceptorName"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["String?"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Card acceptor name for the transaction."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["transactionData.recurring"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["RecurringType?"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Recurring payment configuration. Use ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["RecurringType(frequencyInDays: Int?, frequencyExpiration: String?)"]}," to specify recurring payment details."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["transactionData.linkId"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["String?"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Transaction link ID for linking related transactions."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["merchantShopperId"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["string"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Required","attributes":{},"children":[]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["A unique identifier for this shopper."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["ownerType"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["String?"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The type of owner as a string.",{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},"Possible values:",{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["\"merchantGroup\""]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["\"merchant\""]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["\"site\""]}]}]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["ownerId"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["string"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Required","attributes":{},"children":[]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The identifier of the owner related to the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["ownerType"]},"."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["onGetShippingAddress"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["(() async -> ShippingAddress?)?"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["An async callback function to dynamically fetch the shipping address. The SDK will call this when it needs the shipping address.",{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},"Example:",{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"code","attributes":{},"children":["swift{% br / %}onGetShippingAddress: {{% br / %}  return await fetchShippingAddressFromBackend(){% br / %}}{% br / %}"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},"The ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["ShippingAddress"]}," structure contains:",{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["address"]},": The first line of the shipping address (String)"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["addressLine2"]},": The second line of the shipping address (String?)"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["city"]},": The city of the shipping address (String)"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["postalCode"]},": The postal or ZIP code (String)"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["countryCode"]},": The 2-character country code in ISO-3166-1 alpha-2 format (String)"]}]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["localisation"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["Localisation?"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Custom UI text overrides for localization."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["locale"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["String?"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Locale for language/region (e.g., \"en-US\", \"es-ES\", \"el-GR\")."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["paypalConfig"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["PayPalConfig?"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["PayPal-specific configuration. Required for PayPal payout transactions. ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"#paypal-payout-configuration"},"children":["Learn more"]},"."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["kountDisabled"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["Bool"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Disable Kount fraud detection. Default: ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["false"]}," (fraud detection enabled)."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["onGetShopper"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["(() async -> TransactionShopper?)?"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["An async callback function to dynamically fetch shopper information."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["analyticsEvent"]},{"$$mdtype":"Tag","name":"Break","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Details","attributes":{},"children":["((BaseAnalyticsEvent) -> Void)?"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Handler for analytics events."]}]}]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"paypal-payout-configuration","__idx":16},"children":["PayPal payout configuration"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["For PayPal payout integrations, you must configure ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["paypalConfig"]}," with payout-specific settings. This is required when using ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":[".payout"]}," intent for PayPal transactions."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"basic-paypal-payout-setup","__idx":17},"children":["Basic PayPal payout setup"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"swift","header":{"controls":{"copy":{}}},"source":"let config = CheckoutConfig(\n    environment: .test,\n    session: sessionData,\n    transactionData: TransactionData(\n        amount: Decimal(100.00),\n        currency: \"USD\",\n        entryType: .ecom,\n        intent: TransactionIntentData(\n            card: nil,\n            paypal: .payout  // Must use .payout intent\n        ),\n        merchantTransactionId: UUID().uuidString,\n        merchantTransactionDate: { Date() }\n    ),\n    merchantShopperId: \"customer-123\",\n    ownerId: \"merchant-id\",\n    kountDisabled: false, // OPTIONAL: Set to true to disable Kount fraud detection\n    paypalConfig: PayPalConfig(\n        payout: PayPalPayoutConfig(\n            paypalWallet: PayPalWallet(\n                email: \"recipient@example.com\",\n                payerId: \"PAYERID123\",  // Max 13 alphanumeric characters\n                proceedPayoutWithSdk: false  // false = automatic payout\n            )\n        )\n    )\n)\n","lang":"swift"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"paypal-payout-with-approval-callback","__idx":18},"children":["PayPal payout with approval callback"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Set ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["proceedPayoutWithSdk: true"]}," to enable the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["onPrePayoutSubmit"]}," callback, which allows you to implement custom approval logic before the payout is processed:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"swift","header":{"controls":{"copy":{}}},"source":"let config = CheckoutConfig(\n    environment: .test,\n    session: sessionData,\n    transactionData: TransactionData(\n        amount: Decimal(100.00),\n        currency: \"USD\",\n        entryType: .ecom,\n        intent: TransactionIntentData(\n            card: nil,\n            paypal: .payout\n        ),\n        merchantTransactionId: UUID().uuidString,\n        merchantTransactionDate: { Date() }\n    ),\n    merchantShopperId: \"customer-123\",\n    ownerId: \"merchant-id\",\n    kountDisabled: false, // OPTIONAL: Set to true to disable Kount fraud detection\n    paypalConfig: PayPalConfig(\n        payout: PayPalPayoutConfig(\n            paypalWallet: PayPalWallet(\n                email: \"recipient@example.com\",\n                payerId: \"PAYERID123\",\n                proceedPayoutWithSdk: true  // Enables onPrePayoutSubmit callback\n            )\n        )\n    )\n)\n","lang":"swift"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"venmo-payout-configuration","__idx":19},"children":["Venmo payout configuration"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"swift","header":{"controls":{"copy":{}}},"source":"let config = CheckoutConfig(\n    environment: .test,\n    session: sessionData,\n    transactionData: TransactionData(\n        amount: Decimal(50.00),\n        currency: \"USD\",\n        entryType: .ecom,\n        intent: TransactionIntentData(\n            card: nil,\n            paypal: .payout\n        ),\n        merchantTransactionId: UUID().uuidString,\n        merchantTransactionDate: { Date() }\n    ),\n    merchantShopperId: \"customer-123\",\n    ownerId: \"merchant-id\",\n    kountDisabled: false, // OPTIONAL: Set to true to disable Kount fraud detection\n    paypalConfig: PayPalConfig(\n        payout: PayPalPayoutConfig(\n            venmoWallet: VenmoWallet(\n                recipientType: .email,  // or .phone, .userHandle\n                receiver: \"user@example.com\",  // or phone number, or @username\n                proceedPayoutWithSdk: false\n            )\n        )\n    )\n)\n","lang":"swift"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"paypal-payout-key-points","__idx":20},"children":["PayPal payout key points"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["PayerId validation"]},": Must be max 13 characters, alphanumeric only."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Intent requirement"]},": Must set ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["paypal: .payout"]}," in ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["TransactionIntentData"]},"."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["proceedPayoutWithSdk flag"]},":",{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["false"]}," (default): SDK proceeds automatically with payout using provided Payer ID."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["true"]},": SDK raises ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["onPrePayoutSubmit"]}," callback for merchant approval before processing."]}]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Email vs PayerId"]},": Provide either email or payerId (or both) for PayPal wallet identification."]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["For a complete guide on implementing PayPal payouts, see ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/guides/checkout/components/ios/paypal/payouts/how-it-works"},"children":["PayPal payouts"]},"."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"whats-next","__idx":21},"children":["What's next?"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["You've successfully installed the SDK and created your first payment component! Here are some recommended next steps:"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["For Apple Pay"]},": Learn more about ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/guides/checkout/components/ios/apple-pay/how-it-works"},"children":["Apple Pay"]},"."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["For PayPal"]},": Learn more about ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/guides/checkout/components/ios/paypal/how-it-works"},"children":["PayPal button component documentation"]},"."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Testing"]},": Use the test environment to validate your integration before going live."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Webhooks"]},": Subscribe to webhooks in the Unity Portal for real-time payment notifications. ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/guides/get-started/about-webhooks"},"children":["Learn more about webhooks"]},"."]}]}]},"headings":[{"value":"Installation","id":"installation","depth":1},{"value":"Before you start","id":"before-you-start","depth":2},{"value":"Step 1: Install the iOS SDK library","id":"step-1-install-the-ios-sdk-library","depth":2},{"value":"Step 2: Get your API credentials","id":"step-2-get-your-api-credentials","depth":2},{"value":"Step 3: Get the session data","id":"step-3-get-the-session-data","depth":2},{"value":"Step 4: Configure your iOS project","id":"step-4-configure-your-ios-project","depth":2},{"value":"Add required capabilities","id":"add-required-capabilities","depth":3},{"value":"Configure your merchant ID","id":"configure-your-merchant-id","depth":3},{"value":"Update Info.plist","id":"update-infoplist","depth":3},{"value":"Get your PayPal credentials","id":"get-your-paypal-credentials","depth":3},{"value":"Update Info.plist","id":"update-infoplist-1","depth":3},{"value":"Add required capabilities for Apple Pay","id":"add-required-capabilities-for-apple-pay","depth":3},{"value":"Configure your Apple Pay merchant ID","id":"configure-your-apple-pay-merchant-id","depth":3},{"value":"Get your PayPal credentials","id":"get-your-paypal-credentials-1","depth":3},{"value":"Update Info.plist","id":"update-infoplist-2","depth":3},{"value":"Step 5: Initialise the SDK and create components","id":"step-5-initialise-the-sdk-and-create-components","depth":2},{"value":"PayPal payout configuration","id":"paypal-payout-configuration","depth":2},{"value":"Basic PayPal payout setup","id":"basic-paypal-payout-setup","depth":3},{"value":"PayPal payout with approval callback","id":"paypal-payout-with-approval-callback","depth":3},{"value":"Venmo payout configuration","id":"venmo-payout-configuration","depth":3},{"value":"PayPal payout key points","id":"paypal-payout-key-points","depth":3},{"value":"What's next?","id":"whats-next","depth":2}],"frontmatter":{"markdown":{"toc":{"depth":2}},"seo":{"title":"Installation"}},"lastModified":"2026-05-19T10:11:04.000Z","pagePropGetterError":{"message":"","name":""}},"slug":"/guides/checkout/components/ios/install","userData":{"isAuthenticated":false,"teams":["anonymous"]},"isPublic":true}