客户页面 URL

Customer page URL

所以,我有一个 Braintree 客户 ID 并可以访问 Braintree API (Python)。

知道客户 ID,如何在 Braintree 网站上为客户页面构建 URL?类似于 https://sandbox.braintreegateway.com/merchants/{merchant_id}/customers/{customer_id}

我是手动执行此操作还是有一个 API?

这是我目前的解决方案:

if user.braintree_customer_id:
    bt_customer_url = braintree.Configuration.gateway().customer.config.base_merchant_url(
    ) + '/customers/%s' % user.braintree_customer_id
    url_parts = urlparse.urlsplit(bt_customer_url)
    if url_parts.netloc.startswith('api.'):
        url_parts = list(url_parts)
        url_parts[1] = url_parts[1][4:]
        bt_customer_url = urlparse.urlunsplit(url_parts)

我在布伦特里工作。没有 API 调用您正在寻找的 URL,但您可以按照您所做的方式构建它。我不能保证 url 结构永远不会改变,但如果它改变了,更新你的脚本应该很简单。