Wallet shipping options
This guide explains how to dynamically update the payment amount based on the shipping method selected by the customer when using Apple Pay or Google Pay in Payment Components.
This functionality supports two flows:
- Via
payment_options.feed_url– Provide the URL of your endpoint that MultiSafepay uses to retrieve available shipping methods dynamically based on the shipping details provided by the customer in Apple Pay or Google Pay. The shipping methods include their prices and allowed or excluded areas. - Via
payment_options.settings.checkout_options.shipping_methods– Define the available shipping methods directly in the request, including their prices and allowed or excluded areas. If bothfeed_urlandshipping_methodsare provided,shipping_methodstakes precedence andfeed_urlis ignored.
NoteIf both
feed_urlandshipping_methodsare provided, the directly configuredshipping_methodstake precedence andfeed_urlis ignored.
How it works
- The customer starts an Apple Pay or Google Pay payment in the Payment Component.
- The customer provides or updates their shipping details in the wallet.
- MultiSafepay determines the available shipping methods using either:
- the merchant endpoint configured in
payment_options.feed_url, or - the shipping methods defined in
payment_options.settings.checkout_options.shipping_methods.
- the merchant endpoint configured in
- The wallet displays the available shipping methods for the customer's shipping address.
- The customer selects a shipping method.
- The shipping method's
priceis added to the payment amount. - If the customer selects a different shipping method, the payment amount is updated based on the price of the newly selected method.
- The customer continues and authorizes the payment using the updated amount.
1. Enable shipping
Enable shipping for Apple Pay, Google Pay, or both under the required object: payment_options.settings.gateways.
-
Google Pay:
GOOGLEPAY.shipping.enabled -
Apple Pay:
APPLEPAY.shipping.enabledFor example:
{ "payment_options": { "settings": { "gateways": { "APPLEPAY": { "shipping": { "enabled": true } }, "GOOGLEPAY": { "shipping": { "enabled": true } } } } } }
2. Configure shipping methods
Choose one of the following flows:
Provide your shipping endpoint in payment_options.feed_url.
This endpoint retrieves available shipping methods based on the shipping details provided by the customer in Apple Pay or Google Pay.
When using feed_url, make sure the applicable shipping methods are correctly mapped to payment_options.settings.checkout_options.shipping_methods in the request.
Example request
{
"payment_options": {
"feed_url": "https://example.com/shipping",
"settings": {
"gateways": {
"APPLEPAY": {
"shipping": {
"enabled": true
}
},
"GOOGLEPAY": {
"shipping": {
"enabled": true
}
}
},
"checkout_options": {
"shipping_methods": {
"flat_rate_shipping": [
{
"name": "Standard shipping",
"price": 7
},
{
"name": "Express shipping",
"price": 9
}
]
}
}
}
}
}When the customer selects a shipping method, its price is used to update the payment amount.
Updated 7 days ago