(testing)
The testing endpoint allows you to test various functionality within Bolt. Create a test credit card to process a test payment in your store. You can also simulate tracking an order’s shipment and programmatically create customer accounts to use as dummy data. See our related guide on Testing.
- test_shipping - Test Shipping
- create_testing_shopper_account - Create Testing Shopper Account
- get_test_credit_card_token - Fetch a Test Credit Card Token
This endpoint simulates tracking an order's shipment and is for testing purposes only.
from bolt_api_sdk import Bolt, models
from bolt_api_sdk.utils import parse_datetime
import os
with Bolt(
security=models.Security(
x_api_key=os.getenv("BOLT_X_API_KEY", ""),
),
) as bolt:
bolt.testing.test_shipping(request={
"delivery_estimate": "<value>",
"status": models.MockTrackingInputStatus.FAILURE,
"tracking_detail": [
{
"city": "New York",
"country": "USA",
"datetime": parse_datetime("2017-07-21T17:32:28Z"),
"message": "BILLING INFORMATION RECEIVED",
"state": "New York",
"status": models.TrackingDetailStatus.IN_TRANSIT,
"zip": "10044",
},
],
"tracking_number": "MockBolt1234",
})
# Use the SDK ...| Parameter | Type | Required | Description |
|---|---|---|---|
request |
models.MockTrackingInput | ✔️ | The request object to use for the request. |
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.ErrorsBoltAPIResponse | 400, 422 | application/json |
| errors.APIError | 4XX, 5XX | */* |
Create a Bolt shopper account for testing purposes. Available for sandbox use only and the created account will be recycled after a certain time.
from bolt_api_sdk import Bolt, models
import os
with Bolt(
security=models.Security(
x_api_key=os.getenv("BOLT_X_API_KEY", ""),
),
) as bolt:
res = bolt.testing.create_testing_shopper_account(testing_account_request=models.TestingAccountRequest(
deactivate_in_days=30,
email_state=models.AccountIdentifierStatus.VERIFIED,
phone_state=models.AccountIdentifierStatus.VERIFIED,
))
# Handle response
print(res)| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
x_publishable_key |
Optional[str] | ➖ | The publicly viewable identifier used to identify a merchant division. This key is found in the Developer > API section of the Bolt Merchant Dashboard [RECOMMENDED]. | |
testing_account_request |
Optional[models.TestingAccountRequest] | ➖ | N/A | { "deactivate_in_days": 30, "email_state": "verified", "phone_state": "verified" } |
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.APIError | 4XX, 5XX | */* |
This endpoint fetches a new credit card token for Bolt's universal test credit card number 4111 1111 1111 1004. This is for testing and is available only in sandbox.
from bolt_api_sdk import Bolt, models
import os
with Bolt(
security=models.Security(
x_api_key=os.getenv("BOLT_X_API_KEY", ""),
),
) as bolt:
res = bolt.testing.get_test_credit_card_token()
# Handle response
print(res)| Parameter | Type | Required | Description |
|---|---|---|---|
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
models.GetTestCreditCardTokenResponse
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.APIError | 4XX, 5XX | */* |