json([ 'data' => $this->checkout->tiers(), ]); } public function store(Request $request): JsonResponse { $data = $this->validate($request, [ 'tier_key' => ['required', 'string'], 'purchaser_email' => ['required', 'email:rfc,dns'], 'recipient_email' => ['nullable', 'email:rfc,dns'], 'recipient_name' => ['nullable', 'string', 'max:191'], 'message' => ['nullable', 'string', 'max:500'], 'success_url' => ['nullable', 'url'], 'return_url' => ['nullable', 'url'], ]); $checkout = $this->checkout->create($data); if (! $checkout['checkout_url']) { throw ValidationException::withMessages([ 'tier_key' => __('Unable to create Paddle checkout.'), ]); } return response()->json($checkout); } }