SDK Integration
This guide provides a comprehensive process to integrate Apple Pay with Yuno SDK for both one-time and recurring payments. The SDK simplifies Apple Pay integration by handling payment token management and providing built-in security.
Setup RequiredBefore implementing Apple Pay payments, ensure you have completed the prerequisites.
Apple Pay overview
- Customer initiates payment on their iOS device
- Receive
payment_token
via Apple SDK - Create a checkout session with Yuno
- Yuno processes with your configured provider(s) and returns a response
- Monitor response status via webhooks
Add Apple Pay capability
To add Apple Pay capability to your iOS app:
- In Xcode, select your project in the navigator
- Select your app target
- Go to the Signing & Capabilities tab
- Click + Capability and search for "Apple Pay"
- Add the Apple Pay capability
- Configure your Merchant IDs in the Apple Pay section
Ensure your Apple Pay Merchant ID matches the one configured in your Yuno Dashboard provider connections.
One-time payments with SDK
One-time Apple Pay payments using the Yuno SDK provide a streamlined integration experience for immediate transactions.
Create checkout session
Use the create checkout session endpoint to create a payment session for one-time Apple Pay transactions:
{
"country": "US",
"customer_id": "070a34cb-4649-4a4e-b231-065a53060379",
"merchant_order_id": "order-123",
"payment_description": "Apple Pay one-time payment",
"amount": {
"currency": "USD",
"value": 100
}
}
Process the payment
The SDK handles the Apple Pay flow automatically. When the customer completes the Apple Pay authorization, the payment is processed immediately.
Recurring payments with SDK
The SDK streamlines recurring payments by managing both Customer‑Initiated (CIT) and Merchant‑Initiated (MIT) transactions while securely handling payment tokens.
Customer Initiated Transaction (CIT)
The CIT is the initial transaction where the customer authorizes recurring payments, such as when they subscribe to a monthly service. This transaction requires customer interaction and generates a token for future MIT transactions.
Example CIT request
{
"account_id": "62fa3145-1408-4044-a599-caa0c2159782",
"amount": {
"currency": "USD",
"value": 2000
},
"checkout": {
"session": "0793c7a5-79c6-40d6-aa5f-13e4e9bdf169"
},
"payment_method": {
"vault_on_success": true,
"detail": {
"wallet": {
"payment_token": "{\n \"paymentMethod\": {\n \"type\": \"credit\",\n \"displayName\": \"Visa 3748\",\n \"network\": \"Visa\"\n },\n \"paymentData\": {\n \"data\": \"B5NSQI0TdXuLwqadBCL0yOwtik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1UECgwKQXBwbGUgSW5jLjELMAkGA1UEBhMCVVMw\",\n \"header\": {\n \"publicKeyHash\": \"YK8kdoBXLGqBQKBtCZOl0DQTUHOWidRCxgOgf/1gBMM=\",\n \"ephemeralPublicKey\": \"MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEEVv32VVJYlg+E0zMsthvBaldJcH45NUWhVckme/CQYFtHf60FEdFtzwabOEMY3u1De+6e+IuBv53OxmWx+1w2w==\",\n \"transactionId\": \"87a03c4cc1b242a25d74257d4bc990a6473b9866392850e584a9f680dcdf3d0f\"\n },\n \"version\": \"EC_v1\"\n }\n}",
"stored_credentials": {
"reason": "SUBSCRIPTION",
"usage": "FIRST"
}
}
},
"type": "APPLE_PAY"
},
"customer_payer": {
"id": "070a34cb-4649-4a4e-b231-065a53060379",
"nationality": "CO",
"browser_info": {
"user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/18.6 Safari/605.1.15",
"accept_header": "application/json",
"accept_content": "*/*",
"accept_browser": "*/*",
"color_depth": "5",
"screen_height": "8",
"screen_width": "8",
"javascript_enabled": true,
"java_enabled": false,
"browser_time_difference": "300",
"language": "en",
"platform": "WEB"
}
},
"subscription": {
"id": "d67a4295-7bb3-4183-99ce-9f5d26d92709",
"billing_date": {
"type": "fixed_day",
"day": 18
}
},
"merchant_order_id": "merchant-order-123",
"country": "CO",
"description": "Apple Pay recurring setup",
"workflow": "SDK_CHECKOUT"
}
Key parameters for CIT
vault_on_success: true
: This parameter indicates this is a recurring payment setup and generates the token for future MIT transactionsstored_credentials.usage: "FIRST"
: Indicates this is the initial transaction in a recurring seriessubscription
: Required object containing subscription details for Apple Pay recurrence
Merchant Initiated Transaction (MIT)
MIT transactions are processed automatically for subsequent billing cycles using the token generated during the CIT.
Example MIT request
{
"account_id": "account-id",
"amount": {
"currency": "USD",
"value": 100
},
"payment_method": {
"vaulted_token": "98c16e23-ebdd-4d0f-85bd-e0ba7d2fedf6",
"detail": {
"card": {
"stored_credentials": {
"reason": "SUBSCRIPTION",
"usage": "USED"
}
}
},
"type": "APPLE_PAY"
},
"customer_payer": {
"id": "customer-id"
},
"merchant_order_id": "recurring-order-456",
"country": "US",
"description": "Apple Pay recurring payment",
"workflow": "SDK_CHECKOUT"
}
Key parameters for MIT
token
: The payment token generated during the CITstored_credentials.usage: "USED"
: Indicates this is a subsequent transaction in a recurring series- No
payment_token
required: Uses the stored token instead
Monitor payment status through webhooks to handle edge cases and provide customer notifications.
Subscription management URL
For SDK recurring payments, you must provide a subscription management URL where customers can manage and cancel their subscription. Include it in your customer communications.
Related documentation
Updated 19 days ago