if present // Printavo API credentials define('PRINTAVO_EMAIL', 'ryand@5boysproductions.com'); define('PRINTAVO_PASSWORD', 'FiveBoys5$'); // Authenticate with Printavo V1 function get_printavo_token() { $response = wp_remote_post('https://www.printavo.com/api/v1/sessions', [ 'headers' => ['Content-Type' => 'application/json'], 'body' => json_encode([ 'email' => PRINTAVO_EMAIL, 'password' => PRINTAVO_PASSWORD ]), 'timeout' => 30 ]); if (is_wp_error($response) || wp_remote_retrieve_response_code($response) !== 200) { return null; } $body = json_decode(wp_remote_retrieve_body($response), true); return $body['token'] ?? null; } // Validate order and email function check_order_status() { $visual_id = sanitize_text_field($_POST['invoice_id']); $user_email = sanitize_email($_POST['email']); $token = get_printavo_token(); if (!$token) { wp_send_json_error(['message' => 'Authentication failed']); } // V1: Search for order ID by visual ID $search_url = sprintf( 'https://www.printavo.com/api/v1/orders/search?email=%s&token=%s&query=%s', urlencode(PRINTAVO_EMAIL), urlencode($token), urlencode($visual_id) ); $v1_response = wp_remote_get($search_url, ['timeout' => 30]); if (is_wp_error($v1_response) || wp_remote_retrieve_response_code($v1_response) !== 200) { wp_send_json_error(['message' => 'Order Not Found']); } $v1_data = json_decode(wp_remote_retrieve_body($v1_response), true); if (empty($v1_data['data'])) { wp_send_json_error(['message' => 'Order Not Found']); } $order = null; foreach ($v1_data['data'] as $o) { if ((string)$o['visual_id'] === (string)$visual_id) { $order = $o; break; } } if (!$order) { wp_send_json_error(['message' => 'Order Not Found']); } $order_id = $order['id']; // V2: Get customer email $query = ' query GetCustomerEmail($id: ID!) { invoice(id: $id) { contact { email } } } '; $variables = ['id' => (string)$order_id]; $v2_response = wp_remote_post('https://www.printavo.com/api/v2/', [ 'headers' => [ 'Content-Type' => 'application/json', 'email' => PRINTAVO_EMAIL, 'token' => $token ], 'body' => json_encode(['query' => $query, 'variables' => $variables]), 'timeout' => 30 ]); if (is_wp_error($v2_response) || wp_remote_retrieve_response_code($v2_response) !== 200) { wp_send_json_error(['message' => 'Error validating email']); } $v2_data = json_decode(wp_remote_retrieve_body($v2_response), true); $contact_email = $v2_data['data']['invoice']['contact']['email'] ?? ''; if (strtolower($contact_email) !== strtolower($user_email)) { wp_send_json_error(['message' => "This email is not associated with Invoice #$visual_id. Please check your email and try again"]); } // Store in session session_start(); $_SESSION['validated_order_id'] = $order_id; $_SESSION['validated_visual_id'] = $visual_id; wp_send_json_success(['message' => 'Order validated']); } add_action('wp_ajax_check_order_status', 'check_order_status'); add_action('wp_ajax_nopriv_check_order_status', 'check_order_status'); Details – 5Boys Apparel

Free proofs for approval prior to production + Free Shipping!

product image

Get A Quick Quote

Min Qty: |

Enter Qty

No. of Colors

Not including taxes and shipping.

BELLA+CANVAS Youth Triblend Short Sleeve Tee

Select Color:

Retail fit Tear-away label Side seamed 3.8-ounce, 50/25/25 poly/Airlume combed and ring spun cotton/rayon, 40 singles

SKU: BC3413Y
Size Range: S - XL
Manufacturer: Bella+Canvas
Print Options: Print, Digital Print, Screen Print
Available Print Regions: front

Best Selling Packages