Ah, I'd missed that nuance - so you were determining/setting the startSession endpoint url manually/yourself?
No need to do that, as the url is provided when Apple calls your session object’s
onvalidatemerchant
callback function.
While we're in this beta phase of Apple's development of applepayJS they are providing a single/different endpoint url, but when they move out of beta it could be any one of a number of different urls (for load balancing?), but none of which are https://apple-pay-gateway.apple.com/paymentservices/startSession , they're in the format https://apple-pay-gateway-??-????.apple.com/paymentservices/startSession
The sandbox (sandbox != beta ) is entered by virtue of the iphone you use being logged into a sandbox icloud account, it's not determined by the endpoint url used. Sandbox will still be there once ApplePayJS moves out of beta in the Autumn.
I'm testing with both a real and sandbox icloud account and they're both working OK (have notice slight differences, like the sandbox account isn't sending the icloud account's countryCode in the session.onshippingcontactselected callback but it is with a prod icloud account)
ApplePayJS is never going to know if you have a credit card gateway or not. ApplePayJS only exists to give you an encrypted, tokenised credit card number. you can choose to process that yourself or hand it off to a credit card gateway/payment provider (stripe.com, braintreepayments.com) but ApplePayJS has no knowledge of the method you're going to use.