How to Download Dependencies from a Repository based on Build Type/Environment in Gradle file

Is it possible to download dependencies from a repository based on build types when authenticating into it with respective credentials (i.e. our debug/dev creds pointing to a Square account’s Reader SDK, and the release creds pointing to another Square account’s Reader SDK in this case) via the same repository URL? Because, I’m not really seeing any documentation on this as of now.

Here was my attempt earlier when reaching out directly to the Square team, where I had problems getting the build to be successful on CI even though it worked locally on my machine:

Here’s something I’d ideally like considering that authenticating into one URL with one repository block seems to work locally and CI (only when pointing to one environment though), but will need to set up logic exclusively on the build.gradle file to retrieve the artifacts based on debug and release types:

...

repositories {
    def squareReaderSdkAppId = SQUARE_READER_SDK_APP_ID_DEV
    // Non-existent boolean debug flag, but here for informative purposes.
    if (!debug) {
        squareReaderSdkAppId = SQUARE_READER_SDK_APP_ID_PROD
    }

    def squareReaderSdkPassword = SQUARE_READER_SDK_PW_DEV
    // Non-existent boolean debug flag, but here for informative purposes.
    if (!debug) {
        squareReaderSdkPassword = SQUARE_READER_SDK_PW_PROD
    }

    google()
    maven {
        url "https://sdk.squareup.com/android"
        credentials {
            username squareReaderSdkAppId
            password squareReaderSdkPassword
        }
    }
    jcenter()
}

...

Can someone point me in the right direction for this?