- Order breakdown: show subtotal, shipping, taxes, and discounts instead of a single total.
- Shipping address updates: recalculate the order when the customer picks or changes their shipping address, without leaving the sheet.
- Shipping method selector: let the customer choose Standard, Express, or Same-day on the sheet, with instant price updates.
Requirements
How it works
- Your backend adds
summary_itemsand/orshipping_methodswhen it creates the checkout session. - Your app implements
onShippingAddressChangedon the delegate it already passes to the payment flow. - On the Apple Pay sheet, switching shipping method updates the price instantly without calling your app. Picking or changing the shipping address calls your handler, so you can return new totals, new methods, or an error.
- After the customer authorizes, the one-time token includes a
shippingobject with the selected method and the full address.
- Every
summary_itemslist must end with the grand total. Itsamountis the total shown on the sheet, and itslabelis shown next to it as the payee line (we recommend your store name). - All amounts must use the session currency. A different currency makes the SDK ignore that breakdown or response.
Step 1: Show an order breakdown (backend only)
Addsummary_items when you create the checkout session:
- The last entry is displayed as the grand total and its label as the payee line.
- Discounts can be negative, for example
-5.00. - When you also send
shipping_methods(Step 2), the sheet opens with the first method’s breakdown and this list is ignored. - Without
summary_itemsand withoutshipping_methods, the sheet shows a single line with the session amount.
Step 2: Offer shipping methods on the sheet
Addshipping_methods to the checkout session. Each method has its own summary_items, so the sheet can update the price as soon as the customer switches method:
- The first method is preselected and its breakdown is the one the sheet opens with.
labelis the option name anddetailits description. Apple Pay shows the price next to the option.- Switching methods never calls your app or your backend. The total comes from that method’s
summary_items. A method without a breakdown keeps the totals already on the sheet. delivery_estimateis afromandtopair ofYYYY-MM-DDdates. On iOS 15 and later it is rendered as a date range next to the option. A reversed or malformed range is not shown.- The sheet accepts up to 100 methods, 100 summary items, and 100 items per method. Above that, the SDK opens the sheet without shipping methods.
Step 3: React to shipping address changes
Conform the delegate you already pass to the payment flow toYunoShippingDelegate and implement onShippingAddressChanged. It works with every flow that takes a YunoPaymentDelegate: startCheckout, startPaymentLite, and the payment methods list of Full mode.
async, or you integrate from Objective-C, implement the completion-based variant that YunoPaymentDelegate declares as optional instead:
async one.
What you receive: YunoShippingInfo
Before authorization, Apple Pay shares only part of the address, which is enough to quote shipping and taxes:
Every field can be
nil. The full address arrives in the one-time token (Step 4).
What you return: YunoShippingUpdate
Return any combination of these, ornil to keep the sheet as it is:
Rules
Unlike Google Pay, an error on the Apple Pay sheet does block the payment: the customer has to pick another address before paying. Still validate the address on your server when you create the payment.
Step 4: Read the result in the one-time token
After the customer authorizes, the one-time token you receive inyunoCreatePayment includes a shipping object with the selected method and the full address:
methodis the one selected on the sheet, or the first one if the customer didn’t change it.summary_itemsare not sent back.- The object is included whenever the sheet collected a shipping method or an address, with or without a handler. Payments without either don’t include
shipping.
What happens in each case
Good to know
- Apple Pay is not supported in the iOS Simulator. Test on a physical device.
- Apple Pay redacts the address until the payment is authorized, so your handler never sees street lines.
- The selected method stays selected when the customer changes the address, unless you return new methods.
- Privacy: the SDK never logs addresses, emails, or payment data.
Testing checklist
- Upgrade to SDK 2.24.0 or newer and build.
- Create a session with
summary_itemsonly. The sheet shows the breakdown and the right total. - Create a session with
shipping_methods. The sheet shows the selector with the first method selected and asks for a shipping address. - Switch methods. The price updates and your handler is not called.
- Implement the handler and change the address. Your handler receives it; return new totals and check the sheet updates.
- Return an error for an address you don’t serve. The sheet shows your message and the customer cannot pay until they pick another address.
- Authorize. The token includes
shippingwith the method and the full address. - Remove the handler and the session fields. Everything works as before.
Troubleshooting
Related documentation
- Setup and one-time payments
- Google Pay express checkout on Android
- Fast Checkout Shipping. The same session fields and
shippingnode on wallets that pick the address inside the widget. - iOS SDK changelog