diff --git a/src/Types/ApplePayTypes.res b/src/Types/ApplePayTypes.res index 20402982c..219793540 100644 --- a/src/Types/ApplePayTypes.res +++ b/src/Types/ApplePayTypes.res @@ -42,6 +42,10 @@ type paymentRequestData = { } let jsonToPaymentRequestDataType: Js.Dict.t => paymentRequestData = jsonDict => { + let clientTimeZone = CardUtils.dateTimeFormat(.).resolvedOptions(.).timeZone + let clientCountry = Utils.getClientCountry(clientTimeZone) + let defaultCountryCode = clientCountry.isoAlpha2 + let getTotal = totalDict => { Utils.getString(totalDict, "type", "") == "" ? total( @@ -59,7 +63,7 @@ let jsonToPaymentRequestDataType: Js.Dict.t => paymentRequestData = j if Utils.getString(jsonDict, "merchant_identifier", "") == "" { paymentRequestData( - ~countryCode=Utils.getString(jsonDict, "country_code", ""), + ~countryCode=Utils.getString(jsonDict, "country_code", defaultCountryCode), ~currencyCode=Utils.getString(jsonDict, "currency_code", ""), ~merchantCapabilities=Utils.getStrArray(jsonDict, "merchant_capabilities"), ~supportedNetworks=Utils.getStrArray(jsonDict, "supported_networks"),