Braintree sources
The nonce customer operation saves provider/local customer data. Client-token generation is a separate legacy route with a source limitation; do not assume these operations form a complete working recipe.
| Task | Operation |
|---|---|
| Inspect legacy client-token request | Client token |
| Save customer using nonce | Customer |
Example runtimes, base-address conventions and synthetic values follow response conventions.
Request the legacy client token
The registered operation intends to generate a provider client token, distinct from a payment-method nonce or Wallkit member token. The inspected implementation does not establish a reachable successful generation path.
GET /api/v1/user/braintree/client-token
Before you call
Use the member and resource context; apply this operation’s provider and record requirements below.
Its helper immediately calls initBrainTree, whose only definition is commented out in this source. No active initializer or local error catch is present in the inspected controller/trait. Do not make this route a required setup step or assume HTTP 200; obtain provider-client prerequisites through the existing configured integration.
Downstream code would choose a member-owned Braintree customer across resources, with card-joined default ASC/customer ID DESC first then newest customer fallback; resource header is not a customer-selection filter. If no customer resolves, downstream customer_id access is also unguarded. These downstream steps are not proof they execute.
Request
Bodyless; no nonce/card/customer input or mode selector.
Result
The handler intends to return a client_token string with HTTP 200 if its helper returns. The inspected source does not establish that this response can be reached. No local customer/source/default/charge creation is performed by the visible intended generator.
Example: Inspect the intended client-token transport
The source cannot establish successful generation because the active initializer is missing. The conditional envelope below only explains where a provider client token would appear; it is not a nonce or saved source.
curl -X GET "${WALLKIT_API_BASE}/api/v1/user/braintree/client-token" \
-H "token: ${USER_TOKEN}" \
-H "resource: ${RESOURCE_KEY}"
const response = await fetch(`${process.env.WALLKIT_API_BASE}/api/v1/user/braintree/client-token`, {
method: "GET",
headers: {token: process.env.USER_TOKEN, resource: process.env.RESOURCE_KEY}
});
console.log(response.status, await response.json());
import os, json
from urllib.request import Request, urlopen
from urllib.error import HTTPError
request = Request(os.environ["WALLKIT_API_BASE"] + "/api/v1/user/braintree/client-token",
method="GET", headers={"token": os.environ["USER_TOKEN"],
"resource": os.environ["RESOURCE_KEY"]})
try:
with urlopen(request) as response:
print(response.status, json.load(response))
except HTTPError as error:
print(error.code, json.load(error))
Synthetic intended-envelope excerpt; successful generation is not established:
{
"client_token": "SYNTHETIC_PROVIDER_CLIENT_TOKEN"
}
Consequential alternate
The intended result excerpt is for understanding the transport only; the missing initializer prevents the source from establishing that result. No stable failure status/code or runtime response is claimed. Treat an unavailable result as no token, not an empty successful source.
Recovery
| Status | Code / shape | Cause | Next action |
|---|---|---|---|
| Unspecified | No handler-specific failure envelope | Missing active initializer; shared/runtime dispatch behavior not established. | Ask integration administrator to inspect the configured existing token path; do not loop this GET as an onboarding workaround. |
Next task
If the existing provider client already supplies a nonce, create the Braintree customer. A client token is not the nonce input.
Create a customer from a Braintree nonce
Consume an existing provider-client nonce to create a provider customer and import local card records. This does not generate a client token/nonce or charge.
POST /api/v1/user/braintree/customer
Before you call
Use the member and resource context; apply this operation’s provider and record requirements below.
Explicit braintree operator uses resource payments_in_live_mode (default true) to select live/test environment, merchant_id/public_key/private_key from resource settings with global config fallbacks. Existing provider client must issue the nonce for that configured context; no independent nonce/member ownership check beyond provider creation is added.
Provider receives member first/last name, email and company. Local customer reuse/create and optional resource attachment follow (auto_attach_customer_to_resource default true). Braintree card import uses provider bin as local card_id and can fail on absent bin; it updates available brand/location/last4 and does not set a universal local default, expiry or modern method.
Provider writes precede unchecked local saves/attachment failures; no enclosing transaction/replay guarantee.
Request
JSON object required.
| Name | Location | Type / requirement | Meaning |
|---|---|---|---|
| nonce | JSON | required nonempty; trimmed string | Existing Braintree paymentMethodNonce, SYNTHETIC_BRAINTREE_NONCE here. Not provider client token, member token or local customer ID. |
Result
HTTP 200 Top-level legacy customer record: local id, provider customer_id, provider label, local timestamps and related cards. No member wrapper or payment_method ID.
Example: Save a customer using a Braintree nonce
Supply a nonce from the existing configured provider client. Local card 5002 in the customer excerpt is the later checkout identifier; no universal default is established.
curl -X POST "${WALLKIT_API_BASE}/api/v1/user/braintree/customer" \
-H "token: ${USER_TOKEN}" \
-H "resource: ${RESOURCE_KEY}" \
-H "Content-Type: application/json" \
--data '{"nonce":"SYNTHETIC_BRAINTREE_NONCE"}'
const response = await fetch(`${process.env.WALLKIT_API_BASE}/api/v1/user/braintree/customer`, {
method: "POST",
headers: {token: process.env.USER_TOKEN, resource: process.env.RESOURCE_KEY, "Content-Type": "application/json"},
body: JSON.stringify({"nonce":"SYNTHETIC_BRAINTREE_NONCE"})
});
console.log(response.status, await response.json());
import os, json
from urllib.request import Request, urlopen
from urllib.error import HTTPError
body = {'nonce': 'SYNTHETIC_BRAINTREE_NONCE'}
request = Request(os.environ["WALLKIT_API_BASE"] + "/api/v1/user/braintree/customer",
method="POST", headers={"token": os.environ["USER_TOKEN"],
"resource": os.environ["RESOURCE_KEY"], "Content-Type": "application/json"}, data=json.dumps(body).encode("utf-8"))
try:
with urlopen(request) as response:
print(response.status, json.load(response))
except HTTPError as error:
print(error.code, json.load(error))
Synthetic HTTP 200 response excerpt:
{
"id": 4002,
"pay_system": "braintree",
"customer_id": "SYNTHETIC_BRAINTREE_CUSTOMER",
"cards": [
{
"id": 5002,
"card_last4": "0000"
}
]
}
Consequential alternate
HTTP 406 incorrect_customer can occur after provider customer creation when importing local card data fails, for example missing bin. It does not prove the provider customer was rolled back.
Recovery
| Status | Code / shape | Cause | Next action |
|---|---|---|---|
| 406 | incorrect_data / incorrect_nonce | Missing JSON/nonempty nonce. | Supply provider-client nonce in JSON. |
| 406 | incorrect_customer | Provider create or local import fails. | Inspect configured environment and partial customer/card state before repeating. |
| 406 intended | create_customer_fail | Other caught exception. | Investigate configuration/local records; logging in that catch has no guaranteed initialized error property here, so the envelope is not universal. |
Next task
List cards using intended resource to choose local user_card_id 5002, then calculate/checkout with configured Braintree context. Client-token route limitation remains separate.